From b5b50e4193e2fb8aa7e5f3bd27fed41e2552697b Mon Sep 17 00:00:00 2001 From: Sebastian Luther Date: Fri, 23 Jul 2010 13:05:42 +0200 Subject: --exclude: Add support for atoms with wildcards --- pym/_emerge/depgraph.py | 19 +++---------------- pym/_emerge/main.py | 6 +++--- 2 files changed, 6 insertions(+), 19 deletions(-) (limited to 'pym/_emerge') diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 8931bd9f0..361a767c1 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -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): diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py index 9e91ee9e4..4e621d21e 100644 --- a/pym/_emerge/main.py +++ b/pym/_emerge/main.py @@ -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": -- cgit v1.2.3-1-g7c22