From a580aee32bec544889e08a76b4d0f308447f8d89 Mon Sep 17 00:00:00 2001 From: Sebastian Luther Date: Thu, 13 Oct 2011 15:03:34 +0200 Subject: quickpkg: Support extended atoms --- bin/quickpkg | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/quickpkg b/bin/quickpkg index 09723f5c8..c95a58423 100755 --- a/bin/quickpkg +++ b/bin/quickpkg @@ -21,7 +21,7 @@ except ImportError: from portage import os from portage import xpak from portage.dbapi.dep_expand import dep_expand -from portage.dep import use_reduce +from portage.dep import Atom, extended_cp_match, use_reduce from portage.exception import InvalidAtom, InvalidData, InvalidDependString, \ PackageSetNotFound, PermissionDenied from portage.util import ConfigProtect, ensure_dirs, shlex_split @@ -187,6 +187,42 @@ def quickpkg_set(options, infos, arg, eout): for atom in atoms: quickpkg_atom(options, infos, atom, eout) + +def quickpkg_extended_atom(options, infos, arg, eout): + root = portage.settings["ROOT"] + trees = portage.db[root] + vartree = trees["vartree"] + vardb = vartree.dbapi + + try: + atom = Atom(arg, allow_wildcard=True, allow_repo=True) + except (InvalidAtom, InvalidData): + eout.eerror("Invalid atom: %s" % (arg,)) + infos["missing"].append(arg) + return + + require_metadata = atom.slot or atom.repo + atoms = [] + for cpv in vardb.cpv_all(): + cpv_atom = Atom("=%s" % cpv) + if not extended_cp_match(atom.cp, cpv_atom.cp): + continue + + if require_metadata: + slot, repo = vardb.aux_get(cpv, ["SLOT", "repository"]) + + if atom.slot and atom.slot != slot: + continue + + if atom.repo and atom.repo != repo: + continue + + atoms.append(cpv_atom) + + for atom in atoms: + quickpkg_atom(options, infos, atom, eout) + + def quickpkg_main(options, args, eout): root = portage.settings["ROOT"] trees = portage.db[root] @@ -207,6 +243,8 @@ def quickpkg_main(options, args, eout): for arg in args: if arg[0] == SETPREFIX: quickpkg_set(options, infos, arg, eout) + elif '*' in arg: + quickpkg_extended_atom(options, infos, arg, eout) else: quickpkg_atom(options, infos, arg, eout) -- cgit v1.2.3-1-g7c22