Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RPM Spec - How to Allow Multiple Versions

Take the kernel rpm for example, it allows multiple versions to be installed concurrently on a system. What exactly in the spec file permits that?

I want to package a project that already exists as multiple versions with distinct installation prefixes.

like image 288
Vanista Avatar asked Jan 08 '16 17:01

Vanista


People also ask

How do I install multiple RPM packages?

To install multiple Vector instances on one machine using RPM, you need a unique set of package names for each instance. You must rebuild each RPM packages to include an instance ID that is unique to the machine. You can then install this package using the instructions described in Install Vector Using RPM Commands.

What is spec file in RPM?

What is a SPEC File? A SPEC file can be thought of as the "recipe" that the rpmbuild utility uses to actually build an RPM. It tells the build system what to do by defining instructions in a series of sections. The sections are defined in the Preamble and the Body.


2 Answers

YUM

Found the way to have yum install instead of update. There's a configuration directive to do so. From man 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.

Tested and confirm it replicates the behavior with kernel. When updating or installing, yum will not update (remove) the old package.

Note that the package name in the list must be exact, it doesn't consider wildcards. So there a way to do it, and likely automate the process in the rpm's %post script.

like image 153
Vanista Avatar answered Oct 21 '22 00:10

Vanista


What would permit it would be to ensure that none of the file/pathnames in the different versions of the package are the same. Packages which do this generally use either different directory names or different filenames (such as appending the version number to one or the other).

I gave a more elaborate answer in How to install two different versions of same rpm and make them work parallely

like image 3
Thomas Dickey Avatar answered Oct 21 '22 00:10

Thomas Dickey