[Rubygems-developers] [Patch] temporary buildroot support for gem install

Jim Weirich jim at weirichhouse.org
Wed Jun 28 09:34:31 EDT 2006

Marcus Rueckert wrote:
> For building rpms i wanted to avoid building as root. That makes it
> impossible to use the normal prefixes for the gems. For normal C
> programs you have the "make install DESTDIR=%{buildroot}" to provide a
> temporary installation root. Python has a
> "python setup.py install --root %{buildroot}" for the same purpose.
> The attached adds a --build-root parameter to achieve the same.
> With a downloaded gem file you can do:
> gem install --build-root %{buildroot} /path/to/some.gem

How is this different from doing:

   gem install --install-dir %{buildroot} /path/to/some.gem

For example, on my mac:

   $ gem install rake --install-dir ~/mygems
   Successfully installed rake-0.7.1
   Installing ri documentation for rake-0.7.1...
   Installing RDoc documentation for rake-0.7.1...

This installed rake into the ~/mygems directory without any root access 
at all.

> I already build 49 rpms from gem with that patch. :)
> Known bugs:
> "gem install --build-root $PWD/inst -r somegem" fails with
> [[[
> ERROR:  While executing gem ... (Errno::EACCES)
> Permission denied - /usr/lib/ruby/gems/1.8/cache/sparklines-0.2.7.gem
> ]]]
> Do you consider that bug important?

The current 0.8.xx release of RubyGems incorrectly attempts to install 
program/script wrappers into the system bin directory, even when the 
install directory is the non-system one.  The 0.9.0 release fixes that 
error (I plan to release 0.9.0 today sometime).

-- Jim Weirich

More information about the Rubygems-developers mailing list