ライブラリを強制的に更新するようにdebian / controlを設定するには?


5

この質問は、 PPA /パッケージのメンテナーを対象としています。

PPAに2つのパッケージがあります:

  • mypackage(現在バージョン1〜ppa1〜quantal)
  • mypackagelib(現在バージョン1〜ppa1〜quantal)

現在、mypackageの制御ファイルは次のとおりです:

Depends: mypackagelib

2つのパッケージをバージョン「2」に更新したい(mypackageバージョン2およびmypackagelibバージョン2)。

ユーザーが「mypackage」を更新したときに2つのパッケージが確実に更新されるようにするにはどうすればよいですか?

参考までに、「Depends」フィールドを次のように変更します:

Depends: mypackagelib (>= 2)

機能せず、次のエラーを返します:

mypackage : Depends: mypackagelib (>= 2) but mypackagelib-2~ppa1~quantal is to be installed
2

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.