Packaging Miscellany
This section has a few miscellaneous tips to help you debug the package-building process. Also, some of the conventions used by major distributions for their packages are described. You might want to use similar techniques when you build packages.
Debugging the Build Process
rpm executes the shell commands and scripts that it processes with the shell set -x option set. This means that in the output of rpm, the commands that it executes are displayed with a plus sign in front of them. Output from these commands appears unmodified. You can use the output of rpm to determine what commands RPM is executing at each stage of the build process, for debugging purposes.
BuildRoot
Virtually all packages produced by major distributions use the BuildRoot feature of RPM. The BuildRoot directive instructs RPM to place files in a temporary location during the install stage. This prevents the act of building a SRPM from modifying your system.
This means that you can't just install the source RPM for a package, modify a few things, and rebuild it to get the software in the package installed on your system. For example, to make a quick patch, some people are accustomed to installing a source RPM on their system, running the prep stage of the build process, and then applying the patches and manually running the steps in the install stage. Because the packages use BuildRoot, the software doesn't end up in the live part of the filesystem. With these packages, you actually have to build the binary package and install it.