On 2008-01-16 13:00:31 -0700, Jeremy Hinegardner wrote:
> I'm packaging rubygems 1.0.1 up as an rpm for our internal server builds
> and I'm encountering a problem. In 0.9.4 the setup.rb was the standard
> setup.rb from Minero Aoki and to install into a fake root directory
> you would do 'ruby setup.rb install --prefix=$INSTALL_DIR' and
> everything would be installed relative to $INSTALL_DIR. That is, things
> would be installed into:
>
> $INSTALL_DIR/usr/bin
> $INSTALL_DIR/usr/lib/ruby/site_lib/1.8/
>
> Now in 1.0.1 a completely different setup.rb is used with a different
> 'install --prefix' behavoir. Without --prefix everything will install
> just fine, into a normal system, but not into a system for packaging.
> Now if I use --prefix=$INSTALL_DIR I get:
>
> $INSTALL_DIR/bin
> $INSTALL_DIR/lib
>
> This ends up installing rubygems.rb into $INSTALL_DIR/lib/rubygems.rb
> which is definitately not where it needs to go.
>
> So, my question is, what is the proper approach to tell setup.rb to
> install relative to a root directory? That is, what would be the best
> way to now package up rubygems for distribution via RPM?
>
> Is this a bug? Or is this a plan for the future? Would a patch for
> setup.rb for say --installdir be appropriate? I'll be happy to file
> this in the tracker and put together a patch if necessary.
>
> I guess in this case, for now I'll be falling back to 0.9.4 for now
> until we can resolve this issue.
i just solved that issue actually. :)
see the attached patch. my %install section looks like:
{{{
%install
GEM_HOME=%{buildroot}%{_libdir}/ruby/gems/%{rb_ver}/ \
ruby -rvendor-specific setup.rb --buildroot=%{buildroot}
}}}
i am also working on a patch to allow
"gem install --buildroot=%{buildroot} somegem"
it works already with locally available gems but fails with remote gems.
hope this helps
darix
--
openSUSE - SUSE Linux is my linux
openSUSE is good for you
www.opensuse.org
Index: setup.rb
===================================================================
--- setup.rb.orig 2007-12-21 02:15:55.000000000 +0100
+++ setup.rb 2008-01-15 21:05:23.740134386 +0100
@@ -24,6 +24,9 @@ if ARGV.include? '--help' then
puts " --prefix=DIR Prefix path for installing RubyGems"
puts " Will not affect gem repository"
puts
+ puts " --buildroot=DIR Temporary root directory for the installation (for packager)"
+ puts " Will not affect gem repository"
+ puts
puts " --format-executable Make the gem command's prefix and suffix match ruby's"
puts " If ruby is installed as ruby19, gem will be gem19"
puts
@@ -75,10 +78,31 @@ else
lib_dir = File.join prefix, 'lib'
bin_dir = File.join prefix, 'bin'
- mkdir_p lib_dir
- mkdir_p bin_dir
end
+unless ARGV.grep(/^--buildroot/).empty? then
+ prefix = nil
+
+ prefix_arg = ARGV.grep(/^--buildroot=/).first
+ if prefix_arg =~ /^--buildroot=(.*)/ then
+ prefix = $1
+ else
+ path_index = ARGV.index '--buildroot'
+ prefix = ARGV[path_index + 1]
+ end
+
+ prefix = File.expand_path prefix
+
+ raise "invalid --buildroot #{prefix.inspect}" if prefix.nil?
+
+ # we can be sure it is not nil here
+ bin_dir = File.join(prefix, bin_dir)
+ lib_dir = File.join(prefix, lib_dir)
+end
+
+mkdir_p lib_dir
+mkdir_p bin_dir
+
Dir.chdir 'lib' do
lib_files = Dir[File.join('**', '*rb')]
_______________________________________________
Rubygems-developers mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rubygems-developers