问题
For example I maintain an application that uses libmemcached. I can compile it using libmemcached5 or libmemcached6, also build .deb package pointing to libmemcached5, libmemcached6 or even libmemcached5|libmemcached6 as dependency, but actually my binary is compiled with only one of them. What's the best way I can solve this trouble to deploy my package without upgrading/downgrading any dependencies on the user-side?
回答1:
If you are using a repository, or if multiple compiled versions of your app are acceptable, then your best bet is to compile your app twice, once with libmemcached5 and once with libmemcached6, and package them separately, with different package names, and use a virtual package to install the right one automatically:
Package: myapplication-memchched5
Version: 1.3.17-1
Depends: libmemcached5
Provides: myapplication
Conflicts: myapplication
Replaces: myapplication
and
Package: myapplication-memchched6
Version: 1.3.17-1
Depends: libmemcached6
Provides: myapplication
Conflicts: myapplication
Replaces: myapplication
Now aptitude install myapplication
will automatically select either myapplication-memchched5
or myapplication-memchched6
based on what else needs to be installed.
来源:https://stackoverflow.com/questions/13397372/how-to-build-and-deploy-package-with-different-versions-of-one-dependency