Magnus Lutz
Magnus Lutz

Reputation: 578

Can I add something like an anti-dependency to a debian package?

I have two packages of the same library but with very different APIs. Each of that library version shall have its own package, e.g. lib1.deb and lib2.deb. I dont want to rename all the libs and headers in order to make them coexistable but then some libs/headers will will have the same path /overwrite each other. In a "control" file, when f.i. generating a package with debuild, can I somehow specify a package that must not be installed at the same time my other package is installed? It would be nice that if when trying to install package2, that apt automatically wants to remove package1. I think I already saw something like that when installing packages.

Upvotes: 0

Views: 156

Answers (2)

umläute
umläute

Reputation: 31284

You should still consider making those packages co-installable (just imagine, you need to install a graphics program and apt wants to remove your entire networking stack, just because some "clever" package maintainer decided that it was much easier to put in a Conflicts than to resolve the issue).

Usually it is not that hard:

  • put all header files into library-specific subdirectories, e.g. /usr/include/lib1/ resp. /usr/include/lib2/ (any well-written library should provide a pkg-config file which needs to be updated anyhow).

  • normally, the library files are few, mostly 3 (libfoo.so.x.y, libfoo.so.x, libfoo.x). renaming them individually should be easy enough. (and again, update your pkg-config file to reflect the name-change).

Finally: "two packages of the same library but with very different APIs" sounds like a very bad idea in general. why are they the same library if they don't have the same API/ABI?

Oh, and if this is only about (incompatible) versions, this is usually handled as:

  • libfoo3 is the package of libfoo with ABI-version 3 e.g. it provides /usr/lib/libfoo.so.3.14 and /usr/lib/libfoo.so.3 which is a symlink to the former
  • libfoo7 is the package of libfoo with ABI-version 7 e.g. it provides /usr/lib/libfoo.so.7.42 and /usr/lib/libfoo.so.7 which is a symlink to the former)
    • libfoo-dev is the development package, which provides the headers and a symlink /usr/lib/libfoo.so to the correct ABI soname (/usr/lib/libfoo.so.3 resp /usr/lib/libfoo.so.7). this package has a Depends on the correct libfooX, using an exact version specifier.

You can only have a single version of libfoo-dev installed (since apt prohibits a single package be installed multiple time). However, you can have both libfoo3 and libfoo7 installed in parallel (which is important for the applications using it).

Upvotes: 2

Magnus Lutz
Magnus Lutz

Reputation: 578

Hm, found a post on stackexchange covering that https://unix.stackexchange.com/a/393243

there are "Breaks" and "Conflicts" keywords seemingly https://www.debian.org/doc/debian-policy/#conflicting-binary-packages-conflicts

Upvotes: 0

Related Questions