From 5119dea05eb07e7e981c9a9e776d4ddfadcf6330 Mon Sep 17 00:00:00 2001 From: Sebastian Luther Date: Mon, 24 Jan 2011 14:40:27 +0100 Subject: Wildcard support for -c/-C --- pym/_emerge/actions.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'pym/_emerge/actions.py') diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index ee37bb821..33a1f013f 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -31,6 +31,8 @@ from portage.cache.cache_errors import CacheError from portage.const import GLOBAL_CONFIG_PATH, NEWS_LIB_PATH from portage.const import _ENABLE_DYN_LINK_MAP from portage.dbapi.dep_expand import dep_expand +from portage.dep import Atom, extended_cp_match +from portage.exception import InvalidAtom from portage.output import blue, bold, colorize, create_color_func, darkgreen, \ red, yellow good = create_color_func("GOOD") @@ -2453,7 +2455,6 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): def action_uninstall(settings, trees, ldpath_mtimes, opts, action, files, spinner): - # For backward compat, some actions do not require leading '='. ignore_missing_eq = action in ('clean', 'unmerge') root = settings['ROOT'] @@ -2496,6 +2497,28 @@ def action_uninstall(settings, trees, ldpath_mtimes, elif x.startswith(SETPREFIX) and action == "deselect": valid_atoms.append(x) + elif "*" in x: + try: + ext_atom = Atom(x, allow_repo=True, allow_wildcard=True) + except InvalidAtom: + msg = [] + msg.append("'%s' is not a valid package atom." % (x,)) + msg.append("Please check ebuild(5) for full details.") + writemsg_level("".join("!!! %s\n" % line for line in msg), + level=logging.ERROR, noiselevel=-1) + return 1 + + for cp in vardb.cp_all(): + if extended_cp_match(ext_atom.cp, cp): + atom = cp + if ext_atom.slot: + atom += ":" + ext_atom.slot + if ext_atom.repo: + atom += "::" + ext_atom.repo + + if vardb.match(atom): + valid_atoms.append(Atom(atom)) + else: msg = [] msg.append("'%s' is not a valid package atom." % (x,)) -- cgit v1.2.3-1-g7c22