--- repoman 2003-08-26 12:27:48.000000000 +0100 +++ repoman 2003-08-28 12:51:55.000000000 +0100 @@ -8,11 +8,11 @@ # that last one is tricky because multiple profiles need to be checked. import os,sys -exename=os.path.basename(sys.argv[0]) +exename=os.path.basename(sys.argv[0]) os.environ["PORTAGE_CALLER"]="repoman" version="1.2" -import string,signal,readline,portage,re,cvstree +import string,signal,readline,portage,re,cvstree,pickle from output import * from commands import getstatusoutput from time import * @@ -36,14 +36,16 @@ signal.signal(signal.SIGINT,exithandler) REPOROOTS=["gentoo-x86"] -modes=["scan","fix","full","help","commit"] +modes=["scan","fix","full","help","commit","last","lfull"] shortmodes={"ci":"commit"} modeshelp={ "scan" :"Scan current directory tree for QA issues (default)", "fix" :"Fix those issues that can be fixed (stray digests, missing digests)", "full" :"Scan current directory tree for QA issues (full listing)", "help" :"Show this screen", -"commit":"Scan current directory tree for QA issues; if OK, commit via cvs" +"commit":"Scan current directory tree for QA issues; if OK, commit via cvs", +"last" :"Remember report from last run", +"lfull" :"Remember report from last run (full listing)" } options=["--pretend","--help","--commitmsg","--commitmsgfile"] shortoptions={"-m":"--commitmsg","-M":"--commitmsgfile","-p":"--pretend"} @@ -172,6 +174,63 @@ print sys.exit(1) +def last(): + try: + #Retrieve and unpickle stats and fails from saved files + savedf=open('/tmp/repo.stats','r') + stats = pickle.load(savedf) + savedf.close() + savedf=open('/tmp/repo.fails','r') + fails = pickle.load(savedf) + savedf.close() + except: + err("Error retrieving last repoman run data; exiting.") + + #dofail will be set to 1 if we have failed in at least one non-warning category + dofail=0 + #dowarn will be set to 1 if we tripped any warnings + dowarn=0 + #dofull will be set if we should print a "repoman full" informational message + dofull=0 + + print + print green("RepoMan remembers...") + print + for x in qacats: + if stats[x]: + dowarn=1 + if x not in qawarnings: + dofail=1 + else: + if mymode!="lfull": + continue + print " "+string.ljust(x,20), + if stats[x]==0: + print green(`stats[x]`) + continue + elif x in qawarnings: + print yellow(`stats[x]`) + else: + print red(`stats[x]`) + if mymode!="lfull": + if stats[x]<12: + for y in fails[x]: + print " "+y + else: + dofull=1 + else: + for y in fails[x]: + print " "+y + print + if dofull: + print bold("Note: type \"repoman lfull\" for a complete listing of repomans last run.") + print + if dowarn and not dofail: + print green("RepoMan sez:"),"\"You only gave me a partial QA payment last time?\nI took it, but I wasn't happy.\"" + elif not dofail: + print green("RepoMan sez:"),"\"If everyone were like you, I'd be out of business!\"" + print + sys.exit(1) mymode=None myoptions=[] @@ -204,7 +263,8 @@ mymode="scan" if mymode=="help" or ("--help" in myoptions): help() - +if mymode=="last" or (mymode=="lfull"): + last() if not os.path.isdir("CVS"): err("We do not appear to be inside a local repository. Exiting.") try: @@ -554,6 +614,13 @@ stats["ebuild.allmasked"]+=1 fails["ebuild.allmasked"].append(x) +#Pickle and save results for instant reuse in last and lfull +savef=open('/tmp/repo.stats','w') +pickle.dump(stats,savef) +savef.close() +savef=open('/tmp/repo.fails','w') +pickle.dump(fails,savef) +savef.close() print #dofail will be set to 1 if we have failed in at least one non-warning category