-
Notifications
You must be signed in to change notification settings - Fork 45
Implement rich RPM dependencies #123
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
Conversation
That's #124 and I think it's much cleaner. |
This implements rich RPM dependencies, which are available with RPM 4.14+ (introduced in Fedora 27[1]). This means only a single line for a dependency is used. That doesn't play well with the .with_requires.commented_out approach that was implemented. This instead uses parameters. An alternative approach could be to move this to the template. [1]: https://fedoraproject.org/wiki/Changes/RPM-4.14
|
There is one more alternative implementation and that is to drop the versions. Or keep just the lower bound versions. But of course it depends what is the desired outcome. Any thoughts? |
|
My use case is Foreman plugin packaging, which compiles assets at build time. This means the runtime dependencies must be present during build time. Long term I'd prefer to move to dynamically generating those, but until we drop EL8 support that won't be possible. I have debated dropping the version numbers altogether as well, which will cause it to fail later in the process. But you'll still need to keep it in sync when dependencies are added/removed so for now I'd prefer to keep them proper. After trying two approaches I think #124 is IMHO the approach to go with. If you agree, we can close this. |
|
Thx for elaborating and providing more context. In addition are you using some custom template or the default one? I have provided further comments in #124, because it seems to be better starting point. |
The one that needs it right now is https://github.com/theforeman/foreman-packaging/blob/rpm/develop/gem2rpm/foreman_plugin.spec.erb |
This implements support for boolean RPM dependencies [[1]], which are
available with RPM 4.14+. This allow to use only single line for used
dependency:
~~~ruby
dep = Gem::Dependency.new('pessimistic_constraint', Gem::Requirement.new('~> 1.0'))
list = Gem2Rpm::RpmDependencyList.new([dep])
puts list.virtualize.booleanize.with_requires.to_rpm
# => Requires: (rubygem(pessimistic_constraint) >= 1.0 with rubygem(pessimistic_constraint) < 2)
~~~
[1]: https://rpm-software-management.github.io/rpm/manual/boolean_dependencies.html
Fixes fedora-ruby#123
Fixes fedora-ruby#124
This implements support for boolean RPM dependencies [[1]], which are
available with RPM 4.14+. This allow to use only single line for used
dependency:
~~~ruby
dep = Gem::Dependency.new('pessimistic_constraint', Gem::Requirement.new('~> 1.0'))
list = Gem2Rpm::RpmDependencyList.new([dep])
puts list.virtualize.booleanize.with_requires.to_rpm
# => Requires: (rubygem(pessimistic_constraint) >= 1.0 with rubygem(pessimistic_constraint) < 2)
~~~
Fixes fedora-ruby#123
Fixes fedora-ruby#124
[1]: https://rpm-software-management.github.io/rpm/manual/boolean_dependencies.html
This implements support for boolean RPM dependencies [[1]], which are
available with RPM 4.14+. This allow to use only single line per
dependency:
~~~ruby
dep = Gem::Dependency.new('pessimistic_constraint', Gem::Requirement.new('~> 1.0'))
list = Gem2Rpm::RpmDependencyList.new([dep])
puts list.virtualize.booleanize.with_requires.to_rpm
# => Requires: (rubygem(pessimistic_constraint) >= 1.0 with rubygem(pessimistic_constraint) < 2)
~~~
While previously, this was the only option:
~~~ruby
puts list.virtualize.with_requires.to_rpm
# => Requires: rubygem(pessimistic_constraint) >= 1.0
# Requires: rubygem(pessimistic_constraint) < 2
~~~
Fixes fedora-ruby#123
Fixes fedora-ruby#124
[1]: https://rpm-software-management.github.io/rpm/manual/boolean_dependencies.html
This implements support for boolean RPM dependencies [[1]], which are
available with RPM 4.14+. This allow to use only single line per
dependency:
~~~ruby
dep = Gem::Dependency.new('pessimistic_constraint', Gem::Requirement.new('~> 1.0'))
list = Gem2Rpm::RpmDependencyList.new([dep])
puts list.virtualize.booleanize.with_requires.to_rpm
# => Requires: (rubygem(pessimistic_constraint) >= 1.0 with rubygem(pessimistic_constraint) < 2)
~~~
While previously, this was the only option:
~~~ruby
puts list.virtualize.with_requires.to_rpm
# => Requires: rubygem(pessimistic_constraint) >= 1.0
# Requires: rubygem(pessimistic_constraint) < 2
~~~
Fixes fedora-ruby#123
Fixes fedora-ruby#124
[1]: https://rpm-software-management.github.io/rpm/manual/boolean_dependencies.html
This implements support for boolean RPM dependencies [[1]], which are
available with RPM 4.14+. This allow to use only single line per
dependency:
~~~ruby
dep = Gem::Dependency.new('pessimistic_constraint', Gem::Requirement.new('~> 1.0'))
list = Gem2Rpm::RpmDependencyList.new([dep])
puts list.virtualize.booleanize.with_requires.to_rpm
# => Requires: (rubygem(pessimistic_constraint) >= 1.0 with rubygem(pessimistic_constraint) < 2)
~~~
While previously, this was the only option:
~~~ruby
puts list.virtualize.with_requires.to_rpm
# => Requires: rubygem(pessimistic_constraint) >= 1.0
# Requires: rubygem(pessimistic_constraint) < 2
~~~
Fixes fedora-ruby#123
Fixes fedora-ruby#124
[1]: https://rpm-software-management.github.io/rpm/manual/boolean_dependencies.html
This implements support for boolean RPM dependencies [[1]], which are
available with RPM 4.14+. This allow to use only single line per
dependency:
~~~ruby
dep = Gem::Dependency.new('pessimistic_constraint', Gem::Requirement.new('~> 1.0'))
list = Gem2Rpm::RpmDependencyList.new([dep])
puts list.virtualize.booleanize.with_requires.to_rpm
# => Requires: (rubygem(pessimistic_constraint) >= 1.0 with rubygem(pessimistic_constraint) < 2)
~~~
While previously, this was the only option:
~~~ruby
puts list.virtualize.with_requires.to_rpm
# => Requires: rubygem(pessimistic_constraint) >= 1.0
# Requires: rubygem(pessimistic_constraint) < 2
~~~
Fixes fedora-ruby#123
Fixes fedora-ruby#124
[1]: https://rpm-software-management.github.io/rpm/manual/boolean_dependencies.html
This implements support for boolean RPM dependencies [[1]], which are
available with RPM 4.14+. This allow to use only single line per
dependency:
~~~ruby
dep = Gem::Dependency.new('pessimistic_constraint', Gem::Requirement.new('~> 1.0'))
list = Gem2Rpm::RpmDependencyList.new([dep])
puts list.virtualize.booleanize.with_requires.to_rpm
# => Requires: (rubygem(pessimistic_constraint) >= 1.0 with rubygem(pessimistic_constraint) < 2)
~~~
While previously, this was the only option:
~~~ruby
puts list.virtualize.with_requires.to_rpm
# => Requires: rubygem(pessimistic_constraint) >= 1.0
# Requires: rubygem(pessimistic_constraint) < 2
~~~
Fixes fedora-ruby#123
Fixes fedora-ruby#124
[1]: https://rpm-software-management.github.io/rpm/manual/boolean_dependencies.html
This implements rich RPM dependencies, which are available with RPM 4.14+ (introduced in Fedora 271). This means only a single line for a dependency is used. That doesn't play well with the .with_requires.commented_out approach that was implemented. This instead uses parameters.
An alternative approach could be to move this to the template. I'll submit a separate PR to demonstrate that.