--exclude: Add support for atoms with wildcards
authorSebastian Luther <SebastianLuther@gmx.de>
Fri, 23 Jul 2010 11:05:42 +0000 (13:05 +0200)
committerZac Medico <zmedico@gentoo.org>
Fri, 23 Jul 2010 16:47:13 +0000 (09:47 -0700)
pym/_emerge/depgraph.py
pym/_emerge/main.py

index 8931bd9f0cbd12955310b456b78f7327850d9e41..361a767c1a1ebf5f856584e9fa55cb368f1ed1d4 100644 (file)
@@ -97,23 +97,10 @@ class _frozen_depgraph_config(object):
                self.excluded_pkgs = InternalPackageSet()
                for x in ' '.join(myopts.get("--exclude", [])).split():
                        try:
-                               x = Atom(x)
+                               x = Atom(x, allow_wildcard=True)
                        except portage.exception.InvalidAtom:
-                               x = Atom("null/" + x)
-                       cat = x.cp.split("/")[0]
-                       if cat == "null":
-                               pkgname = x.cp.split("/")[1]
-                               for myroot in trees:
-                                       for tree in ("porttree", "bintree"):
-                                               if tree == "bintree" and not "--usepkg" in myopts:
-                                                       continue
-                                               db = self.trees[myroot][tree].dbapi
-                                               for cat in db.categories:
-                                                       if db.cp_list(cat + "/" + pkgname):
-                                                               atom = portage.dep.Atom(str(x).replace("null", cat))
-                                                               self.excluded_pkgs.add(atom)
-                       else:
-                               self.excluded_pkgs.add(x)
+                               x = Atom("*/" + x, allow_wildcard=True)
+                       self.excluded_pkgs.add(x)
 
 
 class _dynamic_depgraph_config(object):
index 9e91ee9e49efe15129d18567f17374561c058c8b..4e621d21eb0be5d4e7896f0f36b32fb808625f1d 100644 (file)
@@ -744,10 +744,10 @@ def parse_opts(tmpcmdline, silent=False):
                for x in ' '.join(myoptions.exclude).split():
                        bad_atom = False
                        try:
-                               atom = portage.dep.Atom(x)
+                               atom = portage.dep.Atom(x, allow_wildcard=True)
                        except portage.exception.InvalidAtom:
                                try:
-                                       atom = portage.dep.Atom("null/"+x)
+                                       atom = portage.dep.Atom("*/"+x, allow_wildcard=True)
                                except portage.exception.InvalidAtom:
                                        bad_atom = True
                        
@@ -760,7 +760,7 @@ def parse_opts(tmpcmdline, silent=False):
                                        exclude.append(atom)
 
                if bad_atoms and not silent:
-                       parser.error("Invalid Atom(s) in --exclude parameter: '%s' (only package names and slot atoms allowed)\n" % \
+                       parser.error("Invalid Atom(s) in --exclude parameter: '%s' (only package names and slot atoms (with widlcards) allowed)\n" % \
                                (",".join(bad_atoms),))
 
        if myoptions.fail_clean == "True":