Bug 731279

Summary: gem2rpm spec file default template generates spec files incompatible with epel
Product: [Fedora] Fedora EPEL Reporter: Oded Arbel <oded>
Component: rubygem-gem2rpmAssignee: Vít Ondruch <vondruch>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: el6CC: mastahnke, vondruch
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-04-23 06:56:46 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Oded Arbel 2011-08-17 09:03:31 UTC
Description of problem:
gem2rpm is used to generate RPM spec files from gem files (tar balls from rubygems.org) to enable building ruby gems into RPM files.

The problem is that the default spec distributed with gem2rpm, which is what the gem2rpm command uses by default is incompatible with the rubygems setup epel uses:
1. It generates RPM files named ruby-gems-<gem-name> instead of rubygem-<gem-name>
2. It requires a ruby gems package names ruby-gems instead of rubygems
3. It requires a source file named ruby-gems-<gem-name>.spec.in that is nowhere to be found.

Version-Release number of selected component (if applicable):
0.7.1-1

How reproducible:
Always

Steps to Reproduce:
1. Download a gem file from rubygems.org to ~/rpmbuild/SOURCES
2. Run gem2rpm on it and save the output as a spec file to ~/rpmbuild/SPECS
3. Try to build the spec file using rpmbuild -ba
  
Actual results:
The build fails due to missing build requirement of ruby-gems even though rubygems is installed. If this is fixed manually then several other errors crop by.

Expected results:
The gem should be converted to RPM without errors.

Additional info:
The best approach to fix this is probably to create a new spec template for EPEL, possibly based on the Fedora template.

Comment 1 Oded Arbel 2011-08-17 09:33:49 UTC
I found that the fedora template works mostly fine to build gems, so I just copied it to epel.spec.erb and added this to distro.rb:

elsif !release_files.grep(/redhat/).empty?
        EPEL

(this also works for CentOS 6 as that also has a /etc/redhat-release file)

Comment 2 Vít Ondruch 2011-08-22 11:58:34 UTC
Hi,

As you already found, the "default.spec.erb" template is used if the distribution is not recognized, which is the case of EPEL. However, you can always use the "--template TEMPLATE" to specify your very own template without need of patching gem2rpm.

I would like to accept the change you have proposed, but I am bit reluctant, because I am not using EPEL personally and this template would need some maintainer. Would you volunteer for maintaining the EPEL template?

Other solution is to use the "fedora.spec.erb" template also for EPEL, i.e. to change [1] into form:

if !release_files.grep(/fedora|redhat/).empty?

[1] https://github.com/lutter/gem2rpm/blob/master/lib/gem2rpm/distro.rb#L8

Comment 3 Oded Arbel 2011-08-22 15:08:56 UTC
Thanks for the reply.

Initially I used the fedora template, but found that it is also missing some things (such as requiring gcc when building GEMs with native extensions).

I'm willing to maintain an EPEL specific template, or if its possible to fix the Fedora template to work for EPEL that would also work nicely - though I'm not using Fedora with GEMs, so I have no way to test how suggested changes affect Fedora.

Comment 4 Vít Ondruch 2011-08-23 05:40:34 UTC
May be the best would be if you can send a pull request on github with your proposed changes? Or show me the template you used for EPEL ...

Comment 5 Vít Ondruch 2013-04-23 06:56:46 UTC
Please open PR on GitHub if you are still interested. I'm closing this issue. Thank you.