rubygem packaging

Vít Ondruch vondruch at redhat.com
Thu Apr 21 15:34:36 UTC 2011


Dne 20.4.2011 15:07, Parag N(पराग़) napsal(a):
> Hi all,
>       I am new to ruby package reviewing and to ruby also. I already
> got some help from vondruch on rubygem packaging but I also saw some
> problems which are not addressed in
> http://fedoraproject.org/wiki/Packaging:Ruby#Ruby_Gems
>
> 1) I think we need some sample rubygem spec file (which can also
> include -doc subpackage)

I have tried to upgrade gem2rpm a bit. So if you will use my fork [1], 
the -doc subpackage should be generated by default. Also I have 
extracted the templates out of the code, so they are a bit more readable 
now [2]. May be I should request merge to upstream, but originally I 
planed to spend more time with it :)

> 2) I see most of rubygem packages also create -doc, but I can't find
> which files should go this subpackage. I see most gem archive contains
> files like README, LICENSE, Rakefile, CHANGES and directories like
> tests, examples. I think it should be written on packaging page about
> which package should own these files.

This follows general packaging guidelines. The rule is that the base 
package should contain only essential files for execution, the rest 
should go into -doc. This includes Rakefile, testsuite, etc.

> 3) packaging page says %files should look like
> %{gemdir}/gems/%{gemname}-%{version}/
> %{gemdir}/cache/%{gemname}-%{version}.gem
> %{gemdir}/specifications/%{gemname}-%{version}.gemspec
>
> but most of latest submitted/accepted packages have
> %dir %{geminstdir}
> %{geminstdir}

This is triggered by creation of the -doc subpackage. Once you decide to 
have -doc subpackage, then you can't include the whole %{geminstdir}, 
but you have to choose what to goes into what package.

I would like to see the -doc package as a requirement, since the 
documentation is typically several times bigger then the gem itself. 
Also I am not sure about others, but I usually prefer to use web 
documentation (rdoc.info).

> 4) I don't understand reason behind marking doc files as %doc whereas
> I see they are not actually installed under /usr/share/doc. What I
> come to know only is that one can search for documentation files using
> RPM

There are 2 cases from my POV:

1) You assume that the -doc subpackage contains only documentation, 
therefore marking the files as %doc is not required.
2) In you case, the -doc subpackage can contain also test suite for 
example. In this case, the $ rpm -qd package-doc will show the real 
documentation files without the test suite.

I would like to follow the 2nd approach, but the opinions may differ.

> 5) gem install command is used with --rdoc in spec in latest submissions.

I would like to see --rdoc to be prohibited. It was always default and I 
don't believe it will change in near future.

> 6) If its good practice to have %check in rubygem specs then we should
> have it mentioned in packaging page.
>

The packaging guidelines encourages the test suite execution [3]. 
However I would love to see the ruby guidelines extended by my comments [4].

> 7) Is there a case where rubygem package need to used %global macros
> ruby_sitelib or ruby_sitearch? If not then we can remove those %global
> lines from spec file right?

ruby_sitelib is required when package is intended to be used without 
rubygems [5]

> 8) also saw some rubygem packages in fedora which don't have BR:ruby

This is probably wrong, but it is not mentioned in guidelines. Basically 
all packages has BR: rubygems and rubygems requires ruby. But it is not 
as specific as the runtime requirement Requires: ruby(abi) = 1.8

This should be clarified.

> 9) another thing can be added to packaging page that for few rubygem
> packages rpmlint is not silent with warning for generated doc as  W:
> unexpanded-macro and this can be ignored.

Or may be rpmlint could be updated?


There is also more issues to cover, such as installation of gem with 
--bindir flag instead of some magic, the gems should be always installed 
in %prep section, etc.


Vit

> Thanks&  Regards,
> Parag.
> _______________________________________________
> ruby-sig mailing list
> ruby-sig at lists.fedoraproject.org
> https://admin.fedoraproject.org/mailman/listinfo/ruby-sig
[1] https://github.com/voxik/gem2rpm/
[2] https://github.com/voxik/gem2rpm/blob/master/templates/fedora.spec.erb
[3] http://fedoraproject.org/wiki/Packaging:Guidelines#Test_Suites
[4] http://fedoraproject.org/wiki/Packaging_talk:Ruby#Testsuite_execution
[5] 
http://fedoraproject.org/wiki/Packaging:Ruby#Packaging_for_Gem_and_non-Gem_use


More information about the ruby-sig mailing list