Yogesh Devi
Yogesh Devi

Reputation: 689

How to specify range for minor version in Debian package control file "Depends:" "Pre-Depends" clause

This is regarding debian control file for ubuntu package.

I need to specify dependency list in "Depends:" / "Pre-Depends" clause with packages as illustrated below

My package is "foo" . it depends on package "bar" . Allowed versions of "bar" are 2.X.Y where X=3 and and Y>=5 (lets call 2 as major, X as Minor version, and Y as sub minor version)

So basically I want to specify that I am okay with minor version 3 and sub minor versions ranging from 5 to 9

To give examples

# my specs should allow below versions
bar-2.3.5, bar-2.3.6, ... , bar-2.3.9

# my specs should disallow below versions
bar 2.2.X, bar 2.3.4, bar 2.4.X, bar 3.X.Y,

so the question is - In my control file is below the right way to specify?

# Control file 
Package: foo 
Depends: bar (>=2.3.5), bar(<<2.4.0)

Is there a more compact/ appropriate way?

Especially if I make a simplifying requirement change - and say I am ok with minor version .5 and any sub minor versions ( 2.5.X - ) then is there a way to match any among ( 2.5.0, ..., to 2.5.9) with a single == like expression ?

I looked at https://www.debian.org/doc/debian-policy/ch-relationships.html but that does not provide me enough direction

Thanks for your help

Upvotes: 2

Views: 1418

Answers (2)

Compholio
Compholio

Reputation: 1012

To specify range of allowed versions in a Debian package control file, use a combination of a Depends and a Conflicts directive:

Package: foo
Version: X.X.X
... 
Depends: bar (>= 2.3.5)
Conflicts: bar (<< 2.4.0)

This is equivalent to:

Depends: bar (>= 2.3.5), bar (<< 2.4.0)

but will only list bar once when you run apt-cache depends foo.

Upvotes: 0

Yogesh Devi
Yogesh Devi

Reputation: 689

I verified that this way of specification does work

Package: foo
Version: X.X.X
... 
Depends: bar (>=2.3.5),  bar (<<2.4.0)

However the undesirable side effect of this is that the dependency "bar" appears twice if I examine dependencies of "foo" using "apt cache depends"

And just for fun. If you understand hindi you may say the dependency appears bar bar :-)

  #apt-cache depends foo
  PreDepends: bar
  PreDepends: bar

So while I have a working soultion, I am still looking for a more elegant way More answers welcome (so my answer isn't accepted)

Upvotes: 1

Related Questions