From: Sebastian Luther Date: Thu, 13 Oct 2011 13:03:34 +0000 (+0200) Subject: quickpkg: Support extended atoms X-Git-Tag: v2.2.0_alpha68~64 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a580aee32bec544889e08a76b4d0f308447f8d89;p=portage.git quickpkg: Support extended atoms --- 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)