[Fedora-packaging] New packaging guidelines for Ruby

Vít Ondruch vondruch at redhat.com
Tue Feb 28 18:23:34 UTC 2012


Dne 28.2.2012 18:36, Michal Fojtik napsal(a):
> On Feb 28, 2012, at 6:25 PM, Vít Ondruch wrote:
>
>> Dne 28.2.2012 18:05, Rex Dieter napsal(a):
>>> On 02/28/2012 10:56 AM, Vít Ondruch wrote:
>>>
>>>> All three versions provide the same output, unless I did some mistake,
>>>> since I did not tested it (actually the middle one was taken directly
>>>> from rubygem-POpen4.spec). So which version you prefer? Please note that
>>>> the "gem install" will always "unpack" the gem with some additional, for
>>>> our case unimportant, steps. We do not distribute the .gem file anywhere.
>>> You didn't exactly (directly) answer my question.  Pretend I don't know much about ruby... (not far from the truth).
>>>
>>> So, for rubygem packages that include native (C or otherwise code), how and when is this compiled?  If it is always done so during either version of these guidelines, please do accept my apologies for being ignorant.
>> It is compiled during the "gem install" step. So "gem install" is doing %prep, %build, %install in one step. So yes, it is always done for either version of guidelines.
>>
>>> However, you do say you do not distribute the .gem, though I'm curious why this seem to contradict you:
>>>
>>> rpm -qlp rubygem-POpen4-0.1.4-3.fc17.noarch.rpm
>>> /usr/share/gems/cache/POpen4-0.1.4.gem
>>> ...
>>>
>> I knew you will point it out :).
>>
>> It is cached version of the original gem, which RubyGems may use to restore the gem into its original state (and may be other unknown purposes). However, it is not used in runtime, nor it is good idea to restore the gems maintained by RPM by gem command. Moreover, even though the gem would not be available in the cache dir, RubyGems will download it. Hence we add new clause into the packaging guidelines:
> gem help commands
>
>      pristine          Restores installed gems to pristine condition from files
>                        located in the gem cache
>      unpack            Unpack an installed gem to the current directory
>
> AFAIK this is the reason gem files are kept in cache dir. I barely understand how 'pristine' command
> could be dangerous to RPM (personally I think it can be useful when you make some dirty modification
> to installed gem directly as root (trying to debug/solve some issue)).
>
> If the case is that we don't want to keep these files on filesystem, then these two commands should
> be 'patched' out from the 'gem' command or some decent warning to user should be provided.

Since the gems managed by RPM are no longer in GEM_HOME, neither the 
"gem pristine" nor "gem unpack" can touch them. If  you want to 
reinstall RPM nanaged gem, you should use something like "yum reinstall 
rubygem-foo" or alternatively "rpm -i --force rubygem-foo.rpm".

"gem pristine" and "gem unpack" will work no matter if the .gem file is 
kept in cache or not. In the rare case you need them, the .gem files 
will be downloaded from rubygems.org. That is a  beauty of cache, you 
can loose it and it will not hurt.


Vit


More information about the ruby-sig mailing list