Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gem2rpm get's confused about version? #36

Open
cristifalcas opened this issue Feb 22, 2015 · 5 comments
Open

gem2rpm get's confused about version? #36

cristifalcas opened this issue Feb 22, 2015 · 5 comments

Comments

@cristifalcas
Copy link

Let me describe the setup: we are trying to generate rpms for gitlab-ce.

The Gemfile.lock has this definition:

sprockets (2.11.0)
    hike (~> 1.2)
    multi_json (~> 1.0)
    rack (~> 1.0)
    tilt (~> 1.1, != 1.3.0)

We are building our rpms like this:

bundle install --deployment --without development test && bundle package
find vendor/cache -name *.gem | sort | while read gem; do
    gem2rpm -t ./template $gem > $gem_spec_path
    spectool -g -R $gem_spec_path && rpmbuild -ba $gem_spec_path
done 

After the bundle commands are executed, the sprockets gem file has this deps regarding tilt:

  version_requirements: !ruby/object:Gem::Requirement
    requirements:
    - - ~>
      - !ruby/object:Gem::Version
        version: '1.1'
    - - '!='
      - !ruby/object:Gem::Version
        version: 1.3.0

Bundle will also create a gem file for tils version 1.4.1 (which should be correct with the above definition)

Gem2rpm generates the sprockets spec file with a dependency on tilt<1.3.0:

Error: Package: rubygem-sprockets-2.11.0-1.el7.noarch (gitlab)
       Requires: rubygem(tilt) < 1.3.0
       Installing: rubygem-tilt-1.4.1-1.el7.noarch (gitlab)
           rubygem(tilt) = 1.4.1
@cristifalcas
Copy link
Author

Sorry, I didn't checked the spec file before opening my mouth. The spec file is "correct", it seems:

Requires: rubygem(tilt) < 1.3.0
Requires: rubygem(tilt) > 1.3.0

Which seems ok, only that yum will obey the first rule only. I don't know if spec supports ignoring a specific version.

@voxik
Copy link
Member

voxik commented Feb 22, 2015

I remember I met this case as well. Not sure how to handle this situation better. It would be probably enough to ignore the "tilt != 1.3.0" entirely, since there is just minor chance to hit this issue in RPM world while the generated requires are not handled correctly for sure.

@cristifalcas
Copy link
Author

thank you

@cristifalcas
Copy link
Author

Sorry to reopen this, please let me know if I should open a new issue.

I asked about this on the rpm spec mailing list and they recommended to put this (I'm not sure the "<", ">" are required anymore):

Conflicts: rubygem(tilt) = 1.3.0

I built a new rpm with this and the version is detected correct now.

@cristifalcas cristifalcas reopened this Feb 23, 2015
@voxik
Copy link
Member

voxik commented Aug 5, 2022

Generally, the rubygem- .spec files should not contain any runtime dependency specifications, because these are automatically generated by the RPM generators (at least in Fedora). The generators now handle with relation which should help with the "yum will obey the first rule only" case as well as conflicts generator which should handle the exceptions such as tilt != 1.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants