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

📄 0260-0262.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTML
字号:




<HTML>

<HEAD>

<TITLE>Maximum RPM (RPM):Creating Subpackages: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=18 //-->

<!-- PAGES=0247-0262 //-->

<!-- UNASSIGNED1 //-->

<!-- UNASSIGNED2 //-->









<P><CENTER>

<a href="0255-0259.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="../ch19/0263-0266.html">Next</A>

</CENTER></P>



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



<P>Starting at the top, we start the build with the usual command. Immediately following

the command, RPM indicates that four packages are to be built from this spec file. The

%prep, %build, and %install scripts then execute as usual.

</P>



<P>Next, RPM executes its special doc internal script, even though we haven't declared any

files to be documentation. It's worth noting, however, that the

DOCDIR environment variables show that if the spec file

had declared some of the files as documentation, RPM would have

created the appropriate documentation directories for each of the packages.

</P>



<P>At this point, RPM creates the binary packages. As you can see, each package contains the

file defined in its %files list.

</P>



<P>Finally, the source package file is created. It contains the spec file and the original sources,

just like any other source package.

</P>



<P>One spec file. One set of sources. One build command. Four packages (five, if you count

the source package). All in all, a pretty good deal, isn't it?

</P>



<H4><A NAME="ch18_ 22">

18.6.1. Giving Subpackages the Once-Over

</A></H4>



<P>Let's take a look at our newly created packages.

As with any other package, each subpackage should be tested by being installed on a system that has not had that software installed

before. In this section, we'll point out how subpackages differ from their nonsubpackaged

counterparts.

</P>



<P>First, let's just look at each package's information:

</P>



<!-- CODE //-->

<PRE>

# rpm -qip foo-2.7-1.i386.rpm

Name          : foo                      Distribution: (none)

Version     : 2.7                            Vendor: (none)

Release     : 1                       Build Date: Wed Nov 06 13:33:37 1996

Install date: (none)                     Build Host: foonly.rpm.org

Group           : bogus/junque               Source RPM: foo-2.7-1.src.rpm

Size        : 35

Summary       : The foo app, and the baz library needed to build it

Description :

This is the long description of the foo app, and the baz library needed to

build it...





# rpm -qip foo-server-2.7-1.i386.rpm

Name          : foo-server               Distribution: (none)

Version     : 2.7                            Vendor: (none)

Release     : 1                          Build Date: Wed Nov 06 13:33:37 1996

Install date: (none)                         Build Host: foonly.rpm.org

Group           : bogus/junque               Source RPM: foo-2.7-1.src.rpm

Size        : 42

Summary       : The foo server

Description :

This is the long description for the foo server...





</PRE>

<!-- END CODE //-->



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



<!-- CODE //-->

<PRE>

# rpm -qip foo-client-2.7-1.i386.rpm

Name           : foo-client           Distribution: (none)

Version     : 2.7                        Vendor: (none)

Release     : 1                      Build Date: Wed Nov 06 13:33:37 1996

Install date: (none)                 Build Host: foonly.rpm.org

Group         : bogus/junque           Source RPM: foo-2.7-1.src.rpm

Size        : 42

Summary       : The foo client

Description :

This is the long description for the foo client...





# rpm -qip bazlib-5.6-1.i386.rpm

Name          : bazlib               Distribution: (none)

Version     : 5.6                        Vendor: (none)

Release     : 1                      Build Date: Wed Nov 06 13:33:37 1996

Install date: (none)                 Build Host: foonly.rpm.org

Group           : bogus/junque           Source RPM: foo-2.7-1.src.rpm

Size        : 38

Summary        : The baz library

Description :

This is the long description for the bazlib...

#

</PRE>

<!-- END CODE //-->



<P>Here we've used RPM's query capability to display a list of summary information for

each package. A few points are worth noting.

</P>



<P>First, each package lists foo-2.7-1.src.rpm as its source package file. This is the only way

to tell if two package files were created from the same set of sources. Trying to use a

package's name as an indicator is futile, as the

bazlib package shows us.

</P>



<P>The next thing to notice is that the summaries and

descriptions for each package are specific to that package. Since these tags were placed and named according to each package, this

should be no surprise.

</P>



<P>Finally, we can see that each package's version has been either inherited from the main

package's preamble or, as in the case of the

bazlib package, the main package's version has been

overridden by a version tag added to bazlib's preamble.

</P>



<P>If we look at the source package's information, we see that its information has been taken

entirely from the main package's set of tags:

</P>



<!-- CODE //-->

<PRE>

# rpm -qip foo-2.7-1.src.rpm

Name          : foo                     Distribution: (none)

Version     : 2.7                           Vendor: (none)

Release     : 1                         Build Date: Wed Nov 06 13:33:37 1996

Install date: (none)                    Build Host: foonly.rpm.org

Group         : bogus/junque              Source RPM: (none)

Size          : 1415

Summary         : The foo app, and the baz library needed to build it

Description   :

This is the long description of the foo app, and the baz library needed to

build   it...

#



</PRE>

<!-- END CODE //-->



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



<P>It's easy to see that if there were no %files list for the main package, and therefore, no

main package, the tags in the main preamble would still be used in the source package. This is

why RPM enforces the requirement that the main preamble contain

copyright, %description, and group tags. So, here's a word to the wise: Don't put something stupid in the main

preamble's %description just to satisfy RPM. Your witty saying will be immortalized for all time in

every source package you distribute. (Yes, the author found out about this the hard way!)

</P>



<H4><A NAME="ch18_ 23">

18.6.1.1. Verifying Subpackage-Specific Install and Erase Scripts

</A></H4>



<P>The easiest way to verify that the %pre scripts we defined for each package were actually used

is to simply install each package:

</P>



<!-- CODE //-->

<PRE>

# rpm -Uvh foo-2.7-1.i386.rpm

foo                    This is the foo package preinstall script

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





# rpm -Uvh foo-server-2.7-1.i386.rpm

foo-server             This is the foo-server subpackage preinstall script

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





# rpm -Uvh foo-client-2.7-1.i386.rpm

foo-client             This is the foo-client subpackage preinstall script

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





# rpm -Uvh bazlib-5.6-1.i386.rpm

bazlib                 This is the bazlib subpackage preinstall script

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

#

</PRE>

<!-- END CODE //-->



<P>As expected, the unique %pre script for each package has been included. Of course, if we

hadn't wanted to actually install the packages, we could have used RPM's

--scripts option to display the scripts:

</P>



<!-- CODE //-->

<PRE>

# rpm -qp --scripts foo-2.7-1.i386.rpm

preinstall script:

echo &quot;This is the foo-server subpackage preinstall script&quot;



postinstall   script:

(none)

preuninstall   script:

(none)

postuninstall   script:

(none)

verify script:

(none)

#

</PRE>

<!-- END CODE //-->



<P>This approach might be a bit safer, particularly if installing the newly built package would

disrupt operations on your build system.

</P>



<P><CENTER>

<a href="0255-0259.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="../ch19/0263-0266.html">Next</A>

</CENTER></P>











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

<!-- begin footer information -->







</body></html>

⌨️ 快捷键说明

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