Working with RPMS
Commands of Note
What rpm owns a file?
rpm -qf /path/to/file
What files are in an rpm?
rpm -ql packagename
tell me about an rpm file ( *.rpm )
rpm -qip software.1.2.3-5.rpm
tell me what an rpm requires:
rpm -qR mypackage
Show in what order rpms were installed:
rpm -qa --last
or
rpm -qa -last
Is a package ok (V for verify)?
rpm -V packagename
No output? then the rpm is intact. If you get output then it's worthwhile checking out the man page and skipping down to: "VERIFY OPTIONS" ( /VERIFY OPTIONS in man ).
two packages with the same name version and release? check their md5s:
rpm -q --qf "%{NAME} %{SIGMD5}\n" perl-XML-LibXML-1.52-1
Note that rpm 4.0.X does not understand the %{SIGMD5} tag, use rpm 4.1.X or greater (ftp1 has the old version as of this writing).
Get a list of files in an RPM including timestamps and MD5 sums
rpm --dump -q packagename
To list rpms by size:
rpm -q -a --qf "%-30{NAME}\t%-10{VERSION}\t%-30{size}\n" | sort -rn -k 3
To get a list of rpms with Version and Release data in separate columns ( useful for futher processing):
rpm -q -a --qf "%-30{NAME}\t%-10{VERSION}\t%{RELEASE}\n"
What architecture is the rpm for?
rpm -q -a --qf "%-30{NAME}\t%-10{VERSION}\t%{RELEASE}\t%{ARCH}\n"
Making rpms
Prereq this OR that
Suppose you are composing a package that could use functions from ntp or xntp. you can't put ntp OR xntp in the Prereqs but you can put a file shared by both in the prereqs. In the ntp example /usr/sbin/ntpq. ( thanks to Terry Hurcombe for that nugget )