Remove support for 'extend', 'remove', and 'intersect' sets.conf section
authorZac Medico <zmedico@gentoo.org>
Mon, 19 Oct 2009 03:43:21 +0000 (03:43 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 19 Oct 2009 03:43:21 +0000 (03:43 -0000)
attributes in SetConfig.getSetAtoms() since the current implementation does
not meet user expectations, as mentioned in bug #253802, comment #5:

Package set operators currently operate on atoms, but what users really need
is for them to operate on the packages themselves. This will allow one set to
add or subtract packages from another even though the sets to not use the exact
same atoms to refer to the given packages.

I imagine the way this should be done is to create a mapping of atom -> package
for each set, perform the intersection using the packages, and then map the
package intersection back into a set of atoms. (trunk r14679)

svn path=/main/branches/2.1.7/; revision=14690

pym/portage/_sets/__init__.py

index 3baa6f4cb782ac21fe7dee77007622fef2ed8d9e..a4581cd43ad91acd260459c667eb4d07b5079233 100644 (file)
@@ -172,44 +172,21 @@ class SetConfig(object):
                        raise PackageSetNotFound(setname)
                myatoms = myset.getAtoms()
                parser = self._parser
-               extend = set()
-               remove = set()
-               intersect = set()
-               
+
                if ignorelist is None:
                        ignorelist = set()
 
-               # If sets.conf is corrupt then emerge generates
-               # fallback sets without the 'creator' attribute.
-               if setname not in ignorelist and hasattr(myset, 'creator'):
-                       if parser.has_option(myset.creator, "extend"):
-                               extend.update(parser.get(myset.creator, "extend").split())
-                       if parser.has_option(myset.creator, "remove"):
-                               remove.update(parser.get(myset.creator, "remove").split())
-                       if parser.has_option(myset.creator, "intersect"):
-                               intersect.update(parser.get(myset.creator, "intersect").split())
-                                               
                ignorelist.add(setname)
                for n in myset.getNonAtoms():
                        if n.startswith(SETPREFIX):
                                s = n[len(SETPREFIX):]
                                if s in self.psets:
-                                       extend.add(n[len(SETPREFIX):])
+                                       if s not in ignorelist:
+                                               myatoms.update(self.getSetAtoms(s,
+                                                       ignorelist=ignorelist))
                                else:
                                        raise PackageSetNotFound(s)
 
-               for s in ignorelist:
-                       extend.discard(s)
-                       remove.discard(s)
-                       intersect.discard(s)
-               
-               for s in extend:
-                       myatoms.update(self.getSetAtoms(s, ignorelist=ignorelist))
-               for s in remove:
-                       myatoms.difference_update(self.getSetAtoms(s, ignorelist=ignorelist))
-               for s in intersect:
-                       myatoms.intersection_update(self.getSetAtoms(s, ignorelist=ignorelist))
-
                return myatoms
 
 def load_default_config(settings, trees):