Lines 64-79
Link Here
|
64 |
if fatal: |
64 |
if fatal: |
65 |
sys.exit(1) |
65 |
sys.exit(1) |
66 |
|
66 |
|
67 |
def searchEbuilds(path, portdir = True, searchdef = ""): |
67 |
def searchEbuilds(path, portdir = True, searchdef = "", repo_num = ""): |
68 |
global ebuilds, output, defebuild |
68 |
global ebuilds, output, defebuild, found_in_overlay |
69 |
pv = "" |
69 |
pv = "" |
70 |
pkgs = [] |
70 |
pkgs = [] |
71 |
nr = len(ebuilds) + 1 |
71 |
nr = len(ebuilds) + 1 |
72 |
|
72 |
|
73 |
if portdir: |
73 |
if portdir: |
74 |
rep = darkgreen("Portage") |
74 |
rep = darkgreen("Portage ") |
75 |
else: |
75 |
else: |
76 |
rep = red("Overlay") |
76 |
rep = red("Overlay "+str(repo_num)+" ") |
77 |
|
77 |
|
78 |
if isdir(path): |
78 |
if isdir(path): |
79 |
list = listdir(path) |
79 |
list = listdir(path) |
Lines 82-99
Link Here
|
82 |
if file[-7:] == ".ebuild": |
82 |
if file[-7:] == ".ebuild": |
83 |
pv = file[:-7] |
83 |
pv = file[:-7] |
84 |
pkgs.append(pkgsplit(pv)) |
84 |
pkgs.append(pkgsplit(pv)) |
85 |
pkgs[-1].append(path + "/" + file) |
85 |
pkgs[-1].append(path + file) |
86 |
if searchdef != "" and pv == searchdef: |
86 |
if searchdef != "" and pv == searchdef: |
87 |
defebuild = (searchdef, pkgs[-1][3]) |
87 |
defebuild = (searchdef, pkgs[-1][3]) |
|
|
88 |
if not portdir: |
89 |
found_in_overlay = True |
88 |
pkgs.sort(pkgcmp) |
90 |
pkgs.sort(pkgcmp) |
89 |
for pkg in pkgs: |
91 |
for pkg in pkgs: |
90 |
rev = "" |
92 |
rev = "" |
91 |
if pkg[2] != "r0": |
93 |
if pkg[2] != "r0": |
92 |
rev = "-" + pkg[2] |
94 |
rev = "-" + pkg[2] |
93 |
output.append(" " + rep + " [" + bold(str(nr)) + "] " + pkg[0] + "-" + pkg[1] + rev + "\n") |
95 |
output.append(" " + rep + " [" + bold(str(nr)) + "] " + pkg[0] + "-" + pkg[1] + rev + "\n") |
94 |
ebuilds.append(pkg[3]) |
96 |
ebuilds.append(pkg[len(pkg)-1]) |
95 |
nr += 1 |
97 |
nr += 1 |
96 |
|
98 |
|
97 |
NORMAL = 1 |
99 |
NORMAL = 1 |
98 |
COMPACT = 2 |
100 |
COMPACT = 2 |
99 |
VERBOSE = 3 |
101 |
VERBOSE = 3 |
Lines 105-110
Link Here
|
105 |
fullname = False |
107 |
fullname = False |
106 |
pattern = False |
108 |
pattern = False |
107 |
instonly = False |
109 |
instonly = False |
|
|
110 |
found_in_overlay = False |
108 |
|
111 |
|
109 |
try: |
112 |
try: |
110 |
opts = getopt(sys.argv[1:], "hSFIcveo:d:n", ["help", "searchdesc", "fullname", "instonly", "compact", "verbose", "ebuild", "own=", "directory=", "nocolor"]) |
113 |
opts = getopt(sys.argv[1:], "hSFIcveo:d:n", ["help", "searchdesc", "fullname", "instonly", "compact", "verbose", "ebuild", "own=", "directory=", "nocolor"]) |
Lines 128-134
Link Here
|
128 |
from output import blue |
131 |
from output import blue |
129 |
from common import version |
132 |
from common import version |
130 |
outputm = VERBOSE |
133 |
outputm = VERBOSE |
131 |
elif arg in ("-e", "--ebuilds"): |
134 |
elif arg in ("-e", "--ebuild"): |
132 |
from os import listdir, getenv, system |
135 |
from os import listdir, getenv, system |
133 |
from os.path import isdir |
136 |
from os.path import isdir |
134 |
from portage import settings, pkgcmp, pkgsplit |
137 |
from portage import settings, pkgcmp, pkgsplit |
Lines 313-324
Link Here
|
313 |
else: |
316 |
else: |
314 |
searchdef = "" |
317 |
searchdef = "" |
315 |
|
318 |
|
316 |
searchEbuilds("%s/%s/" % (portdir, pkg[1]), True, searchdef) |
319 |
searchEbuilds("%s/%s/" % (portdir, pkg[1]), True, searchdef, "") |
317 |
if overlay: |
320 |
if overlay: |
318 |
searchEbuilds("%s/%s/" % (overlay, pkg[1]), False, searchdef) |
321 |
repo_num=1 |
|
|
322 |
for repo in overlay.split(): |
323 |
searchEbuilds("%s/%s/" % ( repo, pkg[1]), False, searchdef,repo_num) |
324 |
repo_num += 1 |
319 |
|
325 |
|
320 |
output.append("\n") |
326 |
output.append("\n") |
321 |
|
|
|
322 |
count += 1 |
327 |
count += 1 |
323 |
|
328 |
|
324 |
regexlist[i][2] = "".join(output) |
329 |
regexlist[i][2] = "".join(output) |
Lines 338-371
Link Here
|
338 |
if outputm == NORMAL: |
343 |
if outputm == NORMAL: |
339 |
print "" |
344 |
print "" |
340 |
|
345 |
|
341 |
if outputm == EBUILDS and count != 0: |
|
|
342 |
if count > 1: |
343 |
defebuild = (0, 0) |
344 |
|
346 |
|
345 |
if len(ebuilds) == 1: |
347 |
if outputm == EBUILDS: |
346 |
nr = 1 |
348 |
if overlay and found_in_overlay: |
347 |
else: |
349 |
repo_num=1 |
348 |
if defebuild[0] != 0: |
350 |
for repo in overlay.split(): |
349 |
print bold("Show Ebuild"), " (" + darkgreen(defebuild[0]) + "): ", |
351 |
print red("Overlay "+str(repo_num)+" : "+repo) |
|
|
352 |
repo_num += 1 |
353 |
|
354 |
if count != 0: |
355 |
if count > 1: |
356 |
defebuild = (0, 0) |
357 |
|
358 |
if len(ebuilds) == 1: |
359 |
nr = 1 |
350 |
else: |
360 |
else: |
351 |
print bold("Show Ebuild: "), |
361 |
if defebuild[0] != 0: |
|
|
362 |
print bold("\nShow Ebuild"), " (" + darkgreen(defebuild[0]) + "): ", |
363 |
else: |
364 |
print bold("\nShow Ebuild: "), |
365 |
try: |
366 |
nr = sys.stdin.readline() |
367 |
except KeyboardInterrupt: |
368 |
sys.exit(1) |
352 |
try: |
369 |
try: |
353 |
nr = sys.stdin.readline() |
370 |
editor = getenv("EDITOR") |
354 |
except KeyboardInterrupt: |
371 |
if editor: |
355 |
sys.exit(1) |
372 |
system(editor + " " + ebuilds[int(nr) - 1]) |
356 |
try: |
373 |
else: |
357 |
editor = getenv("EDITOR") |
374 |
print "" |
358 |
if editor: |
375 |
error("Please set EDITOR", False) |
359 |
system(editor + " " + ebuilds[int(nr) - 1]) |
376 |
except IndexError: |
360 |
else: |
|
|
361 |
print "" |
362 |
error("Please set EDITOR", False) |
363 |
except IndexError: |
364 |
print "" |
365 |
error("No such ebuild", False) |
366 |
except ValueError: |
367 |
if defebuild[0] != 0: |
368 |
system(editor + " " + defebuild[1]) |
369 |
else: |
370 |
print "" |
377 |
print "" |
371 |
error("Please enter a valid number", False) |
378 |
error("No such ebuild", False) |
|
|
379 |
except ValueError: |
380 |
if defebuild[0] != 0: |
381 |
system(editor + " " + defebuild[1]) |
382 |
else: |
383 |
print "" |
384 |
error("Please enter a valid number", False) |