Index: equery =================================================================== --- equery (revision 474) +++ equery (working copy) @@ -391,45 +391,30 @@ found = 0 - def dumpToPipe(pkg): - mysplit = pkg.split("/") - cnt = portage.dblink(mysplit[0], mysplit[1], "/", gentoolkit.settings).getcontents() - #cnt = pkg.get_contents() - if not cnt: return - for file in cnt.keys(): - if rx.search(file) and (opts["category"] == "*" or portage.catpkgsplit(pkg)[0] == opts["category"]): - if opts["nameOnly"]: - x = portage.catpkgsplit(pkg) - print x[0]+"/"+x[1] - else: - print pkg - return - class DummyExp: pass - def dumpToScreen(pkg): - mysplit = pkg.split("/") - cnt = portage.dblink(mysplit[0], mysplit[1], "/", gentoolkit.settings).getcontents() + def printResults(pkg): + (cat, pf) = pkg.split('/') + pn = portage.catpkgsplit(pkg)[1] + cnt = portage.dblink(cat, pf, "/", gentoolkit.settings).getcontents() #cnt = pkg.get_contents() - if not cnt: return + retval = False + if not cnt: return retval + if not (opts["category"] in [cat, '*']): return retval for file in cnt.keys(): - if rx.search(file) and (opts["category"] == "*" or portage.catpkgsplit(pkg)[0] == opts["category"]): - if opts["nameOnly"]: - x = portage.catpkgsplit(pkg) - s = x[0]+"/"+x[1] - else: - s = pkg + if not rx.search(file): continue + s = pn + if opts["nameOnly"]: s = cat+"/"+s + if not(Config["piping"]): s += " (" + pp.path(fileAsStr(file, cnt[file])) + ")" - print_info(0, s) - if opts["earlyOut"]: - raise DummyExp + print_info(0, s) + if opts["earlyOut"]: raise DummyExp + retval = True + return retval try: - if Config["piping"]: - map(dumpToPipe, matches) - else: - map(dumpToScreen, matches) + return True in map(printResults, matches) except DummyExp: pass @@ -1793,7 +1778,8 @@ (cmd, local_opts) = parseArgs(sys.argv[1:]) if cmd: try: - cmd.perform(local_opts) + # Special exit status when perform returns False + if (None != cmd.perform(local_opts) == False): sys.exit(1) except KeyError, e: if e and e[0].find("Specific key requires an operator") >= 0: print_error("Invalid syntax: missing operator") @@ -1827,4 +1813,3 @@ else: print_error("No command or unknown command given") printUsage() -