gem pristine does not observe installer options #119

Closed
zenspider opened this Issue Jun 21, 2011 · 2 comments

Comments

Projects
None yet
4 participants
@zenspider
Contributor

zenspider commented Jun 21, 2011

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}"

@ghost ghost assigned zenspider Jun 21, 2011

nobu pushed a commit to nobu/rubygems that referenced this issue Jan 12, 2014

Merge pull request #119 from cesario/patch-1
Fix typos in `String#count`'s spec.

@krainboltgreene krainboltgreene removed this from the Future milestone Jan 1, 2016

@duckinator

This comment has been minimized.

Show comment
Hide comment
@duckinator

duckinator Jan 1, 2016

Member

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

Member

duckinator commented Jan 1, 2016

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

@copiousfreetime

This comment has been minimized.

Show comment
Hide comment
@copiousfreetime

copiousfreetime Jan 18, 2016

Contributor

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

Contributor

copiousfreetime commented Jan 18, 2016

@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