[Rpm-maint] How to get RPM requires quickly
Richard W.M. Jones
rjones at redhat.com
Sat Sep 13 13:13:53 UTC 2014
We have a program[1] that needs to take a list of installed RPM
package names, and quickly generate all of the installed dependencies
(recursively).
*Note* this is NOT a question about yum/dnf/zypper/etc depsolving.
It's about doing 'rpm -qR' quickly on installed packages only.
At the moment we run the following command:
rpm -qR <current set of packages> |
awk '{print $1}' |
xargs rpm -q --qf '%%{name}\n' --whatprovides |
grep -v 'no package provides' |
sort -u
The output is added to the current set, and we repeat the process
until the set of packages reaches a fixpoint.
To give you an idea, on a typical starting set this takes around 20 seconds,
which is over half the total running time of the program.
Does anyone have any suggestions about how to do this more quickly
and/or cleverly? Maybe using rpmlib (which unfortunately seems to
lack any documentation)?
Rich.
[1] https://github.com/libguestfs/supermin/blob/master/src/rpm.ml#L227
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html
More information about the Rpm-maint
mailing list