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

📄 index.html

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

<P>

20.4.1. Creating the %files List     291

</P>



<P>20.4.2. Testing those first packages     296

</P>



<P>20.4.3. Finishing Touches     297

</P>

</blockquote>

</blockquote>



<P><b>     21     A Guide to the RPM Library API     305</b>

</P>

<blockquote>

<p>

21.1. An Overview of rpmlib       306

</P>



<P>

21.2. rpmlib Functions     306

</p>

<blockquote>

<P>

21.2.1. Error Handling     306

</P>



<P>21.2.2. Getting Package Information     307

</P>

</blockquote>

</blockquote>



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





<blockquote><blockquote>

<P>21.2.3. Variable Manipulation     308

</P>



<P>21.2.4. rpmrc-Related Information     309

</P>



<P>21.2.5. RPM Database Manipulation     311

</P>



<P>21.2.6. RPM Database Traversal     312

</P>



<P>21.2.7. RPM Database Search     313

</P>



<P>21.2.8. Package Manipulation     315

</P>



<P>21.2.9. Package and File Verification     318

</P>



<P>21.2.10. Dependency-Related Operations     319

</P>



<P>21.2.11. Diagnostic Output Control     322

</P>



<P>21.2.12. Signature Verification     323

</P>



<P>21.2.13. Header Manipulation     324

</P>



<P>21.2.14. Header Entry Manipulation     326

</P>



<P>21.2.15. Header Iterator Support     327

</P></blockquote>



<p>

21.3. Sample Code     328

</p>

<blockquote>

<P>

21.3.1. Example #1     328

</P>



<P>21.3.2. Example #2     330

</P>



<P>21.3.3. Example #3     333

</P>

</blockquote>

</blockquote>



<P><b>Part III Appendixes</b>

</P>



<P>

     A     The Format of the RPM File     337

</P>



<blockquote>

<p>

A.1. The RPM File-Naming Convention     338

</P>



<P>

A.2. The RPM File Format     339

</p>

<blockquote>

<P>

A.2.1. Parts of an RPM File     339

</P>

</blockquote>



<p>

A.3. Tools for Studying RPM Files     349

</P>



<P>

A.4. Identifying RPM Files with the file(1) Command

351

</p></blockquote>



<P>

     B     The rpmrc File     353

</P>

<blockquote>

<p>

B.1. Using the --showrc Option     354

</P>



<P>

B.2. Different Places an rpmrc File Resides

355

</p>

<blockquote>

<P>

B.2.1. /usr/lib/rpmrc      355

</P>



<P>B.2.2. /etc/rpmrc      358

</P>



<P>B.2.3. .rpmrc in the User's Login Directory

358

</P>



<P>B.2.4. File Specified by the --rcfile Option

358

</P>

</blockquote>



<p>

B.3. rpmrc File Syntax     358

</P>



<P>

B.4. rpmrc File Entries     359

</p>

<blockquote>

<P>

B.4.1. arch_canon      359

</P>



<P>B.4.2. os_canon      359

</P>



<P>B.4.3. buildarchtranslate      359

</P>



<P>B.4.4. buildostranslate      360

</P>



<P>B.4.5. arch_compat      360

</P>



<P>B.4.6. os_compat      360

</P>



<P>B.4.7. builddir      361

</P>



<P>B.4.8. buildroot      361

</P>



<P>B.4.9. cpiobin      361

</P>



<P>B.4.10. dbpath      361

</P>



<P>B.4.11. defaultdocdir      361

</P>

</blockquote>

</blockquote>



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





<blockquote><blockquote>

<P>B.4.12. distribution      362

</P>



<P>B.4.13. excludedocs      362

</P>



<P>B.4.14. ftpport      362

</P>



<P>B.4.15. ftpproxy      362

</P>



<P>B.4.16. messagelevel      362

</P>



<P>B.4.17. netsharedpath      362

</P>



<P>B.4.18. optflags      363

</P>



<P>B.4.19. packager      363

</P>



<P>B.4.20. pgp_name      363

</P>



<P>B.4.21. pgp_path      364

</P>



<P>B.4.22. require_distribution      364

</P>



<P>B.4.23. require_icon      364

</P>



<P>B.4.24. require_vendor      364

</P>



<P>B.4.25. rpmdir      364

</P>



<P>B.4.26. signature      365

</P>



<P>B.4.27. sourcedir      365

</P>



<P>B.4.28. specdir      365

</P>



<P>B.4.29. srcrpmdir      365

</P>



<P>B.4.30. timecheck      365

</P>



<P>B.4.31. tmppath      365

</P>



<P>B.4.32. topdir      366

</P>



<P>B.4.33. vendor      366

</P></blockquote>

</blockquote>



<P><b>     C     Concise RPM Command Reference     367</b>

</P>

<blockquote>

<p>

C.1. Global Options     368

</P>



<P>

C.2. Informational Options     368

</P>



<P>

C.3. Query Mode     368

</p>

<blockquote>

<P>

C.3.1. Package Specification Options for Query Mode

368

</P>



<P>C.3.2. Information Selection Options for Query Mode

369

</P>

</blockquote>



<p>

C.4. Verify Mode     369

</p>

<blockquote>

<P>

C.4.1. Options for Verify Mode     370

</P>

</blockquote>



<p>

C.5. Install Mode     370

</p>

<blockquote>

<P>

C.5.1. Options for Install Mode     370

</P>

</blockquote>



<p>

C.6. Upgrade Mode     371

</p>

<blockquote>

<P>

C.6.1. Options for Upgrade Mode     371

</P>

</blockquote>



<p>

C.7. Erase Mode     371

</p>

<blockquote>

<P>

C.7.1. Options for Erase Mode     372

</P>

</blockquote>



<p>

C.8. Build Mode     372

</p>

<blockquote>

<P>

C.8.1. Build Mode Stages     372

</P>



<P>C.8.2. Options for Build Mode     372

</P>

</blockquote>



<p>

C.9. Rebuild Mode     373

</p>

<blockquote>

<P>

C.9.1. Options for Rebuild Mode     373

</P>

</blockquote>



<p>

C.10. Recompile Mode     373

</p>

<blockquote>

<P>

C.10.1. Options for Recompile Mode     373

</P>

</blockquote>



<p>

C.11. Resign Mode     373

</p>

<blockquote>

<P>

C.11.1. Options for Resign Mode     373

</P>

</blockquote>

</blockquote>



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



<blockquote>

<p>

C.12. Add Signature Mode     373

</p>



<blockquote>

<P>

C.12.1. Options for Add Signature Mode     374

</P>

</blockquote>



<p>

C.13. Check Signature Mode     374

</p>

<blockquote>

<P>

C.13.1. Options for Check Signature Mode     374

</P>

</blockquote>



<p>

C.14. Initialize Database Mode     374

</p>

<blockquote>

<P>

C.14.1. Options for Initialize Database Mode     374

</P>

</blockquote>



<p>

C.15. Rebuild Database Mode     374

</p>

<blockquote>

<P>

C.15.1. Options to Rebuild Database Mode     374

</P>

</blockquote>

</blockquote>



<P><b>     D     Available Tags for queryformat     375</b>

</P>

<blockquote>

<p>

D.1. List of --queryformat Tags     376

</p>

</blockquote>



<P>

<b>     E     Concise Spec File Reference     387</b>

</P>

<blockquote>

<p>

E.1. Comments     388

</P>



<P>

E.2. The Preamble     388

</p>

<blockquote>

<P>

E.2.1. Package-Naming Tags     388

</P>



<P>E.2.2. Descriptive Tags     388

</P>



<P>E.2.3. Dependency Tags     390

</P>



<P>E.2.4. Architecture- and Operating System_Specific Tags

391

</P>



<P>E.2.5. Directory-Related Tags     392

</P>



<P>E.2.6. Source and Patch Tags     393

</P>

</blockquote>



<p>

E.3. Scripts     394

</p>

<blockquote>

<P>

E.3.1. BuildTime Scripts     394

</P>



<P>E.3.2. Install and EraseTime Scripts     395

</P>



<P>E.3.3. Verification Scripts     396

</P>

</blockquote>



<p>

E.4. Macros     396

</p>

<blockquote>

<P>

E.4.1. The %setup Macro     396

</P>





<P>E.4.2. The %patch Macro     397

</P>

</blockquote>

<p>

E.5. The %files List     398

</P>



<P>

E.6. Directives for the %files List     399

</p>

<blockquote>

<P>

E.6.1. File-Related Directives     399

</P>





<P>E.6.2. Directory-Related Directives     400

</P>

</blockquote>



<p>

E.7. The %package Directive     401

</p>

<blockquote>

<P>

E.7.1. The %package -n Option     401

</P>

</blockquote>



<p>

E.8. Conditionals     401

</p>

<blockquote>

<P>

E.8.1. The %ifarch Conditional     401

</P>





<P>E.8.2. The %ifnarch Conditional     402

</P>



<P>E.8.3. The %ifos Conditional     402

</P>



<P>E.8.4. The %ifnos Conditional     402

</P>



<P>E.8.5. The %else Conditional     402

</P>



<P>E.8.6. The %endif Conditional     402

</P>

</blockquote>

</blockquote>



<P><b>     F     RPM-Related Resources     403</b>

</P>

<blockquote>

<p>

F.1. Where to Get RPM     404

</p>

<blockquote>

<P>

F.1.1. FTP Sites     404

</P>



<P>F.1.2. What Do I Need?     406

</P>

</blockquote>

</blockquote>



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









<blockquote>

<p>

F.2. Where to Talk About RPM     407

</p>

<blockquote>

<P>

F.2.1. The rpm-list Mailing List     408

</P>



<P>F.2.2. The redhat-list Mailing List     408

</P>



<P>F.2.3. The redhat-digest Mailing List     408

</P>

</blockquote>



<p>

F.3. RPM on the World Wide Web     409

</P>



<P>

F.4. RPM's License     409

</p>

<blockquote>

<P>

Preamble     410

</P>



<P>GNU General Public License     411

</P>



<P>How to Apply These Terms to Your New Programs

415

</P>

</blockquote>

</blockquote>



<P><b>     G     An Introduction to PGP      417</b>

</P>

<blockquote>

<p>

G.1. PGP: Privacy for Regular People     418

</p>

<blockquote>

<P>

G.1.1. Keys Your Locksmith Wouldn't Understand

418

</P>



<P>G.1.2. Are RPM Packages Encrypted?     419

</P>



<P>G.1.3. Do All RPM Packages Have Digital Signatures?

420

</P>



<P>G.1.4. So Much to Cover, So Little Time     420

</P>

</blockquote>



<p>

G.2. Installing PGP for RPM's Use     420

</p>

<blockquote>

<P>

G.2.1. Obtaining PGP     420

</P>



<P>G.2.2. Building PGP     422

</P>



<P>G.2.3. Ready to Go!     423

</P>

</blockquote>



<P>          Index     425

</P>

</blockquote>









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







<H2>

<A NAME="1054_ 2">

Introduction

</a>

</H2>



<P>

<b>Linux and RPM: A Brief History</b>

</P>



<P>Welcome! This is a book about the Red Hat Package Manager or, as it is known to its

friends, RPM. The history of RPM is inextricably linked to the history of Linux, so a bit of Linux

history may be in order. Linux is a full-featured implementation of a UNIX-like operating

system, and has taken the computing world by storm.

</P>



<P>And for good reason: With the addition of Linux, an Intel-based personal computer that

had previously been prisoner of the dreaded Windows hourglass is transformed into a

fully multitasking, network-capable personal workstation. All for the cost of the time required

to download, install, and configure the software.

</P>



<P>Of course, if you're not the type to tinker with downloaded software, you can get a

CD-ROM containing Linux and associated software. The amount of tinkering required with these

distributions varies widely. The phrase &quot;You get what you pay for&quot; is never more true than in

the area of Linux distributions.

</P>



<P>One distribution bears the curious name Red Hat

Linux. Produced by a company of the same name, this Linux distribution is different. One of the key decisions a new Linux user needs

to make is which of the many different parts of the distribution to install on his system.

Most distributions use some sort of menu, making it easy to pick and choose. Red Hat Linux is

no different.

</P>



<P>But what is different about Red Hat Linux is that the creators of the distribution wanted

their customers to have the ability to make the same choices long after the installation process

was over. Some commercial UNIX systems have this capability (called

package management), and a few Linux distributors were trying to come up with something similar, but none had the

extensive scope present in RPM.

</P>



<P>Over time, Red Hat Linux has become the most popular distribution available. For it to

edge out the previous leader (known as Slackware) in just two years is amazing. There has to be

a reason for this kind of success, and a good part of the reason is RPM. But until now, there

has been precious little in terms of RPM documentation. You could say that RPM's ease of use

has made detailed instructions practically unnecessary, and you'd be right.

</P>



<P>However, there are always people who want to know more about their computers, and

given the popularity of Red Hat Linux, this alone would have made a book on RPM worthwhile.

</P>



<P>But there's more to the story than that.

</P>



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







<P>There is a truism in the world of free software that goes something like this: If there's a

better solution freely available, use it! RPM is no exception to the rule. Put under the terms of

the GNU General Public License (meaning: RPM cannot be made proprietary by anyone, not

even Bill Gates), RPM started to attract the attention of others in the Linux, UNIX, and free

software communities.

</P>



<P>At present, RPM is used by several commercial software companies producing Linux

applications. They find that RPM makes it easier to get their products into the hands of their

customers. They also find that it can even make the process of building their software easier. (Those

of you who develop software for fun and profit, stick around. The second half of this book

will show you everything you need to know to get your software &quot;RPM-ized.&quot;)

</P>



<P>People have also ported RPM to several commercial UNIX systems, including DEC's

Digital UNIX, IBM's AIX, and Silicon Graphics's IRIX. Why? The simple answer is that it makes

it easier to install, upgrade, and uninstall software. If all these people are using RPM,

shouldn't you?

</P>



<P>

<b>Parts of the Book and Who They're For</b>

</P>



<P>This book is divided into two major sections. The first section is for anyone who needs to

know how to use RPM on his system. Given the state of the Linux arena today, this could

include just about anyone, including people who are new to Linux or even UNIX. So those of you

who think that

</P>

<!-- CODE SNIP //-->

<PRE>ls -FAl !*|less

</PRE>

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



<P>is serious magic (or maybe even a typing error), relax. We'll explain everything you'll need

to know in the first section.

</P>



<P>The book's second half covers all there is to know about building packages using RPM.

Because software engineering on Linux and UNIX systems requires in-depth knowledge of

the operating system, available tools, and basic programming concepts, we're going to assume

that the reader has sufficient background in these areas. Feel free to browse through the second

half, but don't hesitate to seek additional sources of information if you find the going a bit tough.

</P>



<P><CENTER>

<a href="ewtoc.html">Table of Contents</a> | <a href="about.html">Next</a></CENTER></P>







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

<!-- begin footer information -->





</body></html>

⌨️ 快捷键说明

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