Applications should be provided in the RPM packaging format as defined in this specification.
Distributions must provide a mechanism for installing applications in this packaging format with some restrictions listed below. [1]
An RPM format file consists of 4 sections, the Lead, Signature, Header, and the Payload. All values are stored in network byte order.
These 4 sections must exist in the order specified.
The lead section is used to identify the package file.
The signature section is used to verify the integrity, and optionally, the authenticity of the majority of the package file.
The header section contains all available information about the package. Entries such as the package's name, version, and file list, are contained in the header.
The payload section holds the files to be install.
struct rpmlead { unsigned char magic[4]; unsigned char major, minor; short type; short archnum; char name[66]; short osnum; short signature_type; char reserved[16]; } ; |
Value identifying this file as an RPM format file. This value must be "\355\253\356\333".
Value indicating the major version number of the file format version. This value must be 3.
Value indicating the minor revision number of file format version. This value must be 0.
Value indicating whether this is a source or binary package. This value must be 0 to indicate a binary package.
Value indicating the architecture for which this package is valid. This value is specified in the architecture-specific LSB specification.
A NUL terminated string that provides the package name. This name must conform with the Package Naming section of this specification.
Value indicating the Operating System for which this package is valid. This value must be 1.
Value indicating the type of the signature used in the Signature part of the file. This value must be 5.
Reserved space. The value is undefined.
The Header structure is used for both the Signature and Header Sections. A Header Structure consists of 3 parts, a Header record, followed by 1 or more Index records, followed by 0 or more bytes of data associated with the Index records. A Header structure must be aligned to an 8 byte boundary.
struct rpmheader { unsigned char magic[4]; unsigned char reserved[4]; int nindex; int hsize; } ; |
Value identifying this record as an RPM header record. This value must be "\216\255\350\001".
Reserved space. This value must be "\000\000\000\000".
The number of Index Records that follow this Header Record. There should be at least 1 Index Record.
The size in bytes of the storage area for the data pointed to by the Index Records.
struct rpmhdrindex { int tag; int type; int offset; int count; } ; |
Value identifying the purpose of the data associated with this Index Record. This value of this field is dependent on the context in which the Index Record is used, and is defined below and in later sections.
Value identifying the type of the data associated with this Index Record. The possible type values are defined below.
Location in the Store of the data associated with this Index Record. This value should between 0 and the value contained in the hsize of the Header Structure.
Size of the data associated with this Index Record. The count is the number of elements whose size is defined by the type of this Record.
The possible values for the type field are defined in this table.
Table 16-3. Index Type values
Type | Value | Size (in bytes) | Alignment |
---|---|---|---|
RPM_NULL_TYPE | 0 | Not Implemented. | |
RPM_CHAR_TYPE | 1 | 1 | 1 |
RPM_INT8_TYPE | 2 | 1 | 1 |
RPM_INT16_TYPE | 3 | 2 | 2 |
RPM_INT32_TYPE | 4 | 4 | 4 |
RPM_INT64_TYPE | 5 | Reserved. | |
RPM_STRING_TYPE | 6 | variable, NUL terminated | 1 |
RPM_BIN_TYPE | 7 | 1 | 1 |
RPM_STRING_ARRAY_TYPE | 8 | Variable, sequence of NUL terminated strings | 1 |
RPM_I18NSTRING_TYPE | 9 | variable, sequence of NUL terminated strings | 1 |
The string arrays specified for enties of type RPM_STRING_ARRAY_TYPE and RPM_I18NSTRING_TYPE are vectors of strings in a contiguous block of memory, each element separated from its neighbors by a NUL character.
Index records with type RPM_I18NSTRING_TYPE must always have a count of 1. The array entries in an index of type RPM_I18NSTRING_TYPE correspond to the locale names contained in the HDRTAG_HDRI18NTABLE index.
Some values are designated as header private, and may appear in any header structure. These are defined here. Additional values are defined in later sections.
Table 16-4. Header Private Tag Values
Name | Tag Value | Type | Count | Status |
---|---|---|---|---|
RPMTAG_HEADERSIGNATURES | 62 | BIN | 16 | Optional |
RPMTAG_HEADERIMMUTABLE | 63 | BIN | 16 | Optional |
RPMTAG_HEADERI18NTABLE | 100 | STRING_ARRAY | Required |
The signature tag differentiates a signature header from a metadata header, and identifies the original contents of the signature header.
This tag contains an index record which specifies the portion of the Header Record which was used for the calculation of a signature. This data must be preserved or any header-only signature will be invalidated.
Contains a list of locales for which strings are provided in other parts of the package.
Not all Index records defined here will be present in all packages. Each tag value has a status which is defined here.
This Index Record must be present.
This Index Record may be present.
This Index Record should not be present.
This Index Record must not be present.
This Index Record must not be present.
The Signature section is implemented using the Header structure. The signature section defines the following additional tag values which may be used in the Index structures.
These values exist to provide additional information about the rest of the package.
Table 16-5. Signature Tag Values
Name | Tag Value | Type | Count | Status |
---|---|---|---|---|
SIGTAG_SIGSIZE | 1000 | INT32 | 1 | Required |
SIGTAG_PAYLOADSIZE | 1007 | INT32 | 1 | Optional |
This tag specifies the combined size of the Header and Payload sections.
This tag specifies the uncompressed size of the Payload archive, including the cpio headers.
These values exist to ensure the integrity of the rest of the package.
Table 16-6. Signature Digest Tag Values
Name | Tag Value | Type | Count | Status |
---|---|---|---|---|
SIGTAG_MD5 | 1004 | BIN | 16 | Required |
SIGTAG_SHA1HEADER | 1010 | STRING | 1 | Optional |
This tag specifies the 128-bit MD5 checksum of the combined Header and Archive sections.
This index contains the SHA1 checksum of the entire Header Section, including the Header Record, Index Records and Header store.
These values exist to provide authentication of the package.
Table 16-7. Signature Signing Tag Values
Name | Tag Value | Type | Count | Status |
---|---|---|---|---|
SIGTAG_PGP | 1002 | BIN | 1 | Optional |
SIGTAG_GPG | 1005 | BIN | 1 | Optional |
SIGTAG_DSAHEADER | 1011 | BIN | 1 | Optional |
SIGTAG_RSAHEADER | 1012 | BIN | 1 | Optional |
This tag specifies the RSA signature of the combined Header and Payload sections. The data is formatted as a Version 3 Signature Packet as specified in RFC 2440: OpenPGP Message Format.
The tag contains the DSA signature of the combined Header and Payload sections. The data is formatted as a Version 3 Signature Packet as specified in RFC 2440: OpenPGP Message Format.
The tag contains the DSA signature of the Header section. The data is formatted as a Version 3 Signature Packet as specified in RFC 2440: OpenPGP Message Format. If this tag is present,then the SIGTAG_GPG tag must also be present.
The tag contains the RSA signature of the Header section.The data is formatted as a Version 3 Signature Packet as specified in RFC 2440: OpenPGP Message Format. If this tag is present, then the SIGTAG_PGP must also be present.
The Header section is implemented using the Header structure. The Header section defines the following additional tag values which may be used in the Index structures.
The following tag values are used to indicate information that describes the package as a whole.
Table 16-8. Package Info Tag Values
Name | Tag Value | Type | Count | Status |
---|---|---|---|---|
RPMTAG_NAME | 1000 | STRING | 1 | Required |
RPMTAG_VERSION | 1001 | STRING | 1 | Required |
RPMTAG_RELEASE | 1002 | STRING | 1 | Required |
RPMTAG_SUMMARY | 1004 | I18NSTRING | 1 | Required |
RPMTAG_DESCRIPTION | 1005 | I18NSTRING | 1 | Required |
RPMTAG_SIZE | 1009 | INT32 | 1 | Required |
RPMTAG_LICENSE | 1014 | STRING | 1 | Required |
RPMTAG_GROUP | 1016 | I18NSTRING | 1 | Required |
RPMTAG_OS | 1021 | STRING | 1 | Required |
RPMTAG_ARCH | 1022 | STRING | 1 | Required |
RPMTAG_SOURCERPM | 1044 | STRING | 1 | Optional |
RPMTAG_ARCHIVESIZE | 1046 | INT32 | 1 | Optional |
RPMTAG_RPMVERSION | 1064 | STRING | 1 | Optional |
RPMTAG_COOKIE | 1094 | STRING | 1 | Optional |
RPMTAG_PAYLOADFORMAT | 1124 | STRING | 1 | Required |
RPMTAG_PAYLOADCOMPRESSOR | 1125 | STRING | 1 | Required |
RPMTAG_PAYLOADFLAGS | 1126 | STRING | 1 | Required |
This tag specifies the name of the package.
This tag specifies the version of the package.
This tag specifies the release of the package.
This tag specifies the summary description of the package. The summary value pointed to by this index record contains a one line description of the package.
This tag specifies the description of the package. The description value pointed to by this index record contains a full desription of the package.
This tag specifies the sum of the sizes of the regular files in the archive.
This tag specifies the license which applies to this package.
This tag specifies the administrative group to which this package belongs.
This tag specifies the OS of the package. The OS value pointed to by this index record must be "linux".
This tag specifies the architecture of the package. The architecture value pointed to by this index record is defined in architecture specific LSB specification.
This tag specifies the name of the source RPM
This tag specifies the uncompressed size of the Payload archive, including the cpio headers.
This tag indicates the version of RPM tool used to build this package. The value is unused.
This tag contains an opaque string whose contents are undefined.
This tag specifies the format of the Archive section. The format value pointed to by this index record must be 'cpio'.
This tag specifies the compression used on the Archive section. The compression value pointed to by this index record must be 'gzip'
This tag indicates the compression level used for the Payload. This value must always be '9'.
The following tag values are used to provide information needed during the installation of the package.
Table 16-9. Installation Tag Values
Name | Tag Value | Type | Count | Status |
---|---|---|---|---|
RPMTAG_PREINPROG | 1085 | STRING | 1 | Optional |
RPMTAG_POSTINPROG | 1086 | STRING | 1 | Optional |
RPMTAG_PREUNPROG | 1087 | STRING | 1 | Optional |
RPMTAG_POSTUNPROG | 1088 | STRING | 1 | Optional |
This tag specifies the name of the intepreter to which the preinstall scriptlet will be passed.
This tag specifies the name of the intepreter to which the postinstall scriptlet will be passed.
This tag specifies the name of the intepreter to which the preuninstall scriptlet will be passed.
This program specifies the name of the intepreter to which the postuninstall scriptlet will be passed
The following tag values are used to provide information about the files in the payload. This information is provided in the header to allow more efficient access of the information.
Table 16-10. File Info Tag Values
Name | Tag Value | Type | Count | Status |
---|---|---|---|---|
RPMTAG_OLDFILENAMES | 1027 | STRING_ARRAY | Optional | |
RPMTAG_FILESIZES | 1028 | INT32 | Required | |
RPMTAG_FILEMODES | 1030 | INT16 | Required | |
RPMTAG_FILERDEVS | 1033 | INT16 | Required | |
RPMTAG_FILEMTIMES | 1034 | INT32 | Required | |
RPMTAG_FILEMD5S | 1035 | STRING_ARRAY | Required | |
RPMTAG_FILELINKTOS | 1036 | STRING_ARRAY | Required | |
RPMTAG_FILEFLAGS | 1037 | INT32 | Required | |
RPMTAG_FILEUSERNAME | 1039 | STRING_ARRAY | Required | |
RPMTAG_FILEGROUPNAME | 1040 | STRING_ARRAY | Required | |
RPMTAG_FILEDEVICES | 1095 | INT32 | Required | |
RPMTAG_FILEINODES | 1096 | INT32 | Required | |
RPMTAG_FILELANGS | 1097 | STRING_ARRAY | Required | |
RPMTAG_DIRINDEXES | 1116 | INT32 | Optional | |
RPMTAG_BASENAMES | 1117 | STRING_ARRAY | Optional | |
RPMTAG_DIRNAMES | 1118 | STRING_ARRAY | Optional |
This tag specifies the filenames when not in a compressed format as determined by the absense of rpmlib(CompressedFileNames) in the RPMTAG_REQUIRENAME index.
This tag specifies the size of each file in the archive.
This tag specifies the mode of each file in the archive.
This tag specifies the device number from which the file was copied.
This tag specifies the modification time in seconds since the epoch of each file in the archive.
This tag specifies the ASCII representation of the MD5 sum of the corresponding file contents. This value is empty if the corresponding archive entry is not a regular file.
The target for a symlink, otherwise NULL.
This tag specifies the bit(s) to classify and control how files are to be installed.
This tag specifies the owner of the corresponding file.
This tag specifies the of the corresponding file.
This tag specifies the 16 bit device number from which the file was copied.
This tag specifies the inode value from the original file on the build host.
This tag specifies a per-file locale marker used to install only locale specific subsets of files when the package is installed.
This tag specifies the index into the array provided by the RPMTAG_DIRNAMES Index which contains the directory name for the corresponding filename.
This tag specifies the base portion of the corresponding filename.
This tag specifies the directory portion of the corresponding filename. Each directory name must contain a trailing '/'.
One of RPMTAG_OLDFILENAMES or the tuple RPMTAG_DIRINDEXES,RPMTAG_BASENAMES,RPMTAG_DIRNAMES must be present, but not both.
The following tag values are used to provide information about interdependencies between packages.
Table 16-11. Package Dependency Tag Values
Name | Tag Value | Type | Count | Status |
---|---|---|---|---|
RPMTAG_PROVIDENAME | 1047 | STRING_ARRAY | 1 | Required |
RPMTAG_REQUIREFLAGS | 1048 | INT32 | Required | |
RPMTAG_REQUIRENAME | 1049 | STRING_ARRAY | Required | |
RPMTAG_REQUIREVERSION | 1050 | STRING_ARRAY | Required | |
RPMTAG_CONFLICTFLAGS | 1053 | INT32 | Optional | |
RPMTAG_CONFLICTNAME | 1054 | STRING_ARRAY | Optional | |
RPMTAG_CONFLICTVERSION | 1055 | STRING_ARRAY | Optional | |
RPMTAG_OBSOLETENAME | 1090 | STRING_ARRAY | Optional | |
RPMTAG_PROVIDEFLAGS | 1112 | INT32 | Required | |
RPMTAG_PROVIDEVERSION | 1113 | STRING_ARRAY | Required | |
RPMTAG_OBSOLETEFLAGS | 1114 | INT32 | 1 | Optional |
RPMTAG_OBSOLETEVERSION | 1115 | INT32 | 1 | Optional |
This tag indicates the name of the dependency provided by this package.
Bits(s) to specify the dependency range and context.
This tag indicates the dependencies for this package.
This tag indicates the versions associated with the values found in the RPMTAG_REQUIRENAME Index.
Bits(s) to specify the conflict range and context.
This tag indicates the conflictind dependencies for this package.
This tag indicates the versions associated with the values found in the RPMTAG_CONFLICTNAME Index.
This tag indicates the obsoleted dependencies for this package.
Bits(s) to specify the conflict range and context.
This tag indicates the versions associated with the values found in the RPMTAG_PROVIDENAME Index.
Bits(s) to specify the conflict range and context.
This tag indicates the versions associated with the values found in the RPMTAG_OBSOLETENAME Index.
The package dependencies are stored in the RPMTAG_REQUIRENAME and RPMTAG_REQUIREVERSION index records. The following values may be used.
Table 16-12. Index Type values
Name | Version | Meaning | Status |
---|---|---|---|
lsb | 1.3 | Indicates this is an LSB conforming package. | Required |
rpmlib(VersionedDependencies) | 3.0.3-1 | Indicates That the package contains PMTAG_PROVIDENAME, RPMTAG_OBSOLETENAME or RPMTAG_PREREQ records that have a version associated with them. | Optional |
rpmlib(PayloadFilesHavePrefix) | 4.0-1 | Indicates the filenames in the Archive have had "." prepended to them. | Optional |
rpmlib(CompressedFileNames) | 3.0.4-1 | Indicates that the filenames in the Payload are represented in the RPMTAG_DIRINDEXES, RPMTAG_DIRNAME and RPMTAG_BASENAMES indexes. | Optional |
/bin/sh | Interpreter usually required for installation scripts. | Optional |
The following tag values are also found in the Header section.
Table 16-14. Other Tag Values
Name | Tag Value | Type | Count | Status |
---|---|---|---|---|
RPMTAG_BUILDTIME | 1006 | INT32 | 1 | Optional |
RPMTAG_BUILDHOST | 1007 | STRING | 1 | Optional |
RPMTAG_FILEVERIFYFLAGS | 1045 | INT32 | Optional | |
RPMTAG_CHANGELOGTIME | 1080 | INT32 | Optional | |
RPMTAG_CHANGELOGNAME | 1081 | STRING_ARRAY | Optional | |
RPMTAG_CHANGELOGTEXT | 1082 | STRING_ARRAY | Optional | |
RPMTAG_OPTFLAGS | 1122 | STRING | 1 | Optional |
RPMTAG_RHNPLATFORM | 1131 | STRING | 1 | Deprecated |
RPMTAG_PLATFORM | 1132 | STRING | 1 | Optional |
This tag specifies the time as seconds since the epoch at which the package was built.
This tag specifies the on which which the package was built.
This tag specifies the bit(s) to control how files are to be verified after install, specifying which checks should be performed.
This tag specifies the Unix time in seconds since the epoch associated with each entry in the Changelog file.
This tag specifies the name of who made a change to this package
This tag specifies the changes asssociated with a changelog entry.
This tag indicates additional flags which may have been passed to the compiler when building this package.
This tag contains an opaque string whose contents are undefined.
This tag contains an opaque string whose contents are undefined.
The Payload section contains a compressed cpio archive. The format of this section is defined by RFC 1952: GZIP file format specification version 4.3.
When uncompressed, the cpio archive contains a sequence of records for each file. Each record contains a CPIO Header, Filename, Padding, and File Data.
Table 16-15. CPIO File Format
CPIO Header | Header structure as defined below. |
Filename | NUL terminated ASCII string containing the name of the file. |
Padding | 0-3 bytes as needed to align the file stream to a 4 byte boundary. |
File data | The contents of the file. |
Padding | 0-3 bytes as needed to align the file stream to a 4 byte boundary. |
The CPIO Header uses the following header structure (sometimes referred to as "new ASCII" or "SVR4 cpio"). All numbers are stored as ASCII representations of their hexadecimal value with leading zeros as needed to fill the field. With the exception of c_namesize and the corresponding name string, and c_checksum, all information contained in the CPIO Header is also represented in the Header Section. The values in in the CPIO Header must match the values contained in the Header Section.
struct { char c_magic[6]; char c_ino[8]; char c_mode[8]; char c_uid[8]; char c_gid[8]; char c_nlink[8]; char c_mtime[8]; char c_filesize[8]; char c_devmajor[8]; char c_devminor[8]; char c_rdevmajor[8]; char c_rdevminor[8]; char c_namesize[8]; char c_checksum[8]; }; |
Value identifying this cpio format. This value must be "070701".
This field contains the inode number from the filesystem from which the file was read. This field is ignored when installing a package. This field must match the corresponding value in the RPMTAG_FILEINODES index in the Header section.
Permission bits of the file. This is an ascii representation of the hexadecimal number representing the bit as defined for the st_mode field of the stat structure defined for the stat function. This field must match the corresponding value in the RPMTAG_FILEMODES index in the Header section.
Value identifying this owner of this file. This value matches the uid value of the corresponding user in the RPMTAG_FILEUSERNAME as found on the system where this package was built. The username specified in RPMTAG_FILEUSERNAME should take precedence when installing the package.
Value identifying this group of this file. This value matches the gid value of the corresponding user in the RPMTAG_FILEGROUPNAME as found on the system where this package was built. The groupname specified in RPMTAG_FILEGROUPNAME should take precedence when installing the package.
Value identifying the number of links associated with this file. If the value is greater than 1, then this filename will be linked to 1 or more files in this archive that has a matching value for the c_ino, c_devmajor and c_devminor fields.
Value identifying the modification time of the file when it was read. This field must match the corresponding value in the RPMTAG_FILEMTIMES index in the Header section.
Value identifying the size of the file. This field must match the corresponding value in the RPMTAG_FILESIZES index in the Header section.
The major number of the device containing the file system from which the file was read. With the exception of processing files with c_nlink >1, this field is ignored when installing a package. This field must match the corresponding value in the RPMTAG_FILEDEVICES index in the Header section.
The minor number of the device containing the file system from which the file was read. With the exception of processing files with c_nlink >1, this field is ignored when installing a package. This field must match the corresponding value in the RPMTAG_FILEDEVICES index in the Header section.
The major number of the raw device containing the file system from which the file was read. This field is ignored when installing a package. This field must match the corresponding value in the RPMTAG_RDEVS index in the Header section.
The minor number of the raw device containing the file system from which the file was read. This field is ignored when installing a package. This field must match the corresponding value in the RPMTAG_RDEVS index in the Header section.
Value identifying the length of the filename, which is located immediately following the CPIO Header structure.
Value containing the CRC checksum of the file data. This field is not used, and must contain the value "00000000". This field is ignored when installing a package.
A record with the filename "TRAILER!!!" indicates the last record in the archive.
[1] | The distribution itself may use a different packaging format for its own packages, and of course it may use any available mechanism for installing the LSB-conformant packages. |