如何使用一个依赖项的不同版本来构建和部署程序包? [英] How to build and deploy package with different versions of one dependency?

查看:210
本文介绍了如何使用一个依赖项的不同版本来构建和部署程序包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,我维护一个使用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-memchched5myapplication-memchched6.

Now aptitude install myapplication will automatically select either myapplication-memchched5 or myapplication-memchched6 based on what else needs to be installed.

这篇关于如何使用一个依赖项的不同版本来构建和部署程序包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆