Specifying multiple binary package dependencies
Sam Varshavchik
mrsam at courier-mta.com
Fri Mar 18 22:15:49 UTC 2022
I am building multiple binary packages, and testing them: a main package,
and additional sub-packages that depend on the main package. For this test I
am using a main package and two additional sub-packages.
So, I built them and installed them.
I then increment the release number, and try to install only the main
package and one of the two sub-packages. I expected one of two things to
happen: either the old version of the missing additional package is going to
get uninstalled because it depends on the removed old version of the main
package, or dpkg will refuse to install anything.
To my surprise, dpkg installed the two packages and broke the third
package's dependencies.
Before, I had three packages installed, version 0.71.4-147
Then I did "sudo dpkg -i [ first two packages, version 0.71.4-148 ]"
End result:
ii libcourier-auth 0.71.4-148 amd64 Courier authenticati>
ii libcourier-auth-dev 0.71.4-148 amd64 Courier authenticati>
ii libcourier-auth-userdb 0.71.4-147 amd64 Userdb support for t>
A dpkg --status on the last one shows:
Depends: libcourier-auth (= 0.71.4-147), libc6 (>= 2.14), libcrypt1 (>= 1:4.1.0), libgdbm6 (>= 1.16)
This dependency is now broken. Am I missing something about how dependencies
are supposed to work? I tried adding a Replaces: header, based on Debian's
packaging documentation. It made no difference. After installing the first
two updated packages with "dpkg -i" I ended up with:
ii libcourier-auth 0.71.4-152 >
ii libcourier-auth-dev 0.71.4-152 >
ii libcourier-auth-userdb 0.71.4-150
(I had some additional test builds and installs done which incremented the
release numbers).
The first one's explicit dependencies, from dpkg:
Version: 0.71.4-152
Replaces: libcourier-auth-dev (<< 0.71.4-152), libcourier-auth-ldap (<<
0.71.4-152), libcourier-auth-mysql (<< 0.71.4-152), libcourier-auth-pgsql
(<< 0.71.4-152), libcourier-auth-pipe (<< 0.71.4-152), libcourier-auth-
sqlite (<< 0.71.4-152), libcourier-auth-userdb (<< 0.71.4-152)
I then tried using Conflicts instead of Replaces. I installed three -153
versions, then attempted to install two -154 versions. I did get an error,
but one of the packages got installed:
ii libcourier-auth 0.71.4-153 >
iU libcourier-auth-dev 0.71.4-154 >
iU libcourier-auth-userdb 0.71.4-153
I'm very confused. I do see this sentence in the Debian packaging guide:
"A Depends field takes effect only when a package is to be configured. It
does not prevent a package being on the system" etc…
Which explains why the packages still wind up getting extracted, even though
they break dependencies. But extracting the package overwrites the previous
version's files. To me, this seems like the cat is out of the bag.
I also tried specifying "Breaks" in addition to "Replaces", that didn't get
the desired results, producing more errors during installation and partially
installing stuff.
So: is it possible to specify package dependencies that will prevent the
packages from even be extracted unless everything is the same exact version-
release; and otherwise abort the extraction? One of the two possible results
will work for me:
A) completely prevent any attempt to install new versions if doing so will
end up with broken dependencies
B) uninstall the missing subpackage automatically, as part of upgrading the
remaining packages.
This is basically equivalent to rpm packages' "Requires" dependency. When
I'm building the equivalemt rpm packages all I need is to have each sub-
package specify:
Requires: $package = $version-$release
and that's it. depending on the packaging tool I use nothing is going to get
extracted or overwritten, or the missing subpackage gets automatically
removed. How can I do the same with deb packages?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20220318/4737b0fa/attachment.sig>
More information about the ubuntu-users
mailing list