initCommon(); $template->displayHeader(); ?>

14.5. Examining RPM Files

When you work with a lot of RPM files, you’ll find that you run the same commands over and over again for each new package you get. For example, you may want to see what capabilities a package requires. You can type in the rpm command each time, or write a short shell script with the necessary command-line options. Listing 15-2 shows this script.

Listing 15-2: rpmdepend

#!/bin/sh

rpm -qp --requires $*

This script expects the name of an RPM package file. Run the command as follows:

$ rpmdepend vim-common-6.1-14.i386.rpm

rpmlib(PayloadFilesHavePrefix) <= 4.0-1

rpmlib(CompressedFileNames) <= 3.0.4-1

/bin/sh

/usr/bin/awk

libc.so.6

libc.so.6(GLIBC_2.0)

libc.so.6(GLIBC_2.1)

Another common task I perform involves listing all the files in an RPM along with the descriptive information on the package. This can really help, since so many Linux packages have nondescriptive names such as dia and anaconda.

Listing 15-3 shows the rpminfo script.

Listing 15-3: rpminfo

#!/bin/sh

rpm -qilp $* | less

This script lists a potentially long set of lines, so the script pipes the output to the less command. For example:

$ ./rpminfo perl-XML-Dumper-0.4-22.noarch.rpm

Name : perl-XML-Dumper Relocations: /usr

Version : 0.4 Vendor: Red Hat, Inc.

Release : 22 Build Date: Tue 06 Aug 2002 01:53:30 PM CDT

Install date: (not installed) Build Host: vegeta.devel.redhat.com

Group : System Environment/Libraries Source RPM: perl-XML-Dumper-0.4-22.src.rpm

Size : 10015 License: GPL

Signature : DSA/SHA1, Tue 06 Aug 2002 02:11:39 PM CDT, Key ID fd372689897da07a

Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>

URL : http://www.cpan.org

Summary : Perl module for dumping Perl objects from/to XML

Description :

XML::Dumper dumps Perl data to XML format. XML::Dumper can also read

XML data that was previously dumped by the module and convert it back

to Perl. Perl objects are blessed back to their original packaging;

if the modules are installed on the system where the perl objects are

reconstituted from xml, they will behave as expected. Intuitively, if

the perl objects are converted and reconstituted in the same

environment, all should be well.

/usr/lib/perl5/vendor_perl/5.8.0/XML/Dumper.pm

/usr/share/man/man3/XML::Dumper.3pm.gz

I use this script so that I know what files a package wants to install.

displayFooter('$Date: 2005/11/02 19:30:06 $'); ?>