CPack: 打包依赖和红帽/ SuSE 命名方案

huangapple go评论62阅读模式
英文:

CPack: Package dependencies and Red Hat / SuSE naming schemes

问题

在使用CMake / CPack构建软件包时,有CPACK_DEBIAN_PACKAGE_DEPENDSCPACK_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 .debs add the major version of libicu to the package name -- i.e., libicu60 -- whereas distros using .rpms 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...

huangapple
  • 本文由 发表于 2020年1月6日 16:06:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/59608621.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定