Product SiteDocumentation Site

Fedora Draft Documentation

Packager's Guide

A guide to software packaging for Fedora 18

Edition 18.0.1

Petr Kovář

Red Hat Engineering Content Services

Legal Notice

Copyright © 2012 Red Hat, Inc and others.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at The original authors of this document, and Red Hat, designate the Fedora Project as the "Attribution Party" for purposes of CC-BY-SA. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, MetaMatrix, Fedora, the Infinity Logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
For guidelines on the permitted uses of the Fedora trademarks, refer to
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
All other trademarks are the property of their respective owners.
The Packager's Guide provides basic information on creating, building, and testing RPM packages, and spec file writing. It also contains a spec file reference. The audience are developers and system administrators who have a basic understanding of software packaging and RPM.

1. Document Conventions
1.1. Typographic Conventions
1.2. Pull-quote Conventions
1.3. Notes and Warnings
2. We Need Feedback!
3. Acknowledgments
1. Exploring the Structure of Packages
1.1. Packaging with RPM
1.1.1. Why Package Software with RPM?
1.2. Package Design
1.2.1. Package File Name
1.2.2. Format of the Archived Files
1.2.3. Querying Packages
2. Creating and Building Packages
2.1. Preparing a Build Environment
2.1.1. Creating a Non-Root Buildroot
2.2. Creating a Basic Spec File
2.2.1. Creating an Example Spec File for eject
2.3. Building a Package
2.3.1. Building an Example Package: eject
2.4. Testing a Package
2.4.1. Testing a Spec File
2.4.2. Testing a Spec File, Binary, and Source Package
2.4.3. Testing a Package with Mock
A. Spec File Reference
A.1. Spec File Directives
A.2. Spec File Macros
A.3. Spec File Comments
A.4. Spec File Example
A.5. Spec File Preamble
B. Getting More Information
C. Revision History