|
Lines 4-10
Link Here
|
| 4 |
|
4 |
|
| 5 |
start = time() |
5 |
start = time() |
| 6 |
|
6 |
|
| 7 |
from output import red, darkgreen, green, bold |
7 |
from output import red, darkgreen, green, bold, nocolor |
|
|
8 |
from getopt import * |
| 8 |
from os import stat, unlink |
9 |
from os import stat, unlink |
| 9 |
from os.path import dirname |
10 |
from os.path import dirname |
| 10 |
from shutil import copyfile |
11 |
from shutil import copyfile |
|
Lines 14-19
Link Here
|
| 14 |
esearchdbfile = "/var/cache/edb/esearchdb.py" |
15 |
esearchdbfile = "/var/cache/edb/esearchdb.py" |
| 15 |
tmpfile = "/tmp/esearchdb.py.tmp" |
16 |
tmpfile = "/tmp/esearchdb.py.tmp" |
| 16 |
|
17 |
|
|
|
18 |
try: |
| 19 |
opts = getopt(sys.argv[1:], "qh", ["help","quiet"]) |
| 20 |
except GetoptError, error: |
| 21 |
print red(" * Error:"), error, "(see", darkgreen("--help"), "for all options)" |
| 22 |
print |
| 23 |
sys.exit(1) |
| 24 |
|
| 25 |
def usage(): |
| 26 |
print "eupdatedb (0.4.1) - Updates esearch index" |
| 27 |
print "" |
| 28 |
print bold("Usage:"), "esearch [", darkgreen("options"), "] pattern" |
| 29 |
print "" |
| 30 |
print bold("Options:") |
| 31 |
print darkgreen(" --help -h") |
| 32 |
print " Print this help message" |
| 33 |
print "" |
| 34 |
print darkgreen(" --quiet -q") |
| 35 |
print " Suppress messages and color" |
| 36 |
print "" |
| 37 |
|
| 38 |
sys.exit(0) |
| 39 |
|
| 40 |
for arg in opts[0]: |
| 41 |
arg = arg[0] |
| 42 |
if arg in ("-q", "--quiet"): |
| 43 |
quiet = True |
| 44 |
nocolor() |
| 45 |
if arg in ("-h", "--help"): |
| 46 |
usage() |
| 47 |
|
| 17 |
vartree = portage.vartree() |
48 |
vartree = portage.vartree() |
| 18 |
|
49 |
|
| 19 |
def version(pkg): |
50 |
def version(pkg): |
|
Lines 68-77
Link Here
|
| 68 |
nr += 1 |
99 |
nr += 1 |
| 69 |
masked = False |
100 |
masked = False |
| 70 |
|
101 |
|
| 71 |
s = str(numebuilds - nr) + " ebuilds to go" |
102 |
if (not quiet): |
| 72 |
sys.stdout.write((nrchars * "\b \b") + s) |
103 |
s = str(numebuilds - nr) + " ebuilds to go" |
| 73 |
sys.stdout.flush() |
104 |
sys.stdout.write((nrchars * "\b \b") + s) |
| 74 |
nrchars = len(s) |
105 |
sys.stdout.flush() |
|
|
106 |
nrchars = len(s) |
| 75 |
|
107 |
|
| 76 |
pkgv = portage.portdb.xmatch("bestmatch-visible", pkg) |
108 |
pkgv = portage.portdb.xmatch("bestmatch-visible", pkg) |
| 77 |
if not pkgv: |
109 |
if not pkgv: |