Given the lack of mutual dependencies, which is guaranteed, the following algorithm will yield the minimal set:
- for each package in the list, list all of its requirements (
rpm -qR foo)
- for each package in the requirements, remove it from the list if it’s present
foo’s requirements yields
baz (presumably among others), and listing
baz’s requirements yields
quux, so both can be dropped. Note that you must list all requirements before removing anything, otherwise you risk keeping transitive requirements (
quux in this case, if you remove
baz as soon as
foo is processed).
However your package list should reflect your dependencies, not the minimal set which results in your dependencies being installed. If you need
quux, you should list it in your
yum install command, otherwise if
baz stops depending on it at some point, your installation will stop meeting your requirements.