0158-0160.html

来自「linux-unix130.linux.and.unix.ebooks130 l」· HTML 代码 · 共 277 行

HTML
277
字号




<HTML>

<HEAD>

<TITLE>Maximum RPM (RPM):rpm -b Command Reference:EarthWeb Inc.-</TITLE>

<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>

 -->




<!-- ISBN=0672311054 //-->

<!-- TITLE=Maximum RPM (RPM)//-->

<!-- AUTHOR=Edward Bailey//-->

<!-- PUBLISHER=Macmillan Computer Publishing//-->

<!-- IMPRINT=Sams//-->

<!-- CHAPTER=12 //-->

<!-- PAGES=0139-0162 //-->

<!-- UNASSIGNED1 //-->

<!-- UNASSIGNED2 //-->









<P><CENTER>

<a href="0154-0157.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0161-0162.html">Next</A>

</CENTER></P>



<A NAME="PAGENUM-158"><P>Page 158</P></A>







<H4><A NAME="ch12_ 10">

12.1.14. --timecheck &lt;secs&gt;: Print a Warning if Files to

Be Packaged Are More Than &lt;secs&gt; Old

</A></H4>



<P>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:

</P>



<UL>

<LI>          A package you're building creates the file

/usr/bin/foo.

<LI>          Because of a problem with the package's makefile,

foo is never copied into /usr/bin.

<LI>          An older, incompatible version of

foo, created several months ago, already exists in

/usr/bin.

<LI>          RPM creates the binary package file.

</UL>



<P>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.

</P>



<P>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:

</P>



<!-- CODE //-->

<PRE>

# 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

#

</PRE>

<!-- END CODE //-->



<P>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!):

</P>



<!-- CODE SNIP //-->

<PRE>

# ls -al /usr/doc/cdplayer-1.0-1/README

-rw-r--r-- 1 root root 1085 Nov 10 1995 README

#

</PRE>

<!-- END CODE SNIP //-->



<P>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.

</P>



<P>If you'd like to set a default time check value of one hour, you can include the following line

in your rpmrc file:

</P>



<!-- CODE SNIP //-->

<PRE>

timecheck: 3600

</PRE>

<!-- END CODE SNIP //-->



<P>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, &quot;The

rpmrc File.&quot;

</P>



<A NAME="PAGENUM-159"><P>Page 159</P></A>







<H4><A NAME="ch12_ 11">

12.1.15. -vv: Display Debugging Information

</A></H4>



<P>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:

</P>



<!-- CODE //-->

<PRE>

# 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

#

</PRE>

<!-- END CODE //-->



<P>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.

</P>



<H4><A NAME="ch12_ 12">

12.1.16. --quiet: Produce As Little Output As Possible

</A></H4>



<P>As mentioned earlier, the build command is normally verbose. The

--quiet option can be used to cut down on the command's output:

</P>

<!-- CODE SNIP //-->

<PRE>

# rpm -ba --quiet cdplayer-1.0.spec

Package: cdplayer



</PRE>

<!-- END CODE SNIP //-->



<A NAME="PAGENUM-160"><P>Page 160</P></A>



<!-- CODE //-->

<PRE>



volume.c: In function `mix_set_volume':

volume.c:67: warning: implicit declaration of function `ioctl'

90 blocks

82 blocks

#

</PRE>

<!-- END CODE //-->



<P>This is the entire output from a package build of

cdplayer. Note that warning messages (actually, anything sent to

stdout) are still printed.

</P>



<H4>

12.1.17. --rcfile &lt;rcfile&gt;: Set Alternate

rpmrc File to &lt;rcfile&gt;

</H4>



<P>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.

</P>



<P>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.

</P>



<H3><A NAME="ch12_ 13">

12.2. Other Build-Related Commands

</A></H3>



<P>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.

</P>



<P>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.

</P>



<H4><A NAME="ch12_ 14">

12.2.1. rpm --recompile: What Does It Do?

</A></H4>



<P>The --recompile option directs RPM to perform the following steps:

</P>



<OL>

<LI>         Install the specified source package file.

<LI>         Unpack the original sources.

<LI>         Build the software.

<LI>         Install the software.

<LI>         Remove the software's build directory structure.

</OL>



<P>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.

</P>



<P><CENTER>

<a href="0154-0157.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0161-0162.html">Next</A>

</CENTER></P>











</td>
</tr>
</table>

<!-- begin footer information -->







</body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?