Skip to content

Loading…

gem pristine does not observe installer options #119

Closed
zenspider opened this Issue · 2 comments

4 participants

@zenspider

From http://rubyforge.org/tracker/index.php?func=detail&aid=28661&group_id=126&atid=577 (and possibly other places too)

In pristine_command.rb, there are the following lines:

  # TODO use installer options
  installer = Gem::Installer.new gem, :wrappers => true, :force => true
  installer.install

Obviously it was intended that this code eventually propagate installer options, but it has never been done. Unfortunately rvm's gemset support uses gem pristine --all, which on JRuby will lose the --env-shebang default we require to allow using jruby's bash-based startup script in shebang likes for installed gem executables. This led to the following bug report: http://jira.codehaus.org/browse/JRUBY-5031

After a short exploration, I could not find the proper way to propagate installer options for pristine installs, so I ended up going with the following patch. RubyGems should be fixed to propagate installer options appropriately.

diff --git a/lib/ruby/site_ruby/1.8/rubygems/commands/pristine_command.rb
b/lib/ruby/site_ruby/1.8/rubygems/commands/pristine_command.rb
index ef11129..61897cc 100644
--- a/lib/ruby/site_ruby/1.8/rubygems/commands/pristine_command.rb
+++ b/lib/ruby/site_ruby/1.8/rubygems/commands/pristine_command.rb
@@ -82,7 +82,11 @@ revert the gem.
       end

       # TODO use installer options
-      installer = Gem::Installer.new gem, :wrappers => true, :force => true
+      # Modified for JRUBY-5031, to propagate --env-shebang if set
+      installer = Gem::Installer.new gem,
+        :wrappers => true,
+        :force => true,
+        :env_shebang => !Gem::ConfigFile::PLATFORM_DEFAULTS['install'].to_s['--env-shebang'].nil?
       installer.install

       say "Restored #{spec.full_name}"
@zenspider zenspider was assigned
@krainboltgreene krainboltgreene removed this from the Future milestone
@duckinator
RubyGems member

This was made to propagate env_shebang in de8afc4 and then to propagate build_args in 488c20c — does that resolve this issue?

@copiousfreetime

@duckinator Yes de8afc4 is logically the same as @zenspider's patch. So closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.