diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-08-15 17:34:33 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-08-15 17:34:33 +0000 |
commit | 7d757300f1da30c9e8f0fdf33827f69d8f1d334e (patch) | |
tree | f84ecb9633283f1bbe322f7e5ed236047ec7b981 | |
parent | 09ac9d49e8fc3f50d0be5fb7a9acb54c32e865b9 (diff) | |
download | portage-7d757300f1da30c9e8f0fdf33827f69d8f1d334e.tar.gz portage-7d757300f1da30c9e8f0fdf33827f69d8f1d334e.tar.bz2 portage-7d757300f1da30c9e8f0fdf33827f69d8f1d334e.zip |
Validate atoms from command line args before calling action_depclean().
svn path=/main/trunk/; revision=11414
-rw-r--r-- | pym/_emerge/__init__.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index fcf4ab4a8..a7ab256a3 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -13701,6 +13701,34 @@ def emerge_main(): post_emerge(root_config, myopts, mtimedb, os.EX_OK) elif myaction in ("depclean", "prune"): + + # Ensure atoms are valid before calling unmerge(). + vardb = trees[settings["ROOT"]]["vartree"].dbapi + for x in myfiles: + if is_valid_package_atom(x): + try: + portage.dep_expand(x, mydb=vardb, settings=settings) + except ValueError, e: + msg = "The short ebuild name \"" + x + \ + "\" is ambiguous. Please specify " + \ + "one of the following " + \ + "fully-qualified ebuild names instead:" + for line in textwrap.wrap(msg, 70): + writemsg_level("!!! %s\n" % (line,), + level=logging.ERROR, noiselevel=-1) + for i in e[0]: + writemsg_level(" %s\n" % colorize("INFORM", i), + level=logging.ERROR, noiselevel=-1) + writemsg_level("\n", level=logging.ERROR, noiselevel=-1) + return 1 + continue + 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 + validate_ebuild_environment(trees) action_depclean(settings, trees, mtimedb["ldpath"], myopts, myaction, myfiles, spinner) |