如何使用一个依赖项的不同版本来构建和部署程序包?
例如,我维护一个使用libmemcached的应用程序.我可以使用libmemcached5或libmemcached6对其进行编译,还可以构建指向libmemcached5,libmemcached6甚至libmemcached5 | libmemcached6作为依赖项的.deb包,但实际上我的二进制文件仅使用其中之一进行了编译.在不升级/降级用户端任何依赖项的情况下,解决此部署包问题的最佳方法是什么?
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?
如果您使用的是存储库,或者可以接受应用程序的多个编译版本,那么最好的选择是两次编译应用程序,一次使用libmemcached5进行编译,然后一次使用libmemcached6,然后使用不同的软件包名称分别打包它们,并使用虚拟软件包自动安装正确的软件包:
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
和
Package: myapplication-memchched6
Version: 1.3.17-1
Depends: libmemcached6
Provides: myapplication
Conflicts: myapplication
Replaces: myapplication
现在aptitude install myapplication
将根据需要安装的内容自动选择myapplication-memchched5
或myapplication-memchched6
.
Now aptitude install myapplication
will automatically select either myapplication-memchched5
or myapplication-memchched6
based on what else needs to be installed.