1

Suppose I have a list of packages I want to install:

# yum install foo bar baz quux

but suppose that baz is a dependency of foo, and quux is a dependency of baz.

So, really, all I actually needed to run was:

# yum install foo bar

Is there a way, given a list of packages, to determine that minimal set?

3

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

Listing 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.