From 8d2dd63139cb96dacfcce6c49bf19a20f7ef6ee4 Mon Sep 17 00:00:00 2001 From: Marius Mauch Date: Fri, 2 May 2008 03:24:30 +0000 Subject: [PATCH] check if a given package set is defined more than once svn path=/main/trunk/; revision=10075 --- pym/portage/sets/__init__.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pym/portage/sets/__init__.py b/pym/portage/sets/__init__.py index 476aea4ca..554b534bc 100644 --- a/pym/portage/sets/__init__.py +++ b/pym/portage/sets/__init__.py @@ -32,7 +32,6 @@ class SetConfig(SafeConfigParser): self.settings = settings self._parsed = False self.active = [] - self.aliases = {} def _parse(self): if self._parsed: @@ -58,11 +57,17 @@ class SetConfig(SafeConfigParser): # create single or multiple instances of the given class depending on configuration if self.has_option(sname, "multiset") and self.getboolean(sname, "multiset"): if hasattr(setclass, "multiBuilder"): + newsets = {} try: - self.psets.update(setclass.multiBuilder(optdict, self.settings, self.trees)) + newsets = setclass.multiBuilder(optdict, self.settings, self.trees) except SetConfigError, e: self.errors.append("Configuration error in section '%s': %s" % (sname, str(e))) continue + for x in newsets: + if x in self.psets: + self.errors.append("Redefinition of set '%s' (sections: '%s', '%s')" % (setname, self.psets[setname].creator, sname)) + newsets[x].creator = sname + self.psets.update(newsets) else: self.errors.append("Section '%s' is configured as multiset, but '%s' doesn't support that configuration" % (sname, classname)) continue @@ -71,9 +76,12 @@ class SetConfig(SafeConfigParser): setname = self.get(sname, "name") except NoOptionError: setname = sname + if setname in self.psets: + self.errors.append("Redefinition of set '%s' (sections: '%s', '%s')" % (setname, self.psets[setname].creator, sname)) if hasattr(setclass, "singleBuilder"): try: self.psets[setname] = setclass.singleBuilder(optdict, self.settings, self.trees) + self.psets[setname].creator = sname except SetConfigError, e: self.errors.append("Configuration error in section '%s': %s" % (sname, str(e))) continue -- 2.26.2