From Fedora Project Wiki
m (Bkabrda moved page Features/JRuby 1.7.1 to Features/JRuby 1.7: Not .1, but the latest tiny release available.)
No edit summary
Line 22: Line 22:


== Detailed Description ==
== Detailed Description ==
Transition to JRuby 1.7.1 will consist of 3 basic steps:
Transition to JRuby 1.7 will consist of 3 basic steps:
* Updating packages
* Updating packages
** Most of the packages that JRuby depends on are in Fedora just because of JRuby, so they can be safely updated.
** Most of the packages that JRuby depends on are in Fedora just because of JRuby, so they can be safely updated.
Line 29: Line 29:
** Normally, each Ruby implementations ships with its own copy of RubyGems library. This is wrong because a) it's bundling, b) there is no reason why multiple Ruby implementations wouldn't be able to share one RubyGems library. There used to be some differencies in JRuby's copy of RubyGems, but the JRuby upstream has been very cooperative and managed to get them all merged into upstream RubyGems.
** Normally, each Ruby implementations ships with its own copy of RubyGems library. This is wrong because a) it's bundling, b) there is no reason why multiple Ruby implementations wouldn't be able to share one RubyGems library. There used to be some differencies in JRuby's copy of RubyGems, but the JRuby upstream has been very cooperative and managed to get them all merged into upstream RubyGems.
** The integration will require changing Fedora's operating_system.rb (place for distro-specific defaults for RubyGems). This change will result into all Gems with binary extensions having to be recompiled, as the binary extension placement will change. See [1] for current operating_system.rb look and its changes from F18.
** The integration will require changing Fedora's operating_system.rb (place for distro-specific defaults for RubyGems). This change will result into all Gems with binary extensions having to be recompiled, as the binary extension placement will change. See [1] for current operating_system.rb look and its changes from F18.
** What should "/usr/bin/ruby" point to? During standard Gem packaging process, the executable files in Gems get shebangs according to the binary that they are packaged with (Ruby => "/usr/bin/ruby"; JRuby => "/usr/bin/jruby"). Therefore executing a Ruby "binary" runs the interpreter that was used for building (or the hardcoded one, which is usually Ruby). Using alternatives for "/usr/bin/ruby" doesn't seem to be a very good option, because alternatives are only switchable on admin level (we want every user to be able to choose the interpreter); also, Ruby and JRuby are not in fact full alternatives, as they for example cannot use same extension Gems (but it still makes sense to allow executing same binaries with them). Therefore Ruby-SIG has come up with solution of having "/usr/bin/ruby" as a bash script (currently called multiruby) [2], that allows user to choose the interpreter as first argument on invocation (_mri_ or _jruby_), if such a parameter is present. Otherwise it falls back to a default. For example invoking "ruby_binary _jruby_ --foo=bar" in fact invokes "/usr/bin/jruby ruby_binary --foo=bar". This bash script will be in a separate package and both Ruby and JRuby will depend on it.  
** What should "/usr/bin/ruby" point to? During standard Gem packaging process, the executable files in Gems get shebangs according to the binary that they are packaged with (Ruby => "/usr/bin/ruby"; JRuby => "/usr/bin/jruby"). Therefore executing a Ruby "binary" runs the interpreter that was used for building (or the hardcoded one, which is usually Ruby). Using alternatives for "/usr/bin/ruby" doesn't seem to be a very good option, because Ruby and JRuby are not in fact full alternatives, as they for example cannot use same extension Gems (but it still makes sense to allow executing same binaries with them). Also, alternatives are only switchable on admin level (we want every developer with non-root privileges to be able to choose the interpreter). Therefore Ruby-SIG has come up with solution of having "/usr/bin/ruby" as a bash script (currently called rubypick) [2], that allows user to choose the interpreter as first argument on invocation (_mri_ or _jruby_), if such a parameter is present. Otherwise it falls back to a default. For example invoking "ruby_binary _jruby_ --foo=bar" in fact invokes "/usr/bin/jruby ruby_binary --foo=bar". This bash script will be in a separate package and both Ruby and JRuby will depend on it.  
* Changes in packaging
* Changes in packaging
** None yet. JRuby will be able to use pure Ruby Gems packaged into RPM out of the box, but packaging of Gems with JRuby extensions is turning out to be very complicated, so the guidelines for it will be postponed to next release (as well as the actual packaging). Users will be still able to install Gems with JRuby extensions, both system-wide (into /usr/local/) and also into their home directories.
** None yet. JRuby will be able to use pure Ruby Gems packaged into RPM out of the box, but packaging of Gems with JRuby extensions is turning out to be very complicated, so the guidelines for it will be postponed to next release (as well as the actual packaging). Users will be still able to install Gems with JRuby extensions, both system-wide (into /usr/local/) and into their home directories.


[1] https://github.com/bkabrda/jruby.spec/blob/master/rubygems/operating_system.rb
[1] https://github.com/bkabrda/jruby.spec/blob/master/rubygems/operating_system.rb


[2] https://github.com/bkabrda/multiruby
[2] https://github.com/bkabrda/rubypick


== Benefit to Fedora ==
== Benefit to Fedora ==

Revision as of 12:25, 15 January 2013


Features/JRuby 1.7.1

Summary

JRuby is an alternative Ruby implementation with fast growing user base due to its great performance in parallel tasks. Although JRuby 1.6.7 is already in Fedora, this feature brings in new minor version and better Fedora integration.

Owner

  • Email: <bkabrda@redhat.com>

Current status

  • Targeted release: Fedora 19
  • Last updated: 2012-12-7
  • Percentage of completion: 5%


Detailed Description

Transition to JRuby 1.7 will consist of 3 basic steps:

  • Updating packages
    • Most of the packages that JRuby depends on are in Fedora just because of JRuby, so they can be safely updated.
    • Some dependencies are shared with other packages, so they will have to be discussed with their owners (see #Scope).
  • Integration with Fedora
    • Normally, each Ruby implementations ships with its own copy of RubyGems library. This is wrong because a) it's bundling, b) there is no reason why multiple Ruby implementations wouldn't be able to share one RubyGems library. There used to be some differencies in JRuby's copy of RubyGems, but the JRuby upstream has been very cooperative and managed to get them all merged into upstream RubyGems.
    • The integration will require changing Fedora's operating_system.rb (place for distro-specific defaults for RubyGems). This change will result into all Gems with binary extensions having to be recompiled, as the binary extension placement will change. See [1] for current operating_system.rb look and its changes from F18.
    • What should "/usr/bin/ruby" point to? During standard Gem packaging process, the executable files in Gems get shebangs according to the binary that they are packaged with (Ruby => "/usr/bin/ruby"; JRuby => "/usr/bin/jruby"). Therefore executing a Ruby "binary" runs the interpreter that was used for building (or the hardcoded one, which is usually Ruby). Using alternatives for "/usr/bin/ruby" doesn't seem to be a very good option, because Ruby and JRuby are not in fact full alternatives, as they for example cannot use same extension Gems (but it still makes sense to allow executing same binaries with them). Also, alternatives are only switchable on admin level (we want every developer with non-root privileges to be able to choose the interpreter). Therefore Ruby-SIG has come up with solution of having "/usr/bin/ruby" as a bash script (currently called rubypick) [2], that allows user to choose the interpreter as first argument on invocation (_mri_ or _jruby_), if such a parameter is present. Otherwise it falls back to a default. For example invoking "ruby_binary _jruby_ --foo=bar" in fact invokes "/usr/bin/jruby ruby_binary --foo=bar". This bash script will be in a separate package and both Ruby and JRuby will depend on it.
  • Changes in packaging
    • None yet. JRuby will be able to use pure Ruby Gems packaged into RPM out of the box, but packaging of Gems with JRuby extensions is turning out to be very complicated, so the guidelines for it will be postponed to next release (as well as the actual packaging). Users will be still able to install Gems with JRuby extensions, both system-wide (into /usr/local/) and into their home directories.

[1] https://github.com/bkabrda/jruby.spec/blob/master/rubygems/operating_system.rb

[2] https://github.com/bkabrda/rubypick

Benefit to Fedora

JRuby is starting to get very popular among Rubyists, mainly because of its excelent performance in tasks using concurrency (leveraging power of JVM). Because of this, JRuby is mainly used for running web (mostly Ruby on Rails) applications under great stress. Having up-to-date and sanely packaged JRuby is a must for Ruby development and deployment platform.

Scope

The changes only affect Ruby packages in Fedora. Few updated Java packages (jansi, jcodings, jline2, snakeyaml; also some jnr-* dependencies of gradle) may also affect some dependent Java packages - this will have to be discussed with their owners.

How To Test

1) There is a testing repo at http://bkabrda.fedorapeople.org/jruby/jruby.repo, which can be used to test. Do not install this on your system, due to the changes mentioned above, it would break your standard Ruby installation. This repo is meant to be tested in fedora-19-x86_64 mock chroot, where it can do no harm.

2) The repo also contains Ruby and basic set of Gems rebuilt with mentioned modifications (adoption to changes in Fedora-Ruby integration).

User Experience

JRuby will be up-to-date, usable and will be able to use Fedora's RPM-packaged pure Ruby Gems.

Dependencies

As mentioned, few Java packages, that are dependencies of some other packages, will have to be updated (see #Scope). Also, all the RubyGems packages with binary extensions will have to be rebuilt:

rubygem-atk
rubygem-bcrypt-ruby
rubygem-bson_ext
rubygem-cairo
rubygem-curb
rubygem-eventmachine
rubygem-ferret
rubygem-ffi
rubygem-gdk_pixbuf2
rubygem-gherkin
rubygem-gio2
rubygem-glib2
rubygem-goocanvas
rubygem-gstreamer
rubygem-gtk2
rubygem-gtksourceview2
rubygem-hpricot
rubygem-idn
rubygem-json
rubygem-kgio
rubygem-krb5-auth
rubygem-linecache19
rubygem-nokogiri
rubygem-pam
rubygem-pango
rubygem-passenger
rubygem-pg
rubygem-poppler
rubygem-qpid
rubygem-qpid_messaging
rubygem-raindrops
rubygem-rdiscount
rubygem-redcarpet
rubygem-RedCloth
rubygem-rsvg2
rubygem-ruby-debug-base19
rubygem-ruby-libvirt
rubygem-ruby-opengl
rubygem-sqlite3
rubygem-therubyracer
rubygem-thin
rubygem-typhoeus
rubygem-vte
rubygem-xmlparser
rubygem-zoom

Contingency Plan

Reverting to the previous behaviour will always be doable very easily, no harm will be done.

Documentation

Release Notes

Comments and Discussion