Product SiteDocumentation Site

20.2.2. Locating the rpmrc files

The --showrc option reads in all the rpmrc files from the various locations. By default, this is /usr/lib/rpm/rpmrc, /etc/rpm/rpmrc, and a file named .rpmrc (with a leading period) in your home directory.
These files are read in the order given, so that the later files can override settings in the earlier files.
The uses for these files are listed in Table 21-3.
Table 21-3 Uses for the rpmrc files
RPM standard settings
Per-system configuration
Per-user configuration
The file /usr/lib/rpm/rpmrc gets overwritten each time you upgrade RPM. Do not customize this file.
You can override this list of files by calling the rpm or rpmbuild commands with the --rcfile option. This option expects a semicolon@nddelimited list of files to read in, in order. For example, if you are working on a 686-architecture Intel platform, you can create a file with the following setting:
optflags: i686 -g
Note that this disables optimization, so it is not a good setting. (The use of this value will make the result more visible.)
If you name this file .rpmnew and place it in your home directory, you can configure an alternate set of files with the --rcfile option and then evaluate the new optflags setting. For example:
$ rpm --eval "%{optflags}"
-O2 -march=i386 -mcpu=i686
$ rpm --rcfile $HOME/.rpmnew --eval "%{optflags}"
This example shows the value before and after changing the configuration files.
When you use the --rcfile option, only the first file listed must exist. The rest of the files are optional. When you use the --rcfile option, however, the file /usr/lib/rpm/rpmrc is read first, and then the list of files you provide with the --rcfile option. The file /usr/lib/rpm/rpmrc is always used.