Product SiteDocumentation Site

RPM

RPM Guide

An Introducing to Package Management

Logo

Eric Foster-Johnson

Stuart Ellis

Abstract

A guide to the inner workings of RPM package management and construction.
Introducing Package Management
1. Installing, Removing, and Upgrading Applications
2. Overcoming the Installation Obstacles
2.1. Application-level utilities
2.2. Built-in system utilities
3. Linux Software Management Tools: Packages
4. Summary
1. Introduction to RPM
1.1. The Need for Linux Package Management Systems
1.2. RPM Design Goals
1.2.1. Ease of use
1.2.2. Package-oriented focus
1.2.3. Package upgradability
1.2.4. Package interdependencies
1.2.5. Query capabilities
1.2.6. Package verification
1.2.7. Multiple architectures
1.2.8. Pristine sources
1.3. RPM Terminology
1.4. Summary
2. RPM Overview
2.1. Understanding the Package File
2.1.1. RPM file format
2.1.2. Binary RPMs and Source RPMs
2.1.3. Source RPMs
2.2. Querying the RPM Database
2.3. Running RPM Commands
2.3.1. Working with the rpm command
2.3.2. Other RPM commands
2.4. Summary
3. Using RPM
3.1. The rpm Command
3.2. Upgrading and Installing Software
3.2.1. Upgrading with the rpm command
3.2.2. Upgrading packages
3.2.3. Freshening up
3.2.4. Installing Packages
3.2.5. Installing Over the Internet
3.2.6. Installing source RPMs
3.3. Removing Software
3.3.1. Checking that the package has been removed
3.3.2. Removing multiple packages at a time
3.3.3. Options when removing packages
3.4. Other rpm Command Options
3.5. Summary
4. Using the RPM Database
4.1. Querying the RPM Database
4.1.1. Querying packages
4.1.2. Querying everything
4.1.3. Refining the query
4.1.4. Finding which packages own files
4.2. Getting Information on Packages
4.2.1. Describing packages
4.2.2. Package groups
4.2.3. Listing the files in a package
4.2.4. Listing the configuration files for a package
4.2.5. Listing the documentation files for a package
4.2.6. Listing the state of the files in a package
4.2.7. Listing the scripts in a package
4.2.8. Listing what has changed
4.2.9. Combining queries
4.2.10. Creating custom queries
4.2.11. Other queries
4.3. Getting Information on Package Files
4.4. Verifying Installed RPM Packages
4.4.1. Verifying your entire system
4.4.2. Controlling the verification
4.5. Working With the RPM Database
4.5.1. Backing up the RPM database
4.5.2. Rebuilding the RPM database
4.5.3. Creating a new RPM database
4.6. Summary
5. Package Dependencies
5.1. Understanding the Dependency Concept
5.1.1. Capabilities
5.1.2. Version dependencies
5.1.3. Conflicts
5.1.4. Obsoletes
5.2. Checking for Dependencies
5.2.1. Determining the capabilities a package requires
5.2.2. Determining the capabilities a package provides
5.2.3. Checking for conflicts
5.2.4. Determining which packages require a certain capability
5.2.5. Determining which package provides a certain capability
5.3. Triggers
5.4. Summary
6. Transactions
6.1. Understanding Transactions
6.1.1. When do you need transactions?
6.1.2. Backing out of transactions
6.2. Transactions with the rpm Command
6.2.1. Transaction IDs
6.2.2. Rolling Back Transactions
6.3. Saving Old Packages
6.4. Summary
7. RPM Management Software
7.1. Locating RPMs
7.1.1. rpmfind and rpm2html
7.1.2. RPM Sites On the Internet
7.2. Graphical RPM Management
7.2.1. Nautilus
7.2.2. Red Hat Package Management
7.2.3. KPackage
7.2.4. Gnome-RPM
7.3. Extending RPM Management
7.3.1. AutoRPM
7.3.2. AutoUpdate
7.3.3. The Red Hat Network and up2date
7.3.4. Current
7.3.5. urpmi and RpmDrake
7.3.6. apt-rpm
7.3.7. The poldek
7.4. Summary
8. Creating RPMs: An Overview
8.1. Preparing to Build RPMs
8.1.1. Planning what you want to build
8.1.2. Gathering the software to package
8.1.3. Creating a reproducible build of the software
8.1.4. Planning for Upgrades
8.1.5. Outlining Any Dependencies
8.2. Building RPMs
8.2.1. Setting up the directory structure
8.2.2. Placing your sources into the directory structure
8.2.3. Creating the spec file
8.2.4. Building RPMs with the rpmbuild command
8.3. Verifying Your RPMS
8.4. Summary
9. Working with Spec Files
9.1. Reading Spec Files
9.2. Writing Spec Files
9.2.1. Comments
9.2.2. Storing spec files on disk
9.3. Defining Package Information
9.3.1. Describing the package
9.3.2. Setting build locations
9.3.3. Naming source files
9.3.4. Naming patches
9.4. Controlling the Build
9.4.1. Preparing for the build
9.4.2. Building the software
9.4.3. Installing the software
9.4.4. Cleaning up after the build
9.4.5. Defining installation scripts
9.5. Filling the List of Files
9.5.1. Using wildcards
9.5.2. Naming directories of files
9.5.3. Marking files as documentation or configuration files
9.5.4. Setting file attributes
9.5.5. Verifying the %files section
9.5.6. Filling the list of files automatically
9.5.7. Handling RPM build errors for unpackaged files
9.6. Adding Change Log Entries
9.7. Defining Spec File Macros
9.7.1. Built-in macros
9.7.2. Spec file-specific macros
9.7.3. Defining new macros
9.7.4. Specifying parameters to macros
9.8. Creating XML Spec Files
9.9. Summary
10. Advanced RPM Packaging
10.1. Defining Package Dependencies
10.1.1. Naming dependencies
10.1.2. Setting prerequisites
10.1.3. Naming build dependencies
10.1.4. Generating dependencies automatically
10.2. Setting Triggers
10.3. Writing Verification Scripts
10.4. Creating Subpackages
10.4.1. Providing information for subpackages
10.4.2. Defining scripts for subpackages
10.4.3. Building subpackages
10.5. Creating Relocatable Packages
10.5.1. Setting up the prefixes
10.5.2. Define the files section
10.5.3. Problems creating relocatable packages
10.6. Defining Conditional Builds
10.6.1. Defining conditional macros
10.6.2. Using conditional blocks
10.6.3. Using architecture-based conditionals
10.7. Summary
11. Controlling the Build with rpmbuild
11.1. Building RPMs with the rpmbuild Command
11.1.1. Customizing the build
11.1.2. Testing the build
11.1.3. Debugging the build
11.1.4. Cleaning up
11.1.5. Building for other platforms
11.2. Building RPMs Without an External Spec File
11.2.1. Options for working with tar archives
11.2.2. The expected archive structure
11.3. Working with Source RPMs
11.3.1. Rebuilding binary RPMS from source RPMs
11.3.2. Recompiling binaries from source RPMs
11.3.3. SRPMS? Finding source RPMs
11.4. Signing Built RPMs
11.4.1. Checking that the GPG software is installed
11.4.2. Configuring a signature
11.4.3. Signing with the rpmbuild command
11.4.4. Signing with the rpm command
11.4.5. Verifying signatures
11.4.6. Importing public keys
11.4.7. Getting the Red Hat public key
11.5. Summary
12. Supplemental Packaging Software
12.1. Packaging Aids
12.1.1. Using VIM spec plugins to improve spec file editing
12.1.2. Adding functions with emacs rpm-spec-mode
12.1.3. Validating and debugging spec files with rpmlint
12.1.4. Generating the %files section with RUST
12.1.5. setup.sh and MakeRPM.pl
12.1.6. Manipulating Package Files with rpm2cpio
12.2. Summary
13. Packaging Guidelines
13.1. Avoiding Common Problems
13.1.1. Scan the mailing lists
13.1.2. Use rpmbuild
13.1.3. Don’t try to defeat the system
13.1.4. Turn off automatic dependency generation
13.1.5. Don't list directories in %files
13.1.6. Handling circular dependencies
13.2. Following Good Practices
13.2.1. Preparation
13.2.2. Building
13.3. Summary
14. Automating RPM with Scripts
14.1. Scripting
14.2. Distinguishing Scripting Languages from Programming Languages
14.3. Deciding When to Program and When to Script
14.4. Shell Scripting Basics
14.4.1. Writing a script
14.4.2. Running a script
14.4.3. Problems running scripts
14.4.4. Turning a script into a command
14.4.5. Passing command-line options to your script
14.5. Examining RPM Files
14.6. Querying the RPM Database
14.6.1. Querying for all packages installed at the same time
14.6.2. Reading HTML documentation for a package
14.7. Where to Go From Here
14.8. Summary
15. Programming RPM with C
15.1. Programming with the C Library
15.1.1. Setting Up a C Programming Environment
15.1.2. Setting Up the RPM Programming Environment
15.1.3. Using the RPM Library
15.1.4. Compiling and Linking RPM Programs
15.1.5. Getting information on your RPM environment
15.2. The Power of popt
15.2.1. Popt aliases
15.2.2. Programming with popt
15.2.3. Handling Errors
15.2.4. Running a popt example
15.2.5. Handling rpm command-line options
15.3. Working with RPM Files
15.3.1. Opening RPM files
15.3.2. Reading the RPM lead and signature
15.3.3. Reading header information
15.3.4. A shortcut to header information
15.3.5. Closing RPM files
15.4. Programming with the RPM Database
15.4.1. Database iterators
15.4.2. Dependency Sets
15.5. Comparing an RPM File to an Installed Package
15.6. Where to Go from Here
15.7. Summary
16. Programming RPM with Python
16.1. Setting Up a Python Development Environment
16.1.1. Installing the base Python packages
16.1.2. Using Python for graphics
16.2. The Python API Hierarchy
16.3. Programming with the RPM Database
16.3.1. Accessing the RPM database
16.3.2. Querying the RPM database
16.3.3. Examining the package header
16.3.4. Querying for specific packages
16.3.5. Printing information on packages
16.3.6. Refining queries
16.4. Reading Package Files
16.4.1. Reading headers from package files
16.4.2. Setting the verification flags
16.5. Dependency Comparisons
16.6. Installing and Upgrading Packages
16.6.1. Building up the transaction set
16.6.2. Transaction elements
16.6.3. Checking and reordering the transaction elements
16.6.4. Running the transaction
16.7. Where to Go from Here
16.8. Summary
17. Programming RPM with Perl
17.1. Getting and Using the Perl RPM Modules
17.2. Working with RPM Files
17.2.1. Opening package files
17.2.2. Listing tags from the package
17.2.3. Convenience methods
17.2.4. Listing the name and version
17.2.5. Checking whether the package is a source package
17.3. Programming with the RPM Database
17.3.1. Opening the database
17.3.2. Finding packages
17.3.3. Iterating over packages
17.3.4. Additional query subroutines
17.3.5. Getting information on packages
17.3.6. Comparing versions
17.3.7. Closing the database
17.4. Where to Go from Here
17.5. Summary
18. Using RPM on Non-Red Hat Linuxes
18.1. Troubleshooting RPM Installation Issues
18.1.1. Dealing with RPM versions
18.1.2. Dealing with divisions of software into packages
18.1.3. Dealing with dependency issues
18.1.4. Dealing with install locations
18.1.5. When all else fails, rebuild from the source package
18.2. Handling Problems Building RPMs
18.2.1. Writing distribution-specific packages
18.2.2. Dealing with automatic dependency generation
18.2.3. Dealing with different macros
18.2.4. Making relocatable packages
18.2.5. Creating an RPM build environment
18.3. Dealing with Non-RPM-Based Linux Versions
18.3.1. Handling non-RPM packages with alien
18.4. Standardizing RPMs
18.4.1. Filesystem Hierarchy Standard
18.4.2. RPM adoption
18.5. Summary
19. RPM on Other Operating Systems
19.1. Running RPM on Other Operating Systems
19.1.1. Getting RPM for your system
19.1.2. Running RPM on Windows
19.2. Bootstrapping RPM On Other Operating Systems
19.2.1. Downloading the RPM software
19.2.2. Extracting the software
19.2.3. Reading the INSTALL file
19.2.4. Libraries required by RPM
19.2.5. Tools for building RPM
19.2.6. Compiling RPM
19.2.7. Handling problems
19.3. Setting Up the RPM System
19.3.1. Setting up the RPM database
19.3.2. Creating the RPM environment
19.4. Creating Non-Linux RPMS
19.4.1. Setting up a build environment
19.4.2. Cross-building packages
19.5. Summary
20. Customizing RPM Behavior
20.1. Customizing with RPM Macros
20.1.1. Defining macros
20.1.2. Customizing Macros
20.2. Configuring RPM Settings
20.2.1. Viewing the current settings
20.2.2. Locating the rpmrc files
20.2.3. Changing settings
20.3. Adding Popt Aliases
20.3.1. Defining aliases
20.3.2. Customizing popt aliases
20.4. Summary
21. RPM Command Reference
21.1. The rpm Command
21.1.1. Upgrade, freshen, and install options
21.1.2. Erase options
21.1.3. Signature options
21.1.4. Verify options
21.1.5. Database options
21.1.6. Miscellaneous options
21.2. The rpmbuild Command
21.2.1. Building from a spec file
21.2.2. Building from a compressed tar archive
21.2.3. Rebuilding RPMs from source RPMs
21.2.4. Customizing the build
22. Spec File Syntax
22.1. Package Information Tags
22.1.1. Comments
22.1.2. Build settings
22.1.3. Dependency tags
22.1.4. Source files
22.2. Macros
22.2.1. Variable definition macros
22.2.2. Conditional macros
22.2.3. Built-in macros
22.3. Build Sections
22.3.1. Build preparation
22.3.2. Build
22.3.3. Installation
22.3.4. Clean up
22.3.5. Install and uninstall scripts
22.4. File Tags
22.4.1. Making relocatable packages
22.5. The Change Log
23. RPM Feature Evolution
24. RPM Package File Structure
24.1. The Package File
24.1.1. The file identifier
24.1.2. The signature
24.1.3. The header
24.1.4. The payload
25. RPM Resources
25.1. Finding RPM Sites
25.1.1. The main rpm.org site
25.1.2. RPM locator sites
25.1.3. RPM tools sites
25.1.4. Programming sites
25.1.5. Sites related to RPM
25.2. Accessing RPM Mailing Lists and Newsgroups
26. Linux Text Editors and Development Tools
26.1. General Text Editors
26.2. Programming Text Editors
26.3. Integrated Development Environments for C Programming
26.4. Integrated Development Environments for Python Programming
27. Licensing RPM
27.1. The GNU General Public License
Index