RPM 规范 - 如何允许多个版本

RPM Spec - How to Allow Multiple Versions

以内核rpm为例,它允许在一个系统上同时安装多个版本。规范文件中究竟有什么允许这样做?

我想将一个已经存在的项目打包为具有不同安装前缀的多个版本。

允许的是确保包的不同版本中 file/pathnames 的 none 是相同的。执行此操作的包通常使用不同的目录名或不同的文件名(例如将版本号附加到一个或另一个)。

我在How to install two different versions of same rpm and make them work parallely

中给出了更详尽的答案

YUM

找到让 yum 安装而不是更新的方法。有一个配置指令可以这样做。来自男人 yum.conf:

installonlypkgs

List of package provides that should only ever be installed, never updated. Kernels in particular fall into this category. Defaults to kernel, kernel-bigmem, kernel-enterprise, kernel-smp, kernel-debug, kernel-unsupported, kernel-source, kernel-devel, kernel-PAE, kernel-PAE-debug.

Note that because these are provides, and not just package names, kernel-devel will also apply to kernel-debug-devel, etc.

Note that "kernel-modules" is not in this list, in RHEL-6, and so anything providing that is updated like any other package.

installonly_limit

Number of packages listed in installonlypkgs to keep installed at the same time. Setting to 0 disables this feature. Default is '3'. Note that this functionality used to be in the "installonlyn" plugin, where this option was altered via tokeep. Note that as of version 3.2.24, yum will now look in the yumdb for a installonly attribute on installed packages. If that attribute is "keep", then they will never be removed.

测试并确认它复制了内核的行为。更新或安装时,yum 不会更新(删除)旧包。

注意列表中的包名必须准确,不考虑通配符。所以有一种方法可以做到这一点,并且可能会在 rpm 的 %post 脚本中自动执行该过程。