Some kind of brute force is unavoidable, since even a very restricted form of this problem is NP-complete.
Specifically, even if the dependency list for all but one of the packages consists of only terms connected by OR, we can trivially reduce the NP-complete Hitting Set problem to it. Suppose we have an instance of Hitting Set, with X the ground set containing elements x_1, ..., x_n, and S the set of k subsets S_1, ..., S_k of X, with S_i \subseteq X for each i, that we want to hit: then for every element x_i in the ground set X, make a package x_i with no dependencies, and for every set S_j \subseteq X, make a package s_j that has as its dependencies all the packages x_k \in S_j, connected by OR operators. Finally make one more "root" package r that has as its dependencies the k packages s_1, ..., s_k, connected by AND. Now, finding minimum_set(r)
will find a minimum-size hitting set for the original HS problem -- these are the ground set elements that correspond to the subset of packages x_i that are chosen for installation. So if you can somehow implement minimum_set()
in polynomial time, you've solved Hitting Set, and every other NP-complete problem, in polynomial time.