英文:
CPack: Package dependencies and Red Hat / SuSE naming schemes
问题
在使用CMake / CPack构建软件包时,有CPACK_DEBIAN_PACKAGE_DEPENDS
和CPACK_RPM_PACKAGE_REQUIRES
用于保存应该依赖于生成的.deb / .rpm软件包的软件包列表。
这个区别很有帮助,因为不同的发行版使用不同的软件包命名方案。例如,使用.deb
的发行版将主要版本的libicu添加到软件包名称中,例如libicu60
,而使用.rpm
的发行版则不会。
然而,在.rpm
发行版之间也存在差异,特别是在SuSE和RedHat之间。例如,SuSE将Boost软件包命名为libboost_system1.56.0
等,而RedHat使用boost-system
。
是否有一种习惯用法来:
- 以与发行版无关的方式维护
CPACK_RPM_PACKAGE_REQUIRES
,或者 - 检测特定的发行版/软件包命名模式?
我知道一种通过“硬编码”个别软件包名称到CPACK_RPM_PACKAGE_REQUIRES
的方式来找出发行版的方法(解析uname
,检查/etc
中的文件等等),但我想知道CMake / CPack是否提供了一种更符合习惯的方法来解决这个问题。
英文:
When using CMake / CPack to build packages, there are CPACK_DEBIAN_PACKAGE_DEPENDS
and CPACK_RPM_PACKAGE_REQUIRES
to hold a list of packages the resulting .deb / .rpm should depend on.
The distinction is helpful, as package naming shemes differ between distributions. (Example: Distros using .deb
s add the major version of libicu to the package name -- i.e., libicu60
-- whereas distros using .rpm
s don't.)
However, there are differences between .rpm
-distros as well, most notably between SuSE and RedHat. For example, SuSE names Boost packages libboost_system1.56.0
etc., whereas RedHat uses boost-system
.
Is there an ideomatic way to either
- maintain
CPACK_RPM_PACKAGE_REQUIRES
in a distro-agnostic way, or - detect the particular distribution / package naming pattern?
I know ways to figure out the distribution "the hard way" (parsing uname
, checking files in /etc
and so on) and then "hardcode" the individual package names into CPACK_RPM_PACKAGE_REQUIRES
; I was wondering if CMake / CPack offered a more idiomatic way to approach the issue.
答案1
得分: 1
I was wondering if CMake / CPack offered a more idiomatic way to approach the issue.
不,它没有。(至少目前还没有)。
"硬编码" 的方式是目前唯一的方式。对于你提到的事情,我还会添加运行 lsb-release
(如果可用),解析 /etc/lsb-release
和/或其他特定于发行版的内容来自 /etc
...
英文:
> I was wondering if CMake / CPack offered a more idiomatic way to approach the issue.
No, it doesn't. (at least yet).
The "hardcode" way is the only way nowadays. To the things that you've mentioned, I'd add running lsb-release
if available, parse /etc/lsb-release
and/or other distro-specific things from /etc
...
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论