Bug 616779 - Review Request: rubygem-json_pure - JSON implementation in pure Ruby
Summary: Review Request: rubygem-json_pure - JSON implementation in pure Ruby
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Mamoru TASAKA
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-07-21 12:13 UTC by Michal Fojtik
Modified: 2014-07-21 12:40 UTC (History)
7 users (show)

Fixed In Version: rubygem-json_pure-1.4.6-3.fc14
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-10-19 07:01:19 UTC
Type: ---
Embargoed:
mtasaka: fedora-review+
gwync: fedora-cvs+


Attachments (Terms of Use)

Description Michal Fojtik 2010-07-21 12:13:39 UTC
Spec URL: http://mifo.sk/RPMS/rubygem-json_pure.spec
SRPM URL: http://mifo.sk/RPMS/rubygem-json_pure-1.4.3-1.fc13.src.rpm
Description:

This is a implementation of the JSON specification according to RFC 4627 www.ietf.org/rfc/rfc4627.txt . Starting from version 1.0.0 on there will be two variants available:

A pure ruby variant, that relies on the iconv and the stringscan extensions, which are both part of the ruby standard library.
The quite a bit faster C extension variant, which is in parts implemented in C and comes with its own unicode conversion functions and a parser generated by the ragel state machine compiler www.cs.queensu.ca/~thurston/ragel .

Comment 1 Michal Fojtik 2010-07-21 12:30:21 UTC
Just quick note:

We already have 'json' packaged for Fedora. This one is needed for Cucumber update. Binary objects under tests directory are removed (%check), because they are only needed for test as an generators. This gem doesn't have any binary extensions left after build.

rpmlint: No errors, couple macro warnings.
koji: http://koji.fedoraproject.org/koji/taskinfo?taskID=2333213

Comment 2 Mamoru TASAKA 2010-07-22 16:41:46 UTC
(In reply to comment #1)
> We already have 'json' packaged for Fedora. This one is needed for Cucumber
> update. 

So 's/json_pure/json/' in cucumber (0.8.5, maybe?) wouldn't be enough?

Comment 3 Michal Fojtik 2010-07-22 16:57:01 UTC
I think this could be also possible solution, but it would not be bad to have a 'pure' version packaged.
Also IMHO it will be much more cleaner to have 'original' dependency for cucumber than modifying cucumber spec file.
Cucumber and other projects uses this because it's a "little bit" faster that original one.

Comment 4 Mamoru TASAKA 2010-07-23 17:24:40 UTC
Well, the problem is that
- rubygem-json already installs %{_bindir}/edit_json, %{_bindir}/prettify_json.
  So installing both rubygem-json, rubygem-json_pure may easily makes
  rpm conflict.
- if ruby -rubygems -e "require 'json'" is to be executed, we are not
  sure if we are using pure json ext/ or C module json ext/

By the way
(In reply to comment #3)
> Cucumber and other projects uses this because it's a "little bit" faster that
> original one.    
- Is it true that "pure" implementation is faster than C extension?

For spec file:
- For Fedora, BuildRoot tag is no longer needed (only needed for EPEL5)
- If the license is "the same as Ruby", the license tag should be
  "GPLv2 or Ruby".
- edit_json ahd prettify_json have the dependency for ruby(gtk2),
  so this package should have "Requires: ruby(gtk2)".
  For this issue, see the discussion on bug 589801
- "install.rb" "ext/" files or directories are not needed
  * ext/ directory is for generating C extension modules. For
    pure implementation, this directory should not be used.
    By the way:
(In reply to comment #1)
> Binary objects under tests directory are removed (%check), because they
> are only needed for test as an generators. 
    - I think Rakefile should be patched so that "$ rake check" also uses
      pure "generator" (lib/json/pure/generator.rb) instead of
      C extension generator.so (i.e so that ext/ directory is not
      needed even for rake check, if this gem is for pure implementation,
      and we want to check pure implementation on test)

- "benchmarks/" "tools/" "data/" "tests/" directories does not seem
  to be needed by default and it seems they are just documents,
  examples or so.
  Please mark these as %doc, or instead moving these directories
  (and ri document files) to -doc subpackage is preferred.
- defined %ruby_sitelib macro seems used nowhere.
- The directory %{geminstdir} is not owned by any packages.

Comment 5 Michal Fojtik 2010-08-02 08:20:20 UTC
(In reply to comment #4)
> Well, the problem is that
> - rubygem-json already installs %{_bindir}/edit_json, %{_bindir}/prettify_json.
>   So installing both rubygem-json, rubygem-json_pure may easily makes
>   rpm conflict.
> - if ruby -rubygems -e "require 'json'" is to be executed, we are not
>   sure if we are using pure json ext/ or C module json ext/

Ah ok, I see. There might be solution in prefixing these two binaries with '_pure'. But I'm not sure if there will not be another conflicts.
So I'll try updating cucumber with just 'json' and we will see.

> 
> By the way
> (In reply to comment #3)
> > Cucumber and other projects uses this because it's a "little bit" faster that
> > original one.    
> - Is it true that "pure" implementation is faster than C extension?

According to [1], 'pure' parser seems to be faster:

[snip]
#   1 ParserBenchmarkExt#parser   900 repeats:
#         553.922304770 (  real) ->   21.500x 
#           0.001805307
#   3 ParserBenchmarkPure#parser  1000 repeats:
#          26.755020642 (  real) ->    1.038x 
#           0.037376163
[/snip]

(but I'm not sure if my undestanding of these benchmarks is right.

> For spec file:
> - For Fedora, BuildRoot tag is no longer needed (only needed for EPEL5)

Fixed.

> - If the license is "the same as Ruby", the license tag should be
>   "GPLv2 or Ruby".

Fixed.

> - edit_json ahd prettify_json have the dependency for ruby(gtk2),
>   so this package should have "Requires: ruby(gtk2)".
>   For this issue, see the discussion on bug 589801

Fixed.

> - "install.rb" "ext/" files or directories are not needed
>   * ext/ directory is for generating C extension modules. For
>     pure implementation, this directory should not be used.

Removed.

>     By the way:
> (In reply to comment #1)
> > Binary objects under tests directory are removed (%check), because they
> > are only needed for test as an generators. 
>     - I think Rakefile should be patched so that "$ rake check" also uses
>       pure "generator" (lib/json/pure/generator.rb) instead of
>       C extension generator.so (i.e so that ext/ directory is not
>       needed even for rake check, if this gem is for pure implementation,
>       and we want to check pure implementation on test)

Fixed. Rakefile already contains 'rake test_pure' which will use 'pure' generator.

> - "benchmarks/" "tools/" "data/" "tests/" directories does not seem
>   to be needed by default and it seems they are just documents,
>   examples or so.
>   Please mark these as %doc, or instead moving these directories
>   (and ri document files) to -doc subpackage is preferred.

Fixed. (Moved to -docs subpackage)

> - defined %ruby_sitelib macro seems used nowhere.

Fixed.

> - The directory %{geminstdir} is not owned by any packages.    

Fixed.

rev -2:

Spec URL: http://mifo.sk/RPMS/rubygem-json_pure.spec
SRPM URL: http://mifo.sk/RPMS/rubygem-json_pure-1.4.3-2.fc13.src.rpm

Comment 6 Mamoru TASAKA 2010-08-02 15:24:57 UTC
For -2:

* BuildRoot
  - So I still see that you put BuildRoot tag in your spec file.
    Are you going to import this package also for EPEL?
    - Note that currently ruby-gtk2 is not available on EPEL.

* BuildRequires
  - Would you check if "BR: ruby-"devel"" is needed?

* Removing files in %check
  - Modifying or removing files should not be done in %check
    (%check section is for checking).
    Please move the line
-----------------------------------------------------------------
rm -rf %{buildroot}/%{geminstdir}/ext
-----------------------------------------------------------------
    to %install.

* Document files
-----------------------------------------------------------------
%{gemdir}/cache/%{gemname}-%{version}.gem
%{gemdir}/specifications/%{gemname}-%{version}.gemspec
-----------------------------------------------------------------
  - These are not documents and please move these two to
    main package.

  - License texts or so should be included in main package.
    Please move below to main package.
----------------------------------------------------------------
%doc %{geminstdir}/README
%doc %{geminstdir}/GPL
%doc %{geminstdir}/COPYING
%doc %{geminstdir}/CHANGES
%doc %{geminstdir}/VERSION
%doc %{geminstdir}/TODO
----------------------------------------------------------------

  - On the other hand, I think "%{geminstdir}/install.rb" can be
    moved into -doc subpackage.

  - Now rpmlint warns:
----------------------------------------------------------------
rubygem-json_pure-doc.noarch: W: doc-file-dependency /usr/lib/ruby/gems/1.8/gems/json_pure-1.4.3/benchmarks/generator_benchmark.rb /usr/bin/env
rubygem-json_pure-doc.noarch: W: doc-file-dependency /usr/lib/ruby/gems/1.8/gems/json_pure-1.4.3/tests/test_json_encoding.rb /usr/bin/env
rubygem-json_pure-doc.noarch: W: doc-file-dependency /usr/lib/ruby/gems/1.8/gems/json_pure-1.4.3/tools/server.rb /usr/bin/env
rubygem-json_pure-doc.noarch: W: doc-file-dependency /usr/lib/ruby/gems/1.8/gems/json_pure-1.4.3/benchmarks/parser_benchmark.rb /usr/bin/env
rubygem-json_pure-doc.noarch: W: doc-file-dependency /usr/lib/ruby/gems/1.8/gems/json_pure-1.4.3/tests/test_json_fixtures.rb /usr/bin/env
rubygem-json_pure-doc.noarch: W: doc-file-dependency /usr/lib/ruby/gems/1.8/gems/json_pure-1.4.3/tests/test_json_rails.rb /usr/bin/env
----------------------------------------------------------------
    These warnings can be removed by either
    - Removing %doc from %files entry in -doc subpackage
      (I don't think that explicitly writing %doc attribute in -doc
      subpackage is needed, because the name of the rpm already
      shows that the rpm is for documentation)
    - Or removing shebangs and removing executable permission.

* Directory ownership issue
  - "%dir %{geminstdir}" in -doc subpackage is unneeded because main
    package already owns this directory (and -doc depends on main
    package).

Comment 7 Mamoru TASAKA 2010-08-02 18:00:09 UTC
By the way I see occasional failure on %check.
Would you check why this is happening?

http://koji.fedoraproject.org/koji/taskinfo?taskID=2373744

Comment 8 Michal Fojtik 2010-08-05 15:31:32 UTC
(In reply to comment #7)
> By the way I see occasional failure on %check.
> Would you check why this is happening?
> 
> http://koji.fedoraproject.org/koji/taskinfo?taskID=2373744    

Upstream contacted for this failure.

Comment 9 Mamoru TASAKA 2010-09-04 16:22:51 UTC
Would you update this bug?

Comment 10 Michael Stahnke 2010-09-13 22:49:57 UTC
I would love to see this packaged, as certain package seem to really want json_pure rather than just json.

Comment 11 Michael Stahnke 2010-09-15 16:12:17 UTC
I think we need json_pure for EPEL5, as JSON doesn't work perfectly with ruby 1.8.6 in EPEL5.  

stahnma@x2 /home/stahnma> ldd -r /usr/lib64/ruby/site_ruby/1.8/x86_64-linux/json/ext/parser.so
        libruby.so.1.8 => /usr/lib64/libruby.so.1.8 (0x00002abe78915000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00002abe78c10000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00002abe78e2b000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00002abe79030000)
        libm.so.6 => /lib64/libm.so.6 (0x00002abe79268000)
        libc.so.6 => /lib64/libc.so.6 (0x00002abe794eb000)
        /lib64/ld-linux-x86-64.so.2 (0x0000003cbb000000)
undefined symbol: RSTRING_PTR   (/usr/lib64/ruby/site_ruby/1.8/x86_64-linux/json/ext/parser.so)
undefined symbol: RSTRING_LEN   (/usr/lib64/ruby/site_ruby/1.8/x86_64-linux/json/ext/parser.so)

Without these libraries, rubyforge becomes non-usable.  (that's after me trying to patch rubyforge to use json rather than json_pure).  

rubyforge is of course needed by hoe, which is needed by lots of things.

Comment 12 Mamoru TASAKA 2010-09-15 17:07:35 UTC
(In reply to comment #11)
> I think we need json_pure for EPEL5, as JSON doesn't work perfectly with ruby
> 1.8.6 in EPEL5.

- I guess 1.8.5, not 1.8.6.

> stahnma@x2 /home/stahnma> ldd -r
> /usr/lib64/ruby/site_ruby/1.8/x86_64-linux/json/ext/parser.so
>         libruby.so.1.8 => /usr/lib64/libruby.so.1.8 (0x00002abe78915000)
>         libpthread.so.0 => /lib64/libpthread.so.0 (0x00002abe78c10000)
>         libdl.so.2 => /lib64/libdl.so.2 (0x00002abe78e2b000)
>         libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00002abe79030000)
>         libm.so.6 => /lib64/libm.so.6 (0x00002abe79268000)
>         libc.so.6 => /lib64/libc.so.6 (0x00002abe794eb000)
>         /lib64/ld-linux-x86-64.so.2 (0x0000003cbb000000)
> undefined symbol: RSTRING_PTR  
> (/usr/lib64/ruby/site_ruby/1.8/x86_64-linux/json/ext/parser.so)
> undefined symbol: RSTRING_LEN  
> (/usr/lib64/ruby/site_ruby/1.8/x86_64-linux/json/ext/parser.so)

- I don't know if json (json_pure) upstream wants to support 1.8.5
  any longer, however you can fix this issue on json side.
  See what json-1.4.3/ext/json/ext/generator/generator.h does (for
  RSTRING_PTR and so on definition)

Comment 13 Mamoru TASAKA 2010-09-22 17:21:44 UTC
ping again?

Comment 14 Michal Fojtik 2010-09-23 08:27:25 UTC
(In reply to comment #13)
> ping again?

Sorry for delay, I had something important to do. I updated package to match upstream version and fixed bug mentioned by Mamoru. Updated specfile and SRPM:

Spec URL: http://mifo.sk/RPMS/rubygem-json_pure.spec
SRPM URL: http://mifo.sk/RPMS/rubygem-json_pure-1.4.6-1.fc13.src.rpm

Comment 15 Mamoru TASAKA 2010-09-24 17:25:11 UTC
Well,

- I saw one test fails for 3 times. One example:
  http://koji.fedoraproject.org/koji/taskinfo?taskID=2484993

  For now please patch this test out.

- The following line will make no effect.
---------------------------------------------------------------
rm -rf %{buildroot}%{gemdir}/doc/json_pure-1.4.3/rdoc/classes/.html
---------------------------------------------------------------

Comment 16 Michal Fojtik 2010-10-02 16:24:36 UTC
I removed that line, but unfortunately build log expired. I did a build for this version (without patching test) and seems like it works:

http://koji.fedoraproject.org/koji/taskinfo?taskID=2508205

Spec URL: http://mifo.sk/RPMS/rubygem-json_pure.spec
SRPM URL: http://mifo.sk/RPMS/rubygem-json_pure-1.4.6-2.fc13.src.rpm

Comment 19 Mamoru TASAKA 2010-10-04 20:01:27 UTC
---------------------------------------------------------------
    This package (rubygem-json_pure) is APPROVED by mtasaka
---------------------------------------------------------------

Comment 20 Michal Fojtik 2010-10-06 08:40:50 UTC
New Package SCM Request
=======================
Package Name:      rubygem-json_pure
Short Description: JSON implementation in pure Ruby
Owners:            mfojtik
Branches:          f12 f13 f14

Comment 21 Kevin Fenzi 2010-10-06 23:22:52 UTC
Git done (by process-git-requests).

Comment 22 Fedora Update System 2010-10-07 13:21:55 UTC
rubygem-json_pure-1.4.6-3.fc12 has been submitted as an update for Fedora 12.
https://admin.fedoraproject.org/updates/rubygem-json_pure-1.4.6-3.fc12

Comment 23 Fedora Update System 2010-10-07 13:23:58 UTC
rubygem-json_pure-1.4.6-3.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/rubygem-json_pure-1.4.6-3.fc14

Comment 24 Fedora Update System 2010-10-07 13:28:32 UTC
rubygem-json_pure-1.4.6-3.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/rubygem-json_pure-1.4.6-3.fc13

Comment 25 Fedora Update System 2010-10-07 19:53:16 UTC
rubygem-json_pure-1.4.6-3.fc14 has been pushed to the Fedora 14 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update rubygem-json_pure'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/rubygem-json_pure-1.4.6-3.fc14

Comment 26 Fedora Update System 2010-10-19 07:00:31 UTC
rubygem-json_pure-1.4.6-3.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 27 Fedora Update System 2010-10-19 07:16:04 UTC
rubygem-json_pure-1.4.6-3.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 28 Michael Stahnke 2010-10-19 22:19:10 UTC
Would you like to branch for EPEL?  If not, I can maintain there.

Comment 29 Fedora Update System 2010-10-28 06:19:26 UTC
rubygem-json_pure-1.4.6-3.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 30 Michael Stahnke 2010-10-28 14:51:15 UTC
Michal, do you have desire to maintain this package for epel?  If not, I'd be happy to do it.

Comment 31 Troy Dawson 2014-07-18 21:24:29 UTC
Package Change Request
======================
Package Name: rubygem-json_pure
New Branches: epel7
Owners: tdawson

Comment 32 Gwyn Ciesla 2014-07-21 12:40:26 UTC
Git done (by process-git-requests).


Note You need to log in before you can comment on or make changes to this bug.