-->
Page 158
While it's possible to detect many errors in the %files list using rpm -bl, there is another type of problem that can't be detected. Consider the following scenario:
Is the incompatible /usr/bin/foo included in the package? You bet it is! If only there were some way for RPM to catch this type of problem.
Well, there is! If you add --timecheck, followed by a number, RPM will check each file being packaged to see if the file is more than the specified number of seconds old. If it is, a warning message is displayed. The --timecheck option works with either the -ba or -bl options. Here's an example using -bl:
# rpm -bl --timecheck 3600 cdplayer-1.0.spec * Package: cdplayer File List Check: cdplayer-1.0-1 warning: TIMECHECK failure: /usr/doc/cdplayer-1.0-1/README Finding dependencies... Requires (2): libc.so.5 libncurses.so.2.0 #
In this example, the file /usr/doc/cdplayer-1.0-1/README is more than 3,600 seconds, or 1 hour, old. If we take a look at the file, we find that it is as follows (note that the package was built substantially later than November 1995!):
# ls -al /usr/doc/cdplayer-1.0-1/README -rw-r--r-- 1 root root 1085 Nov 10 1995 README #
In this case, the warning from --timecheck is no cause for alarm. Since the README file was simply copied from the original source, which was created November 10, 1995, its date is unchanged. If the file had been an executable or a library that was supposedly built recently, --timecheck's warning should be taken more seriously.
If you'd like to set a default time check value of one hour, you can include the following line in your rpmrc file:
timecheck: 3600
This value can still be overridden by a value on the command line, if desired. For more information on the use of rpmrc files, see Appendix B, "The rpmrc File."
Page 159
Unlike most other RPM commands, there is no -v option for rpm -b. That's because the command's default is to be verbose. However, even more information can be obtained by adding -vv. Here's an example:
# rpm -bp -vv cdplayer-1.0.spec D: Switched to BASE package D: Source(0) = sunsite.unc.edu:/pub/Linux/apps/sound/cds/cdplayer-1.0.tgz D: Switching to part: 12 D: fileFile = D: Switched to package: (null) D: Switching to part: 2 D: fileFile = D: Switching to part: 3 D: fileFile = D: Switching to part: 4 D: fileFile = D: Switching to part: 10 D: fileFile = D: Switched to package: (null) * Package: cdplayer D: RUNNING: %prep + umask 022 + echo Executing: %prep Executing: %prep + cd /usr/src/redhat/BUILD + cd /usr/src/redhat/BUILD + rm -rf cdplayer-1.0 + gzip -dc /usr/src/redhat/SOURCES/cdplayer-1.0.tgz + tar -xvvf - drwxrwxr-x root/users 0 Aug 4 22:30 1996 cdplayer-1.0/ -rw-r--r-- root/users 17982 Nov 10 01:10 1995 cdplayer-1.0/COPYING ... -rw-r--r-- root/users 1515 Nov 10 01:10 1995 cdplayer-1.0/volume.h + [ 0 -ne 0 ] + cd cdplayer-1.0 + cd /usr/src/redhat/BUILD/cdplayer-1.0 + chown -R root.root . + chmod -R a+rX,g-w,o-w . + exit 0 #
Most of the output generated by the -vv option is preceded by a D:. In this example, the additional output represents RPM's internal processing during the start of the build process. Using the -vv option with other build commands will produce different output.
As mentioned earlier, the build command is normally verbose. The --quiet option can be used to cut down on the command's output:
# rpm -ba --quiet cdplayer-1.0.spec Package: cdplayer
Page 160
volume.c: In function `mix_set_volume': volume.c:67: warning: implicit declaration of function `ioctl' 90 blocks 82 blocks #
This is the entire output from a package build of cdplayer. Note that warning messages (actually, anything sent to stdout) are still printed.
The --rcfile option is used to specify a file containing default settings for RPM. Normally, this option is not needed. By default, RPM uses /etc/rpmrc and a file named .rpmrc located in your login directory.
This option would be used if there were a need to switch between several sets of RPM defaults. Software developers and package builders will normally be the only people using the --rcfile option. For more information on rpmrc files, see Appendix B.
Two other commands also perform build-related functions. However, they do not use the rpm -b command syntax we've been studying so far. Instead of specifying the name of the spec file, as with rpm -b, it's necessary to specify the name of the source package file.
Why the difference in syntax? The reason has to do with the differing functions of these commands. Unlike rpm -b, where the name of the game is to get software packaged into binary and source package files, these commands use an already-existing source package file as input. Let's take a look at them in the following sections.
The --recompile option directs RPM to perform the following steps:
While you might think this sounds a great deal like an install of the source package file, followed by an rpm -bi, this is not entirely the case. Using --recompile, the only file required is the source package file. After the software is built and installed, the only thing left, other than the newly installed software, is the original source package file.