Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is it possible to set dependecy version requirements like this:

Required: somepackage >= 0.5.0 AND somepackage < 0.6.0

So only somepackage 0.5.x will be automaticly installed.

share|improve this question
add comment

2 Answers

Yes, very easy to do so.

Just write:

Requires: somepackage >= 0.5.0, somepackage < 0.6.0

into your .spec file.

Adding Version Requirements

When a package has slightly more stringent needs, it's possible to require certain versions of a package. All that's necessary is to add the desired version number, preceded by one of the following comparison operators:

  • Requires package with a version less than the specified version.

  • Requires package with a version less than or equal to the specified version.

  • Requires package with a version equal to the specified version.

  • Requires package with a version equal to or greater than the specified version.

  • Requires package with a version greater than the specified version.

Continuing with our example, let's suppose that the required version of package bar actually needs to be at least 2.7, and that the baz package must be version 2.1 — no other version will do. Here's what the requires tag line would look like: requires: bar >= 2.7, baz = 2.1

Source: http://www.rpm.org/max-rpm/s1-rpm-depend-manual-dependencies.html

share|improve this answer
add comment

It's not clear for me if you are trying to build a package or install a package and "limit" its dependencies.

I don't see a way to make the second one case without rebuild the package.

You can retrieve the SRPM and edit spec file and to add/modify entry Requires (you want somepackage 0.5.x , don't you ?) to something like this:

Requires: somepackage = 0.5.0

and then rebuild with

rpmbuild -bb -v yourpackage.spec

If you never did it, it appear intimidating but it solves your problem. Bear in mind that if are creating a public package for a distro, you may want to read its guideliness because set dependency this ways is generally not recommended.

share|improve this answer
1  
I can't really speak for the OP, but sometimes you want the most recent update in a specific version series, not just a specific version. For instance, you may know you want Apache 2.2.x because 2.4.x won't work properly with your package. Specifically requiring 2.2.23 would not allow future updates in 2.2.x be installed. –  Alan Krueger Jan 29 '13 at 17:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.