| Linux Standard Base Core Specification 4.1 | ||
|---|---|---|
| <<< Previous | Chapter 22. Software Installation | Next >>> |
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 shall 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 installed.
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];
} ; |
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 shall be aligned to an 8 byte boundary.
struct rpmheader {
unsigned char magic[4];
unsigned char reserved[4];
int nindex;
int hsize;
} ; |
struct rpmhdrindex {
int tag;
int type;
int offset;
int count;
} ; |
The possible values for the type field are defined
in this table.
Table 22-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 entries 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 shall 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 RPMTAG_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 22-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 | Optional |
RPMTAG_HEADERSIGNATURESThe signature tag differentiates a signature header from a metadata header, and identifies the original contents of the signature header.
RPMTAG_HEADERIMMUTABLEThis tag contains an index record which specifies the portion of the Header Record which was used for the calculation of a signature. This data shall be preserved or any header-only signature will be invalidated.
RPMTAG_HEADERI18NTABLEContains 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.
The header store contains the values specified by the Index structures. These values are aligned according to their type and padding is used if needed. The store is located immediately following the Index structures.
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 22-5. Signature Tag Values
| Name | Tag Value | Type | Count | Status |
|---|---|---|---|---|
RPMSIGTAG_SIZE | 1000 | INT32 | 1 | Required |
RPMSIGTAG_PAYLOADSIZE | 1007 | INT32 | 1 | Optional |
RPMSIGTAG_SIZEThis tag specifies the combined size of the Header and Payload sections.
RPMSIGTAG_PAYLOADSIZEThis 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 22-6. Signature Digest Tag Values
| Name | Tag Value | Type | Count | Status |
|---|---|---|---|---|
RPMSIGTAG_SHA1 | 269 | STRING | 1 | Optional |
RPMSIGTAG_MD5 | 1004 | BIN | 16 | Required |
These values exist to provide authentication of the package.
Table 22-7. Signature Signing Tag Values
| Name | Tag Value | Type | Count | Status |
|---|---|---|---|---|
RPMSIGTAG_DSA | 267 | BIN | 65 | Optional |
RPMSIGTAG_RSA | 268 | BIN | 1 | Optional |
RPMSIGTAG_PGP | 1002 | BIN | 1 | Optional |
RPMSIGTAG_GPG | 1005 | BIN | 65 | Optional |
RPMSIGTAG_DSA | 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 shall also be present. | |
RPMSIGTAG_RSA | 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 shall also be present. | |
RPMSIGTAG_PGP | 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. | |
RPMSIGTAG_GPG | 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 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 22-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_DISTRIBUTION | 1010 | STRING | 1 | Informational |
RPMTAG_VENDOR | 1011 | STRING | 1 | Informational |
RPMTAG_LICENSE | 1014 | STRING | 1 | Required |
RPMTAG_PACKAGER | 1015 | STRING | 1 | Informational |
RPMTAG_GROUP | 1016 | I18NSTRING | 1 | Required |
RPMTAG_URL | 1020 | STRING | 1 | Informational |
RPMTAG_OS | 1021 | STRING | 1 | Required |
RPMTAG_ARCH | 1022 | STRING | 1 | Required |
RPMTAG_SOURCERPM | 1044 | STRING | 1 | Informational |
RPMTAG_ARCHIVESIZE | 1046 | INT32 | 1 | Optional |
RPMTAG_RPMVERSION | 1064 | STRING | 1 | Informational |
RPMTAG_COOKIE | 1094 | STRING | 1 | Optional |
RPMTAG_DISTURL | 1123 | STRING | 1 | Informational |
RPMTAG_PAYLOADFORMAT | 1124 | STRING | 1 | Required |
RPMTAG_PAYLOADCOMPRESSOR | 1125 | STRING | 1 | Required |
RPMTAG_PAYLOADFLAGS | 1126 | STRING | 1 | Required |
RPMTAG_NAMEThis tag specifies the name of the package.
RPMTAG_VERSIONThis tag specifies the version of the package.
RPMTAG_RELEASEThis tag specifies the release of the package.
RPMTAG_SUMMARYThis 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.
RPMTAG_DESCRIPTIONThis tag specifies the description of the package. The description value pointed to by this index record contains a full desription of the package.
RPMTAG_SIZEThis tag specifies the sum of the sizes of the regular files in the archive.
RPMTAG_DISTRIBUTIONA string containing the name of the distribution on which the package was built.
RPMTAG_VENDORA string containing the name of the organization that produced the package.
RPMTAG_LICENSEThis tag specifies the license which applies to this package.
RPMTAG_PACKAGERA string identifying the tool used to build the package.
RPMTAG_GROUPThis tag specifies the administrative group to which this package belongs.
RPMTAG_URLGeneric package information URL.
RPMTAG_OSThis tag specifies the OS of the package. The OS value pointed to by this index record shall be "linux".
RPMTAG_ARCHThis tag specifies the architecture of the package. The architecture value pointed to by this index record is defined in architecture specific LSB specification.
RPMTAG_SOURCERPMThis tag specifies the name of the source RPM.
RPMTAG_ARCHIVESIZEThis tag specifies the uncompressed size of the Payload archive, including the cpio headers.
RPMTAG_RPMVERSIONThis tag indicates the version of RPM tool used to build this package. The value is unused.
RPMTAG_COOKIEThis tag contains an opaque string whose contents are undefined.
RPMTAG_DISTURLURL for package.
RPMTAG_PAYLOADFORMATThis tag specifies the format of the Archive section. The format value pointed to by this index record shall be 'cpio'.
RPMTAG_PAYLOADCOMPRESSORThis tag specifies the compression used on the Archive section. The compression value pointed to by this index record shall be 'gzip'.
RPMTAG_PAYLOADFLAGSThis tag indicates the compression level used for the Payload. This value shall always be '9'.
The following tag values are used to provide information needed during the installation of the package.
Table 22-9. Installation Tag Values
| Name | Tag Value | Type | Count | Status |
|---|---|---|---|---|
RPMTAG_PREIN | 1023 | STRING | 1 | Optional |
RPMTAG_POSTIN | 1024 | STRING | 1 | Optional |
RPMTAG_PREUN | 1025 | STRING | 1 | Optional |
RPMTAG_POSTUN | 1026 | STRING | 1 | Optional |
RPMTAG_PREINPROG | 1085 | STRING | 1 | Optional |
RPMTAG_POSTINPROG | 1086 | STRING | 1 | Optional |
RPMTAG_PREUNPROG | 1087 | STRING | 1 | Optional |
RPMTAG_POSTUNPROG | 1088 | STRING | 1 | Optional |
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 22-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 |
One of RPMTAG_OLDFILENAMES or the tuple
RPMTAG_DIRINDEXES,RPMTAG_BASENAMES,RPMTAG_DIRNAMES shall be present, but not
both.
The RPMTAG_FILEFLAGS tag value shall identify
various characteristics of the file in the payload that it describes. It
shall be an
INT32 value consisting of either the
value RPMFILE_NONE (0) or the bitwise inclusive or of one
or more of the following values:
Table 22-11. File Flags
| Name | Value |
|---|---|
RPMFILE_CONFIG | (1 << 0) |
RPMFILE_DOC | (1 << 1) |
RPMFILE_DONOTUSE | (1 << 2) |
RPMFILE_MISSINGOK | (1 << 3) |
RPMFILE_NOREPLACE | (1 << 4) |
RPMFILE_SPECFILE | (1 << 5) |
RPMFILE_GHOST | (1 << 6) |
RPMFILE_LICENSE | (1 << 7) |
RPMFILE_README | (1 << 8) |
RPMFILE_EXCLUDE | (1 << 9) |
These bits have the following meaning:
The following tag values are used to provide information about interdependencies between packages.
Table 22-12. 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 | STRING_ARRAY | Optional |
RPMTAG_PROVIDENAMEThis tag indicates the name of the dependency provided by this package.
RPMTAG_REQUIREFLAGSBits(s) to specify the dependency range and context.
RPMTAG_REQUIRENAMEThis tag indicates the dependencies for this package.
RPMTAG_REQUIREVERSIONThis tag indicates the versions associated with the values found in the RPMTAG_REQUIRENAME Index.
RPMTAG_CONFLICTFLAGSBits(s) to specify the conflict range and context.
RPMTAG_CONFLICTNAMEThis tag indicates the conflicting dependencies for this package.
RPMTAG_CONFLICTVERSIONThis tag indicates the versions associated with the values found in the RPMTAG_CONFLICTNAME Index.
RPMTAG_OBSOLETENAMEThis tag indicates the obsoleted dependencies for this package.
RPMTAG_PROVIDEFLAGSBits(s) to specify the conflict range and context.
RPMTAG_PROVIDEVERSIONThis tag indicates the versions associated with the values found in the RPMTAG_PROVIDENAME Index.
RPMTAG_OBSOLETEFLAGSBits(s) to specify the conflict range and context.
RPMTAG_OBSOLETEVERSIONThis 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 22-13. Index Type values
| Name | Version | Meaning | Status |
|---|---|---|---|
| rpmlib(VersionedDependencies) | 3.0.3-1 | Indicates that the package contains RPMTAG_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 |
Additional dependencies are specified in the Package Dependencies section of this specification, and in the relevant architecture specific part of ISO/IEC 23360.
The package dependency attributes are stored in the
RPMTAG_REQUIREFLAGS,
RPMTAG_PROVIDEFLAGS and
RPMTAG_OBSOLETEFLAGS
index records. The following values may be used.
The following tag values are also found in the Header section.
Table 22-15. Other Tag Values
| Name | Tag Value | Type | Count | Status |
|---|---|---|---|---|
RPMTAG_BUILDTIME | 1006 | INT32 | 1 | Informational |
RPMTAG_BUILDHOST | 1007 | STRING | 1 | Informational |
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 | Informational |
RPMTAG_RHNPLATFORM | 1131 | STRING | 1 | Deprecated |
RPMTAG_PLATFORM | 1132 | STRING | 1 | Informational |
RPMTAG_BUILDTIMEThis tag specifies the time as seconds since the epoch at which the package was built.
RPMTAG_BUILDHOSTThis tag specifies the hostname of the system on which which the package was built.
RPMTAG_FILEVERIFYFLAGSThis tag specifies the bit(s) to control how files are to be verified after install, specifying which checks should be performed.
RPMTAG_CHANGELOGTIMEThis tag specifies the Unix time in seconds since the epoch associated with each entry in the Changelog file.
RPMTAG_CHANGELOGNAMEThis tag specifies the name of who made a change to this package.
RPMTAG_CHANGELOGTEXTThis tag specifies the changes asssociated with a changelog entry.
RPMTAG_OPTFLAGSThis tag indicates additional flags which may have been passed to the compiler when building this package.
RPMTAG_RHNPLATFORMThis tag contains an opaque string whose contents are undefined.
RPMTAG_PLATFORMThis 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.
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 22-16. 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 the CPIO Header shall 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];
}; |
A record with the filename "TRAILER!!!" indicates the last record in the archive.
| <<< Previous | Home | Next >>> |
| Software Installation | Up | Package Script Restrictions |