Piled RPM Remarks

Concepts

Dependencies

Most packages can not work standalone, other packages are needed for proper usage. We say, a package depends on another one or requires it. These dependencies must satisfied at installation time. For example, package foo requires bar. So foo must be installed after package bar or at least simultaneously.

Querying Packages

List Packages

rpm -qa prints the installed packages on stdout, unfortunately unsorted. Just pass the output of rpm to sort for a convenient list:
rpmuser % rpm -qa | sort | tail -n5
vrfy-961113-3
w3-3.0.86-1
wwwoffle-1.2-1
zlib-1.0.4-1
zlib-devel-1.0.4-1

Configuration

Architecture and Operating System

These configuration variables define the architecture and operating system that RPM is running on resp. is building for.

Directories

topdir
Top level directory for builddir, rpmdir , sourcedir, specdir and srcrpmdir .
builddir
Directory in which RPM will build packages.
rpmdir
Directory in which RPM will store binary packages.
sourcedir
Directory in which RPM will look for sources and patches.
specdir
Directory in which RPM will look for spec files.
defaultdocdir
Directory which RPM will use as root directory for documentation files as specified by the %doc directive. Default is /usr/doc.

Building

optflags
Standard set of options for compilation.

Building Packages

Each spec file defines parameters and instructions for building one or more RPM packages.

Dependencies

Dependencies between packages are specified with the Requires and Provides tags:
	Requires: foo
	Requires: bar = 1.2.3
Other operators for version comparison are: <, >, >= and <=.

Environment Variables

The following environment variables are set before executing any of the build scripts:
RPM_ARCH
RPM_BUILD_DIR
RPM_BUILD_ROOT
RPM_DOC_DIR
RPM_OPT_FLAGS
RPM_OS
RPM_PACKAGE_NAME
RPM_PACKAGE_RELEASE
RPM_PACKAGE_VERSION
RPM_ROOT_DIR
RPM_SOURCE_DIR
Directory in which RPM will look for sources and patches.

Build Scripts

The %prep script

Unpacks the source archives into the build directory and applies patches:
%prep
%setup
After unpacking RPM changes to the main source directory, e.g. rpm-2.5.2. The -n switch of the %setup tag allows you to explicitly specify a directory:
%prep
%setup -n cgi.tcl-0.7

The File List

The package we are building will contain all files appearing in the file list:
%files
%defattr(-,root,root)
/usr/bin/foo
/usr/lib/libfoo.a
/usr/include/foo.h

Directives

The %doc Directive
The %doc directive instructs RPM to copy the specified files into the documentation directory. The -P flag is useful to preserve the directory structure.
The %ghost Directive
The %ghost directive instructs RPM not to install the specified file(s). They will be owned by that package and removed if they exists when the package is removed. This can be useful for things like log files and state files.

Dynamically Build File Lists

With the -f option RPM can be instructed to read the file names from a file generated during package building:
%files -f MANIFEST

Other tags

Obsoletes

Declares which packages are obsoleted by this one. Older versions of the package are automatically obsoleted.

Macros and variables

RPM defines the following environment variables:
RPM_INSTALL_PREFIX
value of the Prefix: tag

Variables

builddir
Directory in which RPM will build packages.
optflags
Standard set of options for compilation.
rpmdir
Directory in which RPM will store binary packages.
sourcedir
Directory in which RPM will look for sources and patches.
specdir
Directory in which RPM will look for spec files.

The RPM Library API

Status Codes

The error status codes are defined in rpmlib.h.

Index of Files and Directories

Index of Tags, Macros, Variables and Sections

Concept Index


Written by Stefan Hornburg <racke@gundel.han.de>
Translated from rpm.tcl by Info Prism's sgml2html v0.0.6
Last modified 12 January 1999