⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 appendix-b.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTML
📖 第 1 页 / 共 2 页
字号:


<HTML>

<HEAD>

<TITLE>Maximum RPM (RPM):appendix-b: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=appendix-b //-->

<!-- PAGES=0353-0366 //-->

<!-- UNASSIGNED1 //-->

<!-- UNASSIGNED2 //-->





<P><CENTER>

<a href="appendix-a.html">Previous</a> | <a href="ewtoc.html">Table of Contents</a> | <a href="appendix-c.html">Next</a></CENTER></P>











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







<H3>

<A NAME="1054_ 2">

Apendix B<br>

The rpmrc File

</a>

</H3>



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











<P>The rpmrc file is used to control RPM's actions. The file's entries have an effect on nearly

every aspect of RPM's operations. Here, we describe in more detail the

rpmrc files, as well as the command used to show how RPM interprets the files.

</P>



<H3>

B.1. Using the --showrc Option

</H3>



<P>As we'll see in a moment, RPM can read more than one

rpmrc file, and each file can contain nearly 30 different types of entries. This can make it difficult to determine what values RPM

is actually using.

</P>



<P>Luckily, there's an option that can be used to help make sense of it all. The

--showrc option displays the value for each of the entries. The output is divided into two sections:

</P>



<UL>

<LI>          Architecture and

operating system values

<LI>          rpmrc values

</UL>



<P>The architecture and operating system values define the architecture and operating system

on which RPM is running. These values define the environment for both building and

installing packages. They also define which architectures and operating systems are compatible with

each other.

</P>



<P>The rpmrc values define many aspects of RPM's operation. These values range from the

path to RPM's database to the name of the person listed as having built the package.

</P>



<P>Here's an example of --showrc's output:

</P>



<!-- CODE //-->

<PRE>

# rpm --showrc

ARCHITECTURE AND OS:

build arch            : i386

build os              : Linux

install arch          : i486

install os            : Linux

compatible arch list  : i486 i386

compatible os list    : Linux

RPMRC VALUES:

builddir              : /usr/src/redhat/BUILD

buildroot             : (not set)

cpiobin               : cpio

dbpath                : /var/lib/rpm

defaultdocdir         : /usr/doc

distribution          : (not set)

excludedocs           : (not set)

ftpport               : (not set)

ftpproxy              : (not set)

messagelevel          : (not set)

netsharedpath         : (not set)

optflags              : -O2 -m486 -fno-strength-reduce

packager              : (not set)

pgp_name             : (not set)



</PRE>

<!-- END CODE //-->



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



<!-- CODE //-->

<PRE>



pgp_path             : (not set)

require_distribution : (not set)

require_icon         : (not set)

require_vendor       : (not set)

root                  : (not set)

rpmdir                : /usr/src/redhat/RPMS

signature             : none

sourcedir             : /usr/src/redhat/SOURCES

specdir               : /usr/src/redhat/SPECS

srcrpmdir             : /usr/src/redhat/SRPMS

timecheck             : (not set)

tmppath               : /var/tmp

topdir                : /usr/src/redhat

vendor                : (not set)

#

</PRE>

<!-- END CODE //-->



<P>As you can see, the --showrc option clearly displays the values RPM will use.

--showrc can also be used with the --rcfile option, which makes it easy to see the effect of specifying a

different rpmrc file.

</P>



<H3>

B.2. Different Places an rpmrc File Resides

</H3>



<P>RPM looks for rpmrc files in four places:

</P>



<UL>

<LI>          In

/usr/lib/, for a file called rpmrc

<LI>          In

/etc/, for a file called rpmrc

<LI>          In a file called

.rpmrc in the user's login directory

<LI>          In a file specified by the

--rcfile option, if the option is present on the

command line

</UL>



<P>The first three files are read in the order listed, such that if a given

rpmrc entry is present in each file, the value of the entry read last is the one used by RPM. This means, for example, that

an entry in .rpmrc in the user's login directory will always override the same entry in

/etc/rpmrc. Likewise, an entry in /etc/rpmrc will always override the same entry in

/usr/lib/rpmrc.

</P>



<P>If the --rcfile option is used, then only

/usr/lib/rpmrc and the file following the --rcfile option are read, in that order. The

/usr/lib/rpmrc file is always read first. This cannot

be changed.

</P>



<P>Let's look at each of these files, starting with

/usr/lib/rpmrc.

</P>



<H4>

B.2.1. /usr/lib/rpmrc

</H4>



<P>The file /usr/lib/rpmrc is always read. It contains information that RPM uses to set some

default values. This file should never be

modified! Doing so may cause RPM to operate incorrectly.

</P>



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







<P>After this stern warning, we should note that it's perfectly all right to look at it. Here it is,

in fact:

</P>

<!-- CODE //-->

<PRE>

#############################################################

# Default values, often overridden in /etc/rpmrc



dbpath: /var/lib/rpm

topdir: /usr/src/redhat

tmppath: /var/tmp

cpiobin: cpio

defaultdocdir: /usr/doc



#############################################################



# Please send new entries to rpm-list@redhat.com



#############################################################

# Values for RPM_OPT_FLAGS for various platforms



optflags: i386 -O2 -m486 -fno-strength-reduce

optflags: alpha -O2

optflags: sparc -O2

optflags: m68k -O2 -fomit-frame-pointer



#############################################################

# Canonical arch names and numbers



arch_canon: i986: i986 1

arch_canon: i886: i886 1

arch_canon: i786: i786 1

arch_canon: i686: i686 1

arch_canon: i586: i586 1

arch_canon: i486: i486 1

arch_canon: i386: i386 1

arch_canon: alpha: alpha 2

arch_canon:  sparc: sparc 3

arch_canon:  sun4: sparc 3

arch_canon:  sun4m: sparc 3

arch_canon:  sun4c: sparc 3

# This is really a place holder for MIPS.

arch_canon: mips: mips 4

arch_canon: ppc: ppc 5

# This is really a place holder for 68000

arch_canon: m68k: m68k 6

# This is wrong. We really need globbing in here :-(

arch_canon: IP: sgi 7

arch_canon:     IP22:  sgi     7



arch_canon:    9000/712:      hppa1.1 9



arch_canon:    sun4u:  usparc  10



#############################################################

# Canonical OS names and numbers



</PRE>

<!-- END CODE //-->



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



<!-- CODE //-->

<PRE>

os_canon: Linux: Linux 1

os_canon: IRIX: Irix 2

# This is wrong

os_canon: SunOS5: solaris 3

os_canon: SunOS4: SunOS 4



os_canon:      AmigaOS: AmigaOS 5

os_canon:          AIX: AIX     5

os_canon:        HP-UX: hpux10  6

os_canon:         OSF1: osf1    7

os_canon:      FreeBSD: FreeBSD 8



#############################################################

# For a given uname().machine, the default build arch



buildarchtranslate: osfmach3_i986: i386

buildarchtranslate: osfmach3_i886: i386

buildarchtranslate: osfmach3_i786: i386

buildarchtranslate: osfmach3_i686: i386

buildarchtranslate: osfmach3_i586: i386

buildarchtranslate: osfmach3_i486: i386

buildarchtranslate: osfmach3_i386: i386



buildarchtranslate: i986: i386

buildarchtranslate: i886: i386

buildarchtranslate: i786: i386

buildarchtranslate: i686: i386

buildarchtranslate: i586: i386

buildarchtranslate: i486: i386

buildarchtranslate: i386: i386



buildarchtranslate: osfmach3_ppc: ppc



#############################################################

# Architecture compatibility



arch_compat: alpha: axp



arch_compat: i986: i886

arch_compat: i886: i786

arch_compat: i786: i686

arch_compat: i686: i586

arch_compat: i586: i486

arch_compat: i486: i386



arch_compat: osfmach3_i986: i986 osfmach3_i886

arch_compat: osfmach3_i886: i886 osfmach3_i786

arch_compat: osfmach3_i786: i786 osfmach3_i686

arch_compat: osfmach3_i686: i686 osfmach3_i586

arch_compat: osfmach3_i586: i586 osfmach3_i486

arch_compat: osfmach3_i486: i486 osfmach3_i386

arch_compat: osfmach3_i386: i486



arch_compat: osfmach3_ppc: ppc



arch_compat: usparc: sparc

</PRE>

<!-- END CODE //-->



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



<P>Quite a bunch of stuff, isn't it? With the exception of the first five lines, which indicate

where several important directories and programs are located, the remainder of this file contains

rpmrc entries that are related to RPM's architecture and operating system processing. As you

might imagine, any tinkering here will probably not be very productive, so leave any

modifications here to the RPM developers.

</P>



<P>Next, we have /etc/rpmrc.

</P>



<H4>

B.2.2. /etc/rpmrc

</H4>



<P>The file /etc/rpmrc, unlike /usr/lib/rpmrc, is fair game for modifications and additions.

In fact, /etc/rpmrc isn't created by default, so its contents are entirely up to you. It's the

perfect place to keep rpmrc entries of a systemwide or global nature.

</P>



<P>The vendor entry is a great example of a good candidate for inclusion in

/etc/rpmrc. In most cases, a particular system is dedicated to building packages for one vendor. In these

instances, setting the vendor entry in /etc/rpmrc is best.

</P>



<P>Next in the hierarchy is a file named .rpmrc, which resides in the user's login directory.

</P>



<H4>

B.2.3. .rpmrc in the User's Login Directory

</H4>



<P>As you might imagine, a file called .rpmrc in a user's login directory is only going to be read

by that user when he or she runs RPM. Like

/etc/rpmrc, this file is not created by default, but

it can contain the same rpmrc entries as the other files. The

packager entry, which should contain the name and contact information for the person who built the package, is an appropriate

candidate for ~/.rpmrc.

</P>



<H4>

B.2.4. File Specified by the --rcfile Option

</H4>



<P>The --rcfile option is best used only when a totally different RPM configuration is

desired for one or two packages. Since the only other

rpmrc file read is /usr/lib/rpmrc with its low-level default settings, the file specified with the

--rcfile option will have to be more comprehensive than either

/etc/rpmrc or ~/.rpmrc.

</P>



<H3>

B.3. rpmrc File Syntax

</H3>



<P>As you might have surmised from the sample file we briefly reviewed, the basic syntax of

an rpmrc file entry is

</P>



<!-- CODE SNIP //-->

<PRE>

&lt;name&gt;:&lt;value&gt;

</PRE>

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



<P>The &lt;name&gt; part of the entry is not case sensitive, so any capitalization is acceptable. The

colon separating the name from its value must immediately follow the name. No spaces are

allowed

</P>



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







<P>here. The formatting requirements on the value side of the entry vary from value to value

and are discussed along with each entry.

</P>



<H3>

B.4. rpmrc File Entries

</H3>



<P>In this section, we discuss the various entries that can be used in each of the

rpmrc files.

</P>



<H4>

B.4.1. arch_canon

</H4>



<P>The arch_canon entry is used to define a table of architecture names and their associated

numbers. These canonical architecture names and numbers are then used internally by RPM

whenever architecture-specific processing takes place. This entry's format is

</P>

<!-- CODE SNIP //-->

<PRE>

arch_canon:&lt;label&gt;: &lt;string&gt; &lt;value&gt;

</PRE>

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



<P>&lt;label&gt; is compared against information from

uname(2) after it's been translated using the appropriate

buildarchtranslate entry. If a match is found,

&lt;string&gt; is used by RPM to reference the system's architecture. When building a binary package, RPM uses

&lt;string&gt; as part of the package's filename, for instance.

</P>



<P>&lt;value&gt; is a numeric value RPM uses internally to identify the architecture. For example,

this number is written in the header of each package file so that the

file command can identify the architecture for which the package was built.

</P>



<H4>

B.4.2. os_canon

</H4>



<P>The os_canon entry is used to define a table of operating system names and their

associated numbers. These canonical operating system names and numbers are then used internally

by RPM whenever operating system_specific processing takes place. This entry's format is

</P>

<!-- CODE SNIP //-->

<PRE>

os_canon:&lt;label&gt;: &lt;string&gt; &lt;value&gt;

</PRE>

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



<P>The &lt;label&gt; is compared against information from

uname(2) after it's been translated using the appropriate

buildostranslate entry. (The buildostranslate

rpmrc file entry is discussed in section B.4.4.) If a match is found,

&lt;string&gt; is used by RPM to reference the operating

system.

</P>



<P>The &lt;value&gt; is a numeric value used to uniquely identify the operating system.

</P>



<H4>

B.4.3. buildarchtranslate

</H4>



<P>The buildarchtranslate entry is used in the process of defining the architecture that

RPM will use as the build architecture. As the name implies, it is used to translate the raw

information returned from uname(2) to the canonical architecture defined by

arch canon.

</P>



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







<P>The format of the buildarchtranslate entry is slightly different from most other

rpmrc file entries. Instead of the usual

&lt;name&gt;:&lt;value&gt; format, the

buildarchtranslate entry looks like this:

</P>

<!-- CODE SNIP //-->

<PRE>

buildarchtranslate:&lt;label&gt;: &lt;string&gt;

</PRE>

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



<P>The &lt;label&gt; is compared against information from

uname(2). If a match is found, then &lt;string&gt; is used by RPM to define the build architecture.

</P>



<H4>

B.4.4. buildostranslate

</H4>



<P>The buildostranslate entry is used in the process of defining the operating system RPM

will use as the build operating system. As the name implies, it is used to translate the raw

information returned by uname(2) to the canonical operating system defined by

os_canon.

</P>

⌨️ 快捷键说明

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