From: Zac Medico Date: Fri, 26 Oct 2007 05:18:38 +0000 (-0000) Subject: Allow sets to get through world file validation and X-Git-Tag: v2.2_pre1~503 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0c140401072f7dba238b0cbe6c347d5109b01b2d;p=portage.git Allow sets to get through world file validation and expand properly. It's now possible to put @system in the world file and get the old behavior where world includes system. svn path=/main/trunk/; revision=8307 --- diff --git a/pym/portage/sets/__init__.py b/pym/portage/sets/__init__.py index 315747f10..9f562820b 100644 --- a/pym/portage/sets/__init__.py +++ b/pym/portage/sets/__init__.py @@ -101,7 +101,7 @@ class SetConfig(SafeConfigParser): for n in myset.getNonAtoms(): if n[0] == SETPREFIX and n[1:] in self.aliases: if n[1:] not in ignorelist: - myatoms.update(self.getSetAtoms(n), ignorelist=ignorelist) + myatoms.update(self.getSetAtoms(n[1:])) return myatoms def make_default_config(settings, trees): diff --git a/pym/portage/sets/files.py b/pym/portage/sets/files.py index f0dfd78e2..010966c2a 100644 --- a/pym/portage/sets/files.py +++ b/pym/portage/sets/files.py @@ -4,13 +4,14 @@ import errno import os +from itertools import chain from portage.util import grabfile, write_atomic, ensure_dirs from portage.const import PRIVATE_PATH, USER_CONFIG_PATH from portage.locks import lockfile, unlockfile from portage import portage_gid from portage.sets.base import PackageSet, EditablePackageSet -from portage.sets import SetConfigError +from portage.sets import SetConfigError, SETPREFIX from portage.env.loaders import ItemFileLoader, KeyListFileLoader from portage.env.validators import ValidAtomValidator from portage import dep_getkey, cpv_getkey @@ -25,7 +26,7 @@ class StaticFileSet(EditablePackageSet): self._filename = filename self._mtime = None self.description = "Package set loaded from file %s" % self._filename - self.loader = ItemFileLoader(self._filename, ValidAtomValidator) + self.loader = ItemFileLoader(self._filename, self._validate) metadata = grabfile(self._filename + ".metadata") key = None @@ -45,9 +46,13 @@ class StaticFileSet(EditablePackageSet): else: if key != None: setattr(self, key, " ".join(value)) - + + def _validate(self, atom): + return ValidAtomValidator(atom) + def write(self): - write_atomic(self._filename, "\n".join(sorted(self._atoms))+"\n") + write_atomic(self._filename, "\n".join(sorted( + chain(self._atoms, self._nonatoms)))+"\n") def load(self): try: @@ -127,6 +132,11 @@ class WorldSet(StaticFileSet): super(WorldSet, self).__init__(os.path.join(os.sep, root, PRIVATE_PATH.lstrip(os.sep), "world")) self._lock = None + def _validate(self, atom): + if atom.startswith(SETPREFIX): + return True + return ValidAtomValidator(atom) + def _ensure_dirs(self): ensure_dirs(os.path.dirname(self._filename), gid=portage_gid, mode=02750, mask=02)