1 |
Hi |
2 |
|
3 |
This question popped up while discussing how to deal with Ruby gems on |
4 |
Gentoo in a way that gives the user the freedom to choose Portage, |
5 |
RubyGems or both for gem management. |
6 |
|
7 |
http://bugs.gentoo.org/show_bug.cgi?id=268857 |
8 |
|
9 |
Here's what it boils down to: |
10 |
|
11 |
If a Ruby gem ebuild is slotted, the executables it writes to /usr/bin |
12 |
are currently postfixed with a version as Portage does not yet allow a |
13 |
file to be owned by more than one slot. This is not a good solution, |
14 |
see below for details. |
15 |
|
16 |
Is it feasable to extend Portage to allow a file to be owned by |
17 |
several slots and remove it only once the last slot is uninstalled |
18 |
(aka: once the ebuild is completely uninstalled)? |
19 |
|
20 |
Here's the background: |
21 |
|
22 |
RubyGems (the gem manager) deals with dependencies and concurrent gem |
23 |
versions. It's not unusual to have the same gem installed in various |
24 |
versions as other installed gems may require different versions. |
25 |
|
26 |
If a Ruby gem contains and installs executables, then those are mere |
27 |
wrappers to a Ruby runner object. As per default, the wrapper will run |
28 |
the most up-to-date code. You can, however, tell the wrapper to run a |
29 |
specific code version (e.g. rake _0.7.3_ --version). |
30 |
|
31 |
On Gentoo, slots are used for this and therefore ebuilds for software |
32 |
written in Ruby should (and do) depend on slotted ebuilds of the gems |
33 |
they need. |
34 |
|
35 |
Unfortunately, Portage doesn't allow slots to share files at this |
36 |
point, therefore every slot has to install it's own versioned copy of |
37 |
gem supplied executables. This not only fills /usr/bin with |
38 |
unnecessary identical wrappers, but has another consequence: |
39 |
|
40 |
Every mayjor version of Ruby (currently 1.8, 1.9 and enterprise |
41 |
edition) has it's own set of installed gems and therefore Ruby itself |
42 |
is slotted and eselect-ruby does the switching. I've written a simple |
43 |
patch for eselect-ruby which assures that all gem supplied executables |
44 |
are switched correctly, no matter whether they were installed through |
45 |
Portage or RubyGems. It will, however, only work, if Portage allows |
46 |
gem executables to be shared between all slots of the gem. |
47 |
|
48 |
And here's why plan B doesn't quite cut it: |
49 |
|
50 |
Why not write a gem2ebuild tool and automatically add *all* gems from |
51 |
Rubyforge and Github as ebuilds. This is most likely a bad idea, |
52 |
because: |
53 |
|
54 |
- External dependencies (e.g. with C libs) must be maintained manually. |
55 |
- All outdated ebuilds must be kept due to gem dependencies to |
56 |
outdated versions. |
57 |
- Some useful gems are neither on Rubyforge nor Github and wouldn't be |
58 |
covered. |
59 |
|
60 |
There are currently about 7500 gems on Rubyforge and Github as of now. |
61 |
Multiplied by the number of versions, you get a shitload of ebuilds to |
62 |
host and sync. |
63 |
|
64 |
RubyGems does a very good job dealing with versions and dependencies, |
65 |
so it's IMHO a good idea not to delegate this to Portage unless |
66 |
absolutely necessary. We better find a way for Portage and RubyGems to |
67 |
work hand in hand. |
68 |
|
69 |
What do you think? |
70 |
-sven |