From: Sebastian Luther Date: Fri, 23 Jul 2010 10:56:55 +0000 (+0200) Subject: portage.sets: Add support for atoms with wildcards X-Git-Tag: v2.2_rc68~473 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a58133d4682fe5fc6d2596d9e48fb3fbb6eb926d;p=portage.git portage.sets: Add support for atoms with wildcards --- diff --git a/pym/portage/sets/base.py b/pym/portage/sets/base.py index 56f9df4ed..108dda3ec 100644 --- a/pym/portage/sets/base.py +++ b/pym/portage/sets/base.py @@ -4,7 +4,7 @@ import sys from portage.dep import Atom, best_match_to_list, match_from_list from portage.exception import InvalidAtom -from portage.versions import cpv_getkey +from portage.versions import catsplit, cpv_getkey if sys.hexversion >= 0x3000000: basestring = str @@ -76,7 +76,7 @@ class PackageSet(object): if not a: continue try: - a = Atom(a) + a = Atom(a, allow_wildcard=True) except InvalidAtom: self._nonatoms.add(a) continue @@ -126,7 +126,7 @@ class PackageSet(object): if atom.cp == pkg.cp: rev_transform[atom] = atom else: - rev_transform[Atom(atom.replace(atom.cp, pkg.cp, 1))] = atom + rev_transform[Atom(atom.replace(atom.cp, pkg.cp, 1), allow_wildcard=True)] = atom best_match = best_match_to_list(pkg, iter(rev_transform)) if best_match: return rev_transform[best_match] @@ -140,8 +140,15 @@ class PackageSet(object): """ cpv_slot_list = [pkg] cp = cpv_getkey(pkg.cpv) + c, p = catsplit(cp) self._load() # make sure the atoms are loaded - atoms = self._atommap.get(cp) + + atoms = set() + atoms.update(self._atommap.get("*/*", set())) + atoms.update(self._atommap.get(c+"/*", set())) + atoms.update(self._atommap.get("*/"+p, set())) + atoms.update(self._atommap.get(cp, set())) + if atoms: for atom in atoms: if match_from_list(atom, cpv_slot_list): @@ -171,7 +178,7 @@ class EditablePackageSet(PackageSet): for a in atoms: if not isinstance(a, Atom): try: - a = Atom(a) + a = Atom(a, allow_wildcard=True) except InvalidAtom: modified = True self._nonatoms.add(a)