RPM is a powerful software manager which can be used to build, install, query, verify, update, and uninstall individual software packages. An RPM package consists of an archive of files, and package information such as name, version, a description and information about dependencies on other RPM packages.
RPM Naming Scheme
Each RPM package is contained in a single file. The filename has several fields to fully identify the contents of the package. While the RPM tools themselves do not rely upon the filename itself, you should understand the filename convention to help you identify or download the proper package.
Here is an example RPM filename:
This RPM is for the BASH shell (“/bin/bash”). The filename is composed of several parts:
[name] is the name of the program or package. The [name] is usually assigned by the program’s author. In our example, the developers decided to name their product “bash” for reasons that seemed amusing to them.
[version] identifies which edition of the software this RPM contains. The [version] number is assigned by the program’s author. Using the [version] number allows one to determine which version of the author’s sources were used to generate the RPM.
[release] provides the edition number of the RPM file itself and not the version of the author’s source files. An updated RPM may be issued to supply a patched version of the author’s original software. The patch need not have come from the original developer, so the RPM [release] gets incremented instead of the [version].
[arch] describes the contents of the RPM and tells whether this file contains the product source (a “.src.rpm”), architecture-independent files (a “.noarch.rpm”), or files which may only be installed on a particular host type (a “.sh.rpm” will work only on a STRONGHOLD embedded processor).
Note: the [version] is controlled by the original author and the [release] is controlled by whomever constructed the RPM.
Understanding RPM Versions
The RPM [version] and [release] fields are not always strictly numeric and may contain other characters besides ordinary digits. It is common to see both a version “10” and a “10a” version of the same package. Sometimes picking the most recent version can be tricky. Here is how RPM itself compares version and release numbers internally:
1. Remove the [name] prefix and the “.[arch].rpm” suffix. For example, “bash-3.1-16.1.x86_64.rpm” becomes “3.1-16.1” and “bash-3.1-16.5a.1.x86_64.rpm” becomes “3.1-16.5a.1”
2. Compare the remaining strings character-by-character, left-to-right until a digit is encountered. If the characters differ, whichever character comes later in the collating sequence is the more recent RPM.
3. When a digit is encountered, convert the entire sequence of digits into a single binary number. In our example, the two characters “16” are combined into a value of sixteen (16). The resulting binary values are compared and the greater value is the more recent RPM. Thus, an RPM with a [version] of “0010” is more recent than one with a [version] of “9”.
4. Steps 2 and 3 are repeated as necessary until a difference occurs.