diff options
author | Sebastian Luther <SebastianLuther@gmx.de> | 2010-07-27 10:55:46 +0200 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-07-27 12:01:23 -0700 |
commit | ce5f914de66f8d6b658ad8585c482340b775a3db (patch) | |
tree | ffd2940f58d8476337e71b8d61a8a636584c5465 | |
parent | addd9a9b6027260bfbde35efc5408b5efe5341d6 (diff) | |
download | portage-ce5f914de66f8d6b658ad8585c482340b775a3db.tar.gz portage-ce5f914de66f8d6b658ad8585c482340b775a3db.tar.bz2 portage-ce5f914de66f8d6b658ad8585c482340b775a3db.zip |
portage.sets: Don't allow extended atoms unless explicitly told to
-rw-r--r-- | pym/_emerge/depgraph.py | 2 | ||||
-rw-r--r-- | pym/portage/sets/base.py | 16 |
2 files changed, 13 insertions, 5 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 361a767c1..1c40088ae 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -94,7 +94,7 @@ class _frozen_depgraph_config(object): self._required_set_names = set(["world"]) - self.excluded_pkgs = InternalPackageSet() + self.excluded_pkgs = InternalPackageSet(allow_wildcard=True) for x in ' '.join(myopts.get("--exclude", [])).split(): try: x = Atom(x, allow_wildcard=True) diff --git a/pym/portage/sets/base.py b/pym/portage/sets/base.py index 33850574d..f54c5436f 100644 --- a/pym/portage/sets/base.py +++ b/pym/portage/sets/base.py @@ -66,7 +66,7 @@ class PackageSet(object): self._load() return self._nonatoms.copy() - def _setAtoms(self, atoms): + def _setAtoms(self, atoms, allow_wildcard=False): self._atoms.clear() self._nonatoms.clear() for a in atoms: @@ -80,6 +80,8 @@ class PackageSet(object): except InvalidAtom: self._nonatoms.add(a) continue + if not allow_wildcard and a.extended_syntax: + raise InvalidAtom("extended atom syntax not allowed here") self._atoms.add(a) self._updateAtomMap() @@ -164,6 +166,10 @@ class PackageSet(object): class EditablePackageSet(PackageSet): + def __init__(self, allow_wildcard=False): + super(EditablePackageSet, self).__init__() + self._allow_wildcard = allow_wildcard + def update(self, atoms): self._load() modified = False @@ -176,6 +182,8 @@ class EditablePackageSet(PackageSet): modified = True self._nonatoms.add(a) continue + if not self._allow_wildcard and a.extended_syntax: + raise InvalidAtom("extended atom syntax not allowed here") normal_atoms.append(a) if normal_atoms: @@ -189,7 +197,7 @@ class EditablePackageSet(PackageSet): self.update([atom]) def replace(self, atoms): - self._setAtoms(atoms) + self._setAtoms(atoms, allow_wildcard=self._allow_wildcard) self.write() def remove(self, atom): @@ -211,8 +219,8 @@ class EditablePackageSet(PackageSet): raise NotImplementedError() class InternalPackageSet(EditablePackageSet): - def __init__(self, initial_atoms=None): - super(InternalPackageSet, self).__init__() + def __init__(self, initial_atoms=None, allow_wildcard=False): + super(InternalPackageSet, self).__init__(allow_wildcard=allow_wildcard) if initial_atoms != None: self.update(initial_atoms) |