Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This question is aimed at PPA/packages maintainers.

I have a PPA with 2 packages:

  • mypackage (currently version 1~ppa1~quantal)
  • mypackagelib (currently version 1~ppa1~quantal)

Currently, the control file of mypackage has:

Depends: mypackagelib

I want to update the 2 packages to version '2' (mypackage version 2 and mypackagelib version 2).

How can I make sure that the 2 packages will be updated when the user updates 'mypackage' ?

FYI, changing the 'Depends' field to:

Depends: mypackagelib (>= 2)

does NOT work, and returns the following error:

mypackage : Depends: mypackagelib (>= 2) but mypackagelib-2~ppa1~quantal is to be installed
share|improve this question
    
What's the version you set on mypackagelib? I think it needs to be mypackagelib_2 and not -2. –  mfisch Dec 16 '12 at 21:15
    
mfisch, thanks for looking at this. Please see comments below under Gilles's answer. –  LovinBuntu Dec 16 '12 at 23:18
add comment

1 Answer

up vote 2 down vote accepted

Your version numbers are inconsistent. The order relation on version numbers is pretty complex. It is described in the Debian policy manual. In particular:

First the initial part of each string consisting entirely of non-digit characters is determined. These two parts (one of which may be empty) are compared lexically. If a difference is found it is returned. The lexical comparison is a comparison of ASCII values modified so that all the letters sort earlier than all the non-letters and so that a tilde sorts before anything, even the end of a part. For example, the following parts are in sorted order from earliest to latest: ~~, ~~a, ~, the empty part, a.

In particular, 3.196~ppa1~quantal is considered older than 3.196. The typical use case for ~ is beta versions: 1.42~beta3 comes before 1.42. You can check your understanding of Debian package version numbers by running dpkg --compare-versions:

$ dpkg --compare-versions '3.196~ppa1~quantal' '>=' '3.196'; echo $?
1

0 means that the order relation is met, 1 means that it isn't.

There is some incomplete advice on version numbers in the PPA packaging help. Since your package is not in Ubuntu, you don't need a ~ suffix; you should use a version number like 3.196ppa1. The source dependency can be (>= 3.196) if any release of 3.196 will do, or something like (>= 3.196ppa5) if you need at least a certain package release.

If you keep the ~ in here, you must put it in the source dependency too: (>= 3.196~ppa1~quantal). To say “at least the same version as the main package”, write

Depends: mypackagelib (>= ${binary:Version})

Another possibility (thanks to tumbleweed is to declare a dependency on 3.196~ (the number and a tilde and nothing more), which is an older version than 3.196~anything.


(This doesn't apply to you, but it might apply to future visitors. What follows applies when libmypackage contains a shared library (.so).)

The naming convention for libraries is libmypackage1 and libmypackage2, by the way. If you started with mypackagelib-1, you should leave that, but switch to libmypackage2 for the next version.

The two library packages mypackagelib-1 and mypackagelib-2 might coexist if there are programs still using the old library and programs using the new library installed at the same time. Unless the administrator has explicitly requested the installation of the library package (which he'd only do if he has a non-packaged program requiring the library, e.g. in /usr/local), the old library package will be marked as automatically installed, so it will be uninstalled automatically when there are no dependencies on it.

For more information on how to package a library, read the Debian Library Packaging guide. Although Debian's policies are not mandatory for an Ubuntu PPA, it's a good idea to follow them: they illustrate best practice for working with Debian packaging tools.

share|improve this answer
    
Thanks Gilles, but this is not what i expected. I may have expressed myself the wrong way, i will improve my question to avoid confusion. When i wrote 'mypackagelib - 1', it stands for 'mypackagelib in version 1(~ppaXX)'. There is no package named 'mypackagelib-1' (nor 'mypackagelib-2'), only 'mypackagelib'. The package name does not change when upgrading version. –  LovinBuntu Dec 16 '12 at 22:40
1  
@LovinBuntu If the library package is still called mypackagelib, then Depends: mypackagelib (>= 2) is correct. You shouldn't do that for a package that contains a .so, as explained in the library packaging guide, so if your library is indeed a .so, you should switch to the libmypackage2 naming. Since that's not working, there's still something that your obscuring of the name is hiding. Could you post the real package names and the unedited control file and error messages? –  Gilles Dec 16 '12 at 22:57
    
ok. The real name of mypackage is boot-repair. The real name of mypackagelib is boot-sav. The real current version is not 1~ppa1 but 3.197~ppa1. The real new version is not 2~ppa1 but 3.198~ppa1. The current packages can be found at launchpad.net/~yannubuntu/+archive/boot-repair/+packages , you will find the control in it. As you can see, there is no .so. And I confirm that (the equivalent of) Depends: mypackagelib (>= 2) does not work. Thanks for your time and help. –  LovinBuntu Dec 16 '12 at 23:09
    
@LovinBuntu I wonder if this is related to the ~quantal suffix. What exactly is the Depends: line in the control file (I only see 3.197 online), and the error message when trying to install? You may be interested in dpkg --compare-versions to check that your understanding of version numbers matches dpkg's. –  Gilles Dec 16 '12 at 23:33
1  
More practically, it's common to say (>= 2~), when depending on a native package. This isn't a problem with non-native packages (packages with a - in the version) –  tumbleweed Dec 18 '12 at 13:29
show 4 more comments

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.