Linux Standard Base Core Specification 3.0Preview1 | ||
---|---|---|
<<< Previous | Next >>> |
Applications shall either be packaged in the RPM packaging format as defined in this specification, or supply an installer which is LSB conforming (for example, calls LSB commands and utilities). [1]
Distributions shall provide a mechanism for installing applications in this packaging format with some restrictions listed below. [2]
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 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]; } ; |
magic
Value identifying this file as an RPM format file. This value shall be "\355\253\356\333".
major
Value indicating the major version number of the file format version. This value shall be 3.
minor
Value indicating the minor revision number of file format version. This value shall be 0.
type
Value indicating whether this is a source or binary package. This value shall be 0 to indicate a binary package.
archnum
Value indicating the architecture for which this package is valid. This value is specified in the architecture-specific LSB specification.
name
A NUL terminated string that provides the package name. This name shall conform with the Package Naming section of this specification.
osnum
Value indicating the Operating System for which this package is valid. This value shall be 1.
signature_type
Value indicating the type of the signature used in the Signature part of the file. This value shall be 5.
reserved
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 shall be aligned to an 8 byte boundary.
struct rpmheader { unsigned char magic[4]; unsigned char reserved[4]; int nindex; int hsize; } ; |
magic
Value identifying this record as an RPM header record. This value shall be "\216\255\350\001".
reserved
Reserved space. This value shall be "\000\000\000\000".
nindex
The number of Index Records that follow this Header Record. There should be at least 1 Index Record.
hsize
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; } ; |
tag
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.
type
Value identifying the type of the data associated with this Index Record. The
possible type
values are defined below.
offset
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.
count
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 1-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
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 1-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 shall 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 shall be present.
This Index Record may be present.
This Index Record may be present, but does not contribute to the processing of the package.
This Index Record should not be present.
This Index Record shall not be present.
This Index Record shall not be present.
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 1-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 1-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 1-7. Signature Signing Tag Values
Name | Tag Value | Type | Count | Status |
---|---|---|---|---|
SIGTAG_PGP | 1002 | BIN | 1 | Optional |
SIGTAG_GPG | 1005 | BIN | 65 | 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 shall 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 shall 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 1-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_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 |
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.
A string containing the name of the distribution on which the package was built.
A string containing the name of the organization that produced the package.
This tag specifies the license which applies to this package.
This tag specifies the administrative group to which this package belongs.
URL for what??
This tag specifies the OS of the package. The OS value pointed to by this index record shall 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.
URL of the distribution?
This tag specifies the format of the Archive section. The format value pointed to by this index record shall be 'cpio'.
This tag specifies the compression used on the Archive section. The compression value pointed to by this index record shall be 'gzip'
This 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 1-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 |
This tag specifies the preinstall scriptlet. If present, then RPMTAG_PREINPROG shall also be present.
This tag specifies the postinstall scriptlet. If present, then RPMTAG_POSTINPROG shall also be present.
his tag specifies the preuninstall scriptlet. If present, then RPMTAG_PREUNPROG shall also be present.
This tag specified the postuninstall scriptlet. If present, then RPMTAG_POSTUNPROG shall also be present.
This tag specifies the name of the intepreter to which the preinstall scriptlet will be passed. The intepreter pointed to by this index record shall be '/bin/sh'.
This tag specifies the name of the intepreter to which the postinstall scriptlet will be passed. The intepreter pointed to by this index record shall be '/bin/sh'.
This tag specifies the name of the intepreter to which the preuninstall scriptlet will be passed. The intepreter pointed to by this index record shall be '/bin/sh'.
This program specifies the name of the intepreter to which the postuninstall scriptlet will be passed. The intepreter pointed to by this index record shall be '/bin/sh'.
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 1-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 shall contain a trailing '/'.
One of RPMTAG_OLDFILENAMES or the tuple RPMTAG_DIRINDEXES,RPMTAG_BASENAMES,RPMTAG_DIRNAMES shall be present, but not both.
The following tag values are used to provide information about interdependencies between packages.
Table 1-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 | STRING_ARRAY | 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 1-12. 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 document, and the architecture specific documents.
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 1-14. 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 |
This tag specifies the time as seconds since the epoch at which the package was built.
This tag specifies the hostname of the system 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.
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 1-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 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]; }; |
c_magic
Value identifying this cpio format. This value shall be "070701".
c_ino
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 shall match the corresponding value in the
RPMTAG_FILEINODES
index in the Header section.
c_mode
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 shall match the corresponding value in the
RPMTAG_FILEMODES
index in the Header section.
c_uid
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.
c_gid
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.
c_nlink
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.
c_mtime
Value identifying the modification time of the file when it was read.
This field shall match the corresponding value in the
RPMTAG_FILEMTIMES
index in the Header section.
c_filesize
Value identifying the size of the file.
This field shall match the corresponding value in the
RPMTAG_FILESIZES
index in the Header section.
c_devmajor
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 shall match the corresponding value in the
RPMTAG_FILEDEVICES
index in the Header section.
c_devminor
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 shall match the corresponding value in the
RPMTAG_FILEDEVICES
index in the Header section.
c_rdevmajor
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 shall match the corresponding value in the
RPMTAG_RDEVS
index in the Header section.
c_rdevminor
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 shall match the corresponding value in the
RPMTAG_RDEVS
index in the Header section.
c_namesize
Value identifying the length of the filename, which is located immediately following the CPIO Header structure.
c_checksum
Value containing the CRC checksum of the file data. This field is not used, and shall 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] | Supplying an RPM format package is encouraged because it makes systems easier to manage. A future version of the LSB may require RPM, or specify a way for an installer to update a package database. Applications are also encouraged to uninstall cleanly. |
[2] | 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. |
<<< Previous | Home | Next >>> |
Package Format and Installation | Up | Package Script Restrictions |