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")
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']
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,))
if options.get("--depclean"):
rval, cleanlist, ordered, req_pkg_count = \
calc_depclean(self.settings, self.trees, None,
- options, "depclean", InternalPackageSet(initial_atoms=atoms), None)
+ options, "depclean", InternalPackageSet(initial_atoms=atoms, allow_wildcard=True), None)
result = ResolverPlaygroundDepcleanResult( \
atoms, rval, cleanlist, ordered, req_pkg_count)
else:
self.assertEqual(test_case.test_success, True, test_case.fail_msg)
finally:
playground.cleanup()
+
+class DepcleanAndWildcardsTestCase(TestCase):
+
+ def testDepcleanAndWildcards(self):
+
+ installed = {
+ "dev-libs/A-1": { "RDEPEND": "dev-libs/B" },
+ "dev-libs/B-1": {},
+ }
+
+ test_cases = (
+ ResolverPlaygroundTestCase(
+ ["*/*"],
+ options = {"--depclean": True},
+ success = True,
+ cleanlist = ["dev-libs/A-1", "dev-libs/B-1"]),
+ ResolverPlaygroundTestCase(
+ ["dev-libs/*"],
+ options = {"--depclean": True},
+ success = True,
+ cleanlist = ["dev-libs/A-1", "dev-libs/B-1"]),
+ ResolverPlaygroundTestCase(
+ ["*/A"],
+ options = {"--depclean": True},
+ success = True,
+ cleanlist = ["dev-libs/A-1"]),
+ ResolverPlaygroundTestCase(
+ ["*/B"],
+ options = {"--depclean": True},
+ success = True,
+ cleanlist = []),
+ )
+
+ playground = ResolverPlayground(installed=installed)
+ try:
+ for test_case in test_cases:
+ playground.run_TestCase(test_case)
+ self.assertEqual(test_case.test_success, True, test_case.fail_msg)
+ finally:
+ playground.cleanup()