Lines 26-36
Link Here
|
26 |
from stat import S_ISDIR, ST_CTIME |
26 |
from stat import S_ISDIR, ST_CTIME |
27 |
|
27 |
|
28 |
try: |
28 |
try: |
29 |
import cPickle as pickle |
|
|
30 |
except ImportError: |
31 |
import pickle |
32 |
|
33 |
try: |
34 |
import cStringIO as StringIO |
29 |
import cStringIO as StringIO |
35 |
except ImportError: |
30 |
except ImportError: |
36 |
import StringIO |
31 |
import StringIO |
Lines 150-157
Link Here
|
150 |
'fix' : 'Fix simple QA issues (stray digests, missing digests)', |
145 |
'fix' : 'Fix simple QA issues (stray digests, missing digests)', |
151 |
'full' : 'Scan directory tree and print all issues (not a summary)', |
146 |
'full' : 'Scan directory tree and print all issues (not a summary)', |
152 |
'help' : 'Show this screen', |
147 |
'help' : 'Show this screen', |
153 |
'last' : 'Remember report from last run', |
|
|
154 |
'lfull' : 'Remember report from last run (full listing)', |
155 |
'manifest' : 'Generate a Manifest (fetches files if necessary)', |
148 |
'manifest' : 'Generate a Manifest (fetches files if necessary)', |
156 |
'scan' : 'Scan directory tree for QA issues' |
149 |
'scan' : 'Scan directory tree for QA issues' |
157 |
} |
150 |
} |
Lines 224-230
Link Here
|
224 |
break |
217 |
break |
225 |
|
218 |
|
226 |
if not opts.mode: |
219 |
if not opts.mode: |
227 |
opts.mode = 'full' #default to full |
220 |
opts.mode = 'full' |
228 |
|
221 |
|
229 |
if opts.mode == 'ci': |
222 |
if opts.mode == 'ci': |
230 |
opts.mode = 'commit' # backwards compat shortcut |
223 |
opts.mode = 'commit' # backwards compat shortcut |
Lines 412-472
Link Here
|
412 |
# file.executable |
405 |
# file.executable |
413 |
no_exec = frozenset(["Manifest","ChangeLog","metadata.xml"]) |
406 |
no_exec = frozenset(["Manifest","ChangeLog","metadata.xml"]) |
414 |
|
407 |
|
415 |
def last(full=False): |
|
|
416 |
"""Print the results of the last repoman run |
417 |
Args: |
418 |
full - Print the complete results, if false, print a summary |
419 |
Returns: |
420 |
Doesn't return (invokes sys.exit() |
421 |
""" |
422 |
#Retrieve and unpickle stats and fails from saved files |
423 |
savedf=open(os.path.join(portage.const.CACHE_PATH, 'repo.stats'),'r') |
424 |
stats = pickle.load(savedf) |
425 |
savedf.close() |
426 |
savedf=open(os.path.join(portage.const.CACHE_PATH, 'repo.fails'),'r') |
427 |
fails = pickle.load(savedf) |
428 |
savedf.close() |
429 |
|
430 |
#dofail will be set to 1 if we have failed in at least one non-warning category |
431 |
dofail=0 |
432 |
#dowarn will be set to 1 if we tripped any warnings |
433 |
dowarn=0 |
434 |
#dofull will be set if we should print a "repoman full" informational message |
435 |
dofull=0 |
436 |
|
437 |
dofull = options.mode not in ("full", "lfull") |
438 |
|
439 |
for x in qacats: |
440 |
if not stats[x]: |
441 |
continue |
442 |
dowarn = 1 |
443 |
if x not in qawarnings: |
444 |
dofail = 1 |
445 |
|
446 |
print |
447 |
print green("RepoMan remembers...") |
448 |
print |
449 |
style_file = ConsoleStyleFile(sys.stdout) |
450 |
console_writer = StyleWriter(file=style_file, maxcol=9999) |
451 |
console_writer.style_listener = style_file.new_styles |
452 |
f = formatter.AbstractFormatter(console_writer) |
453 |
utilities.format_qa_output(f, stats, fails, dofull, dofail, options, qawarnings) |
454 |
print |
455 |
if dofull: |
456 |
print bold("Note: type \"repoman lfull\" for a complete listing of repomans last run.") |
457 |
print |
458 |
if dowarn and not dofail: |
459 |
print green("RepoMan sez:"),"\"You only gave me a partial QA payment last time?\n I took it, but I wasn't happy.\"" |
460 |
elif not dofail: |
461 |
print green("RepoMan sez:"),"\"If everyone were like you, I'd be out of business!\"" |
462 |
print |
463 |
sys.exit(0) |
464 |
|
465 |
options, arguments = ParseArgs(sys.argv, qahelp) |
408 |
options, arguments = ParseArgs(sys.argv, qahelp) |
466 |
|
409 |
|
467 |
if options.mode in ('last', 'lfull'): |
|
|
468 |
last('lfull' in options.mode) |
469 |
|
470 |
# Set this to False when an extraordinary issue (generally |
410 |
# Set this to False when an extraordinary issue (generally |
471 |
# something other than a QA issue) makes it impossible to |
411 |
# something other than a QA issue) makes it impossible to |
472 |
# commit (like if Manifest generation fails). |
412 |
# commit (like if Manifest generation fails). |
Lines 1573-1596
Link Here
|
1573 |
if options.mode == "manifest": |
1513 |
if options.mode == "manifest": |
1574 |
sys.exit(dofail) |
1514 |
sys.exit(dofail) |
1575 |
|
1515 |
|
1576 |
#Pickle and save results for instant reuse in last and lfull |
|
|
1577 |
if os.access(portage.const.CACHE_PATH, os.W_OK): |
1578 |
for myobj, fname in (stats, "repo.stats"), (fails, "repo.fails"): |
1579 |
fpath = os.path.join(portage.const.CACHE_PATH, fname) |
1580 |
savef = open(fpath, 'w') |
1581 |
pickle.dump(myobj, savef) |
1582 |
savef.close() |
1583 |
portage.apply_secpass_permissions(fpath, gid=portage.portage_gid, |
1584 |
mode=0664) |
1585 |
|
1586 |
# TODO(antarus) This function and last () look familiar ;) |
1587 |
|
1588 |
#dofail will be set to 1 if we have failed in at least one non-warning category |
1516 |
#dofail will be set to 1 if we have failed in at least one non-warning category |
1589 |
dofail=0 |
1517 |
dofail=0 |
1590 |
#dowarn will be set to 1 if we tripped any warnings |
1518 |
#dowarn will be set to 1 if we tripped any warnings |
1591 |
dowarn=0 |
1519 |
dowarn=0 |
1592 |
#dofull will be set if we should print a "repoman full" informational message |
1520 |
#dofull will be set if we should print a "repoman full" informational message |
1593 |
dofull = options.mode not in ("full", "lfull") |
1521 |
if options.mode != 'full': dofull = True |
1594 |
|
1522 |
|
1595 |
for x in qacats: |
1523 |
for x in qacats: |
1596 |
if not stats[x]: |
1524 |
if not stats[x]: |