Lines 391-435
Link Here
|
391 |
|
391 |
|
392 |
found = 0 |
392 |
found = 0 |
393 |
|
393 |
|
394 |
def dumpToPipe(pkg): |
|
|
395 |
mysplit = pkg.split("/") |
396 |
cnt = portage.dblink(mysplit[0], mysplit[1], "/", gentoolkit.settings).getcontents() |
397 |
#cnt = pkg.get_contents() |
398 |
if not cnt: return |
399 |
for file in cnt.keys(): |
400 |
if rx.search(file) and (opts["category"] == "*" or portage.catpkgsplit(pkg)[0] == opts["category"]): |
401 |
if opts["nameOnly"]: |
402 |
x = portage.catpkgsplit(pkg) |
403 |
print x[0]+"/"+x[1] |
404 |
else: |
405 |
print pkg |
406 |
return |
407 |
|
408 |
class DummyExp: |
394 |
class DummyExp: |
409 |
pass |
395 |
pass |
410 |
|
396 |
|
411 |
def dumpToScreen(pkg): |
397 |
def printResults(pkg): |
412 |
mysplit = pkg.split("/") |
398 |
(cat, pf) = pkg.split('/') |
413 |
cnt = portage.dblink(mysplit[0], mysplit[1], "/", gentoolkit.settings).getcontents() |
399 |
pn = portage.catpkgsplit(pkg)[1] |
|
|
400 |
cnt = portage.dblink(cat, pf, "/", gentoolkit.settings).getcontents() |
414 |
#cnt = pkg.get_contents() |
401 |
#cnt = pkg.get_contents() |
415 |
if not cnt: return |
402 |
retval = False |
|
|
403 |
if not cnt: return retval |
404 |
if not (opts["category"] in [cat, '*']): return retval |
416 |
for file in cnt.keys(): |
405 |
for file in cnt.keys(): |
417 |
if rx.search(file) and (opts["category"] == "*" or portage.catpkgsplit(pkg)[0] == opts["category"]): |
406 |
if not rx.search(file): continue |
418 |
if opts["nameOnly"]: |
407 |
s = pn |
419 |
x = portage.catpkgsplit(pkg) |
408 |
if opts["nameOnly"]: s = cat+"/"+s |
420 |
s = x[0]+"/"+x[1] |
409 |
if not(Config["piping"]): |
421 |
else: |
|
|
422 |
s = pkg |
423 |
s += " (" + pp.path(fileAsStr(file, cnt[file])) + ")" |
410 |
s += " (" + pp.path(fileAsStr(file, cnt[file])) + ")" |
424 |
print_info(0, s) |
411 |
print_info(0, s) |
425 |
if opts["earlyOut"]: |
412 |
if opts["earlyOut"]: raise DummyExp |
426 |
raise DummyExp |
413 |
retval = True |
|
|
414 |
return retval |
427 |
|
415 |
|
428 |
try: |
416 |
try: |
429 |
if Config["piping"]: |
417 |
return True in map(printResults, matches) |
430 |
map(dumpToPipe, matches) |
|
|
431 |
else: |
432 |
map(dumpToScreen, matches) |
433 |
except DummyExp: |
418 |
except DummyExp: |
434 |
pass |
419 |
pass |
435 |
|
420 |
|
Lines 1793-1799
Link Here
|
1793 |
(cmd, local_opts) = parseArgs(sys.argv[1:]) |
1778 |
(cmd, local_opts) = parseArgs(sys.argv[1:]) |
1794 |
if cmd: |
1779 |
if cmd: |
1795 |
try: |
1780 |
try: |
1796 |
cmd.perform(local_opts) |
1781 |
# Special exit status when perform returns False |
|
|
1782 |
if (None != cmd.perform(local_opts) == False): sys.exit(1) |
1797 |
except KeyError, e: |
1783 |
except KeyError, e: |
1798 |
if e and e[0].find("Specific key requires an operator") >= 0: |
1784 |
if e and e[0].find("Specific key requires an operator") >= 0: |
1799 |
print_error("Invalid syntax: missing operator") |
1785 |
print_error("Invalid syntax: missing operator") |
Lines 1827-1830
Link Here
|
1827 |
else: |
1813 |
else: |
1828 |
print_error("No command or unknown command given") |
1814 |
print_error("No command or unknown command given") |
1829 |
printUsage() |
1815 |
printUsage() |
1830 |
|
|
|