Building RPMs
From Notes
When building RPMs, it is a good idea to create your own build environment so that you do not build packages as root. The way to do this is to create the structure that you see in /usr/src/redhat somewhere in your own private directory structure, then define the %_topdir in your .rpmmacros file:
~/.rpmmacros %_topdir /home/$LOGNAME/rpms
Remember to include all of the subdirectories:
BUILD RPMS SOURCES SPECS SRPMS
mkdir -p /home/$LOGNAME/rpms/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
Contents |
Pre-Requisites
- Install the rpm-build RPM which contains the rpmbuild command needed to build the RPMs.
SPEC File
When writing the %files section of the SPEC file, be sure to mark any files that might change over time as configuration files, using the following example:
%files
%config %{location}/config.file
Otherwise RPM will assume that the file has been modified when performing a verification check on the file and alert to this end. Configuration files are expected to change from the default and when specified in this manner, they will not generate an alert.
Troubleshooting
One error that I received when building the httpd RPM (from the Apache downloadable tgz) was this that some files were installed but not included in the SPEC file, you can get around this error if the files are not critical with the following directives:
SPEC File
%define _unpackaged_files_terminate_build 0 %define _missing_doc_files_terminate_build 0
~/.rpmmacros:
%_unpackaged_files_terminate_build 0 %_missing_doc_files_terminate_build 0
Resources
- Fedora RPM Guide
- Maximum RPM - (Careful -- very old!)
