[Rubygems-developers] problem packaging rubybgems 1.0.1, install --prefix changed?

Donavan Pantke avatar at spellboundnet.com
Wed Jan 16 22:07:29 EST 2008

On Wednesday 16 January 2008 03:20:38 pm Marcus Rueckert wrote:
> 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.

OK, I can understand wanting a buildroot-style prefix for installing RubyGems 
itself, but I don't understand the practical need for a buildroot for 
installing gems. The only difference I see with a buildroot install and 
using --install-dir is that the binaries are dropped in the bin directory of 
the install dir instead of the system bindir. Wouldn't the following be 
perfectly legit in in a spec file?

mkdir -p $RPM_BUILD_ROOT/usr/lib/ruby/site_lib/1.8/
mkdir -p $RPM_BUILD_ROOT/%{bindir}
gem install -i $RPM_BUILD_ROOT/usr/lib/ruby/site_lib/1.8/ some_gem
mv $RPM_BUILD_ROOT/usr/lib/ruby/site_lib/1.8/some_gem_bin 

This is the kind of predicatable behavior that I've been trying to accomplish 
with my previous patches. Let me know what you think.

> hope this helps
>     darix

More information about the Rubygems-developers mailing list