diff options
-rw-r--r-- | pym/portage/__init__.py | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index c10749368..89840231e 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -1869,9 +1869,15 @@ class config(object): defaults.append(self.make_defaults_use[i]) cpdict = self.pkgprofileuse[i].get(cp, None) if cpdict: - best_match = best_match_to_list(cpv_slot, cpdict.keys()) - if best_match: - defaults.append(cpdict[best_match]) + keys = cpdict.keys() + while keys: + bestmatch = best_match_to_list(cpv_slot, keys) + if bestmatch: + keys.remove(bestmatch) + defaults.append(cpdict[bestmatch]) + else: + break + del keys defaults = " ".join(defaults) if defaults != self.configdict["defaults"].get("USE",""): self.configdict["defaults"]["USE"] = defaults @@ -1881,9 +1887,15 @@ class config(object): useforce.append(self.useforce_list[i]) cpdict = self.puseforce_list[i].get(cp, None) if cpdict: - best_match = best_match_to_list(cpv_slot, cpdict.keys()) - if best_match: - useforce.append(cpdict[best_match]) + keys = cpdict.keys() + while keys: + best_match = best_match_to_list(cpv_slot, keys) + if best_match: + keys.remove(best_match) + useforce.append(cpdict[best_match]) + else: + break + del keys useforce = set(stack_lists(useforce, incremental=True)) if useforce != self.useforce: self.useforce = useforce @@ -1893,9 +1905,15 @@ class config(object): usemask.append(self.usemask_list[i]) cpdict = self.pusemask_list[i].get(cp, None) if cpdict: - best_match = best_match_to_list(cpv_slot, cpdict.keys()) - if best_match: - usemask.append(cpdict[best_match]) + keys = cpdict.keys() + while keys: + best_match = best_match_to_list(cpv_slot, cpdict.keys()) + if best_match: + keys.remove(best_match) + usemask.append(cpdict[best_match]) + else: + break + del keys usemask = set(stack_lists(usemask, incremental=True)) if usemask != self.usemask: self.usemask = usemask |