From e034824845a7de8ee5f7970eb9e07ed4dac28609 Mon Sep 17 00:00:00 2001 From: Marius Mauch Date: Tue, 23 Oct 2007 20:58:13 +0000 Subject: revert r8256 (plans changed) svn path=/main/trunk/; revision=8258 --- pym/portage/sets/__init__.py | 4 ++-- pym/portage/sets/dbapi.py | 28 ++++++++++++++-------------- pym/portage/sets/files.py | 18 ++++++++---------- pym/portage/sets/profiles.py | 4 ++-- pym/portage/sets/security.py | 5 ++--- pym/portage/sets/shell.py | 2 +- 6 files changed, 29 insertions(+), 32 deletions(-) diff --git a/pym/portage/sets/__init__.py b/pym/portage/sets/__init__.py index 1802e6741..b757c43c4 100644 --- a/pym/portage/sets/__init__.py +++ b/pym/portage/sets/__init__.py @@ -50,7 +50,7 @@ class SetConfig(SafeConfigParser): if self.has_option(sname, "multiset") and self.getboolean(sname, "multiset"): if hasattr(setclass, "multiBuilder"): try: - self.psets.update(setclass.multiBuilder(optdict, self)) + self.psets.update(setclass.multiBuilder(optdict, self.settings, self.trees)) except SetConfigError, e: self.errors.append("Configuration error in section '%s': %s" % (sname, str(e))) continue @@ -64,7 +64,7 @@ class SetConfig(SafeConfigParser): setname = "sets/"+sname if hasattr(setclass, "singleBuilder"): try: - self.psets[setname] = setclass.singleBuilder(optdict, self) + self.psets[setname] = setclass.singleBuilder(optdict, self.settings, self.trees) except SetConfigError, e: self.errors.append("Configuration error in section '%s': %s" % (sname, str(e))) continue diff --git a/pym/portage/sets/dbapi.py b/pym/portage/sets/dbapi.py index ca481705d..a1b902fdc 100644 --- a/pym/portage/sets/dbapi.py +++ b/pym/portage/sets/dbapi.py @@ -31,8 +31,8 @@ class EverythingSet(PackageSet): myatoms.append(cp) self._setAtoms(myatoms) - def singleBuilder(self, options, setconfig): - return EverythingSet(setconfig.trees["vartree"].dbapi) + def singleBuilder(self, options, settings, trees): + return EverythingSet(trees["vartree"].dbapi) singleBuilder = classmethod(singleBuilder) class CategorySet(PackageSet): @@ -71,7 +71,7 @@ class CategorySet(PackageSet): return bool(visible in ["1", "yes", "true", "on"]) _builderGetVisible = classmethod(_builderGetVisible) - def singleBuilder(cls, options, setconfig): + def singleBuilder(cls, options, settings, trees): if not "category" in options: raise SetConfigError("no category given") @@ -79,24 +79,24 @@ class CategorySet(PackageSet): if not category in categories: raise SetConfigError("invalid category name '%s'" % category) - repository = cls._builderGetRepository(options, setconfig.trees.keys()) + repository = cls._builderGetRepository(options, trees.keys()) visible = cls._builderGetVisible(options) - return CategorySet(category, dbapi=setconfig.trees[repository].dbapi, only_visible=visible) + return CategorySet(category, dbapi=trees[repository].dbapi, only_visible=visible) singleBuilder = classmethod(singleBuilder) - def multiBuilder(cls, options, setconfig): + def multiBuilder(cls, options, settings, trees): rValue = {} if "categories" in options: categories = options["categories"].split() - invalid = set(categories).difference(setconfig.settings.categories) + invalid = set(categories).difference(settings.categories) if invalid: raise SetConfigError("invalid categories: %s" % ", ".join(list(invalid))) else: - categories = setconfig.settings.categories + categories = settings.categories - repository = cls._builderGetRepository(options, setconfig.trees.keys()) + repository = cls._builderGetRepository(options, trees.keys()) visible = cls._builderGetVisible(options) name_pattern = options.get("name_pattern", "$category/*") @@ -104,7 +104,7 @@ class CategorySet(PackageSet): raise SetConfigError("name_pattern doesn't include $category placeholder") for cat in categories: - myset = CategorySet(cat, setconfig.trees[repository].dbapi, only_visible=visible) + myset = CategorySet(cat, trees[repository].dbapi, only_visible=visible) myname = name_pattern.replace("$category", cat) myname = myname.replace("${category}", cat) rValue[myname] = myset @@ -147,8 +147,8 @@ class PreservedLibraryConsumerSet(LibraryConsumerSet): return self._setAtoms(self.mapPathsToAtoms(consumers)) - def singleBuilder(cls, options, setconfig): - return PreservedLibraryConsumerSet(setconfig.trees["vartree"].dbapi) + def singleBuilder(cls, options, settings, trees): + return PreservedLibraryConsumerSet(trees["vartree"].dbapi) singleBuilder = classmethod(singleBuilder) class MissingLibraryConsumerSet(LibraryConsumerSet): @@ -173,10 +173,10 @@ class MissingLibraryConsumerSet(LibraryConsumerSet): return self._setAtoms(self.mapPathsToAtoms(consumers)) - def singleBuilder(cls, options, setconfig): + def singleBuilder(cls, options, settings, trees): if options.get("debug", "true").lower() in ["true", "on", "1", "yes"]: debug = True else: debug = False - return MissingLibraryConsumerSet(setconfig.trees["vartree"].dbapi, debug=debug) + return MissingLibraryConsumerSet(trees["vartree"].dbapi, debug=debug) singleBuilder = classmethod(singleBuilder) diff --git a/pym/portage/sets/files.py b/pym/portage/sets/files.py index 55b5714c3..f0dfd78e2 100644 --- a/pym/portage/sets/files.py +++ b/pym/portage/sets/files.py @@ -68,16 +68,15 @@ class StaticFileSet(EditablePackageSet): self._setAtoms(data.keys()) self._mtime = mtime - def singleBuilder(self, options, setconfig): + def singleBuilder(self, options, settings, trees): if not "filename" in options: raise SetConfigError("no filename specified") return ConfigFileSet(options[filename]) singleBuilder = classmethod(singleBuilder) - def multiBuilder(self, options, setconfig): + def multiBuilder(self, options, settings, trees): rValue = {} - directory = options.get("directory", \ - os.path.join(setconfig.settings["PORTAGE_CONFIGROOT"], USER_CONFIG_PATH.lstrip(os.sep), "sets")) + directory = options.get("directory", os.path.join(settings["PORTAGE_CONFIGROOT"], USER_CONFIG_PATH.lstrip(os.sep), "sets")) name_pattern = options.get("name_pattern", "sets/$name") if not "$name" in name_pattern and not "${name}" in name_pattern: raise SetConfigError("name_pattern doesn't include $name placeholder") @@ -102,16 +101,15 @@ class ConfigFileSet(PackageSet): data, errors = self.loader.load() self._setAtoms(data.keys()) - def singleBuilder(self, options, setconfig): + def singleBuilder(self, options, settings, trees): if not "filename" in options: raise SetConfigError("no filename specified") return ConfigFileSet(options[filename]) singleBuilder = classmethod(singleBuilder) - def multiBuilder(self, options, setconfig): + def multiBuilder(self, options, settings, trees): rValue = {} - directory = options.get("directory", \ - os.path.join(setconfig.settings["PORTAGE_CONFIGROOT"], USER_CONFIG_PATH.lstrip(os.sep))) + directory = options.get("directory", os.path.join(settings["PORTAGE_CONFIGROOT"], USER_CONFIG_PATH.lstrip(os.sep))) name_pattern = options.get("name_pattern", "sets/package_$suffix") if not "$suffix" in name_pattern and not "${suffix}" in name_pattern: raise SetConfigError("name_pattern doesn't include $suffix placeholder") @@ -164,6 +162,6 @@ class WorldSet(StaticFileSet): self.replace(newworldlist) self.unlock() - def singleBuilder(self, options, setconfig): - return WorldSet(setconfig.settings["ROOT"]) + def singleBuilder(self, options, settings, trees): + return WorldSet(settings["ROOT"]) singleBuilder = classmethod(singleBuilder) diff --git a/pym/portage/sets/profiles.py b/pym/portage/sets/profiles.py index b7555c7a5..35cf4d87d 100644 --- a/pym/portage/sets/profiles.py +++ b/pym/portage/sets/profiles.py @@ -21,6 +21,6 @@ class PackagesSystemSet(PackageSet): mylist = stack_lists(mylist, incremental=1) self._setAtoms([x[1:] for x in mylist if x[0] == "*"]) - def singleBuilder(self, options, setconfig): - return PackagesSystemSet(setconfig.settings.profiles) + def singleBuilder(self, options, settings, trees): + return PackagesSystemSet(settings.profiles) singleBuilder = classmethod(singleBuilder) diff --git a/pym/portage/sets/security.py b/pym/portage/sets/security.py index ff55ea508..b53326990 100644 --- a/pym/portage/sets/security.py +++ b/pym/portage/sets/security.py @@ -55,14 +55,13 @@ class SecuritySet(PackageSet): applied_list.append(glsaid) write_atomic(self._checkfile, "\n".join(applied_list)) - def singleBuilder(cls, options, setconfig): + def singleBuilder(cls, options, settings, trees): if "use_emerge_resoler" in options \ and options.get("use_emerge_resolver").lower() in ["1", "yes", "true", "on"]: least_change = False else: least_change = True - return cls(setconfig.settings, setconfig.trees["vartree"].dbapi, \ - setconfig.trees["porttree"].dbapi, least_change=least_change) + return cls(settings, trees["vartree"].dbapi, trees["porttree"].dbapi, least_change=least_change) singleBuilder = classmethod(singleBuilder) class NewGlsaSet(SecuritySet): diff --git a/pym/portage/sets/shell.py b/pym/portage/sets/shell.py index 769673485..cae28fa46 100644 --- a/pym/portage/sets/shell.py +++ b/pym/portage/sets/shell.py @@ -36,7 +36,7 @@ class CommandOutputSet(PackageSet): text = pipe.stdout.read() self._setAtoms(text.split("\n")) - def singleBuilder(self, options, setconfig): + def singleBuilder(self, options, settings, trees): if not command in options: raise SetConfigError("no command specified") return CommandOutputSet(options["command"]) -- cgit v1.2.3-1-g7c22