rpmprune - Remove unneeded files from a list of RPM package files
rpmprune [ --newer ] [ --older ] [ --equal ] [ --uninst ] [ --invert ] filelist ...
The rpmprune tool is a simple example of using some of the RPM Perl bindings.
With rpm version 3 and newer, multiple files given on the command-line for an install, uninstall or update command are treated as a single transaction. If any of the files in the set cannot be acted upon, the whole transaction must be rejected. This is inconvenient for casual package upgrades where a directory may have many rpm files, some of which are already installed. A command of:
rpm -Uhv *.rpm
would fail, as one (or more) files in the set is already installed. This can lead to careless use of options such as
In the simplest usage, this tool eases that situation by allowing:
rpm -Uhv `rpmprune *.rpm`
When the back-ticks are evaluated, rpmprune has only echoed the names of those files that are either newer than their installed counterparts, or are not installed at all.
For maximum flexibility, rpmprune supports more options than anyone will realistically put to use:
Print a summary of the options and general usage.
- --newer (--nonewer)
If selected, all files that are newer than their installed counterparts will be echoed. Prefix with "no" to suppress the printing of these.
- --older (--noolder)
If selected, all files that are older than their installed counterparts will be echoed. Prefix with "no" to suppress them, instead.
- --equal (--noequal)
If selected, all files that are the same version as their installed counterparts will be echoed. Prefix with "no" to suppress them, instead.
- --uninst (--nouninst)
If selected, all files that are for packages not currently installed on the system will be echoed. Prefix with "no" to suppress them, instead.
Invert the logic of all four of the previous selectors.
Without any arguments, rpmprune acts as if the following were the command line:
rpmprune --newer --noolder --noequal --uninst ...
--invert option is applied last, after all others have been processed.
Randy J. Ray <email@example.com>