[Rubygems-developers] r1841 --destdir behaviour

Luis Lavena luislavena at gmail.com
Tue Aug 19 18:42:04 EDT 2008

On Mon, Aug 18, 2008 at 10:21 PM, Richard Brown <rbrown at exherbo.org> wrote:
> Hi, I wrote the initial patch for --destdir support, and I have a
> couple of issues with r1841, I did email Luis and say I would have a
> look at the end of last month, but I've been a little tied up, sorry.

Glad to have you back :-D

> It uses RbConfig::TOPDIR, which on my x86_64 machine is nil, because
> of the way mkconfig generates TOPDIR. (It has a hardcoded 'lib' in it,
> my ruby is installed to 'lib64'. It looks like using
> RbConfig:CONFIG['prefix'] would be a better choice.

Since there was no documentation on the expected results I just came
up with something that I was able to understand.
For the me idea was that --destdir will generate the same tree
hierarchy used by ruby and it's components, but having as parent
folder a different one.



will prepend /foo/bar to the /lib/ruby/gems/1.8 and related folder structure...

I think was a wrong assumption.

> This patch has also changed the behaviour of --destdir, and I'm not
> sure if this is intentional or not. My intent in adding --destdir was
> to replicate the functionality of
> make DESTDIR="/image" install
> So setup.rb --destdir="/foo" would install to
> "/foo/usr/lib64/ruby/site_ruby/1.8" with this revision it would now be
> installed to "/foo/lib64/ruby/site_ruby/1.8", which is incorrect.

The thing with that is /usr is not part of the ruby installation
structure, but the underliying OS/distro installation structure. /usr
has no meaning on Windows (XP, x64):

ruby 1.8.6 (2008-03-03 patchlevel 114) [i386-mingw32]

irb(main):002:0> RbConfig::TOPDIR
=> "C:/Program Files (x86)/Ruby18"

irb(main):003:0> RbConfig::CONFIG['prefix']
=> "C:/Program Files (x86)/Ruby18"

And this my rbconfig TOPDIR definition:

  TOPDIR = File.dirname(__FILE__).chomp!("/lib/ruby/1.8/i386-mingw32")


This is my output in Ubuntu:

ruby 1.8.6 (2008-03-03 patchlevel 114) [i686-linux]

irb(main):002:0> RbConfig::TOPDIR
=> "/usr"
irb(main):003:0> RbConfig::CONFIG['prefix']
=> "/usr"

Since you're comparing destdir to prefix, when you supply the prefix
you need to specify also "usr" part of the path, that is not part of
Ruby or guessed somehow, right?

Or I'm missing something?

> Regards,

Regards and thank you for taking a look at this.

Luis Lavena
Human beings, who are almost unique in having the ability to learn from
the experience of others, are also remarkable for their apparent
disinclination to do so.
Douglas Adams

More information about the Rubygems-developers mailing list