Lines 8-18
Link Here
|
8 |
# that last one is tricky because multiple profiles need to be checked. |
8 |
# that last one is tricky because multiple profiles need to be checked. |
9 |
|
9 |
|
10 |
import os,sys |
10 |
import os,sys |
11 |
exename=os.path.basename(sys.argv[0]) |
11 |
exename=os.path.basename(sys.argv[0]) |
12 |
os.environ["PORTAGE_CALLER"]="repoman" |
12 |
os.environ["PORTAGE_CALLER"]="repoman" |
13 |
version="1.2" |
13 |
version="1.2" |
14 |
|
14 |
|
15 |
import string,signal,readline,portage,re,cvstree |
15 |
import string,signal,readline,portage,re,cvstree,pickle |
16 |
from output import * |
16 |
from output import * |
17 |
from commands import getstatusoutput |
17 |
from commands import getstatusoutput |
18 |
from time import * |
18 |
from time import * |
Lines 36-49
Link Here
|
36 |
signal.signal(signal.SIGINT,exithandler) |
36 |
signal.signal(signal.SIGINT,exithandler) |
37 |
|
37 |
|
38 |
REPOROOTS=["gentoo-x86"] |
38 |
REPOROOTS=["gentoo-x86"] |
39 |
modes=["scan","fix","full","help","commit"] |
39 |
modes=["scan","fix","full","help","commit","last","lfull"] |
40 |
shortmodes={"ci":"commit"} |
40 |
shortmodes={"ci":"commit"} |
41 |
modeshelp={ |
41 |
modeshelp={ |
42 |
"scan" :"Scan current directory tree for QA issues (default)", |
42 |
"scan" :"Scan current directory tree for QA issues (default)", |
43 |
"fix" :"Fix those issues that can be fixed (stray digests, missing digests)", |
43 |
"fix" :"Fix those issues that can be fixed (stray digests, missing digests)", |
44 |
"full" :"Scan current directory tree for QA issues (full listing)", |
44 |
"full" :"Scan current directory tree for QA issues (full listing)", |
45 |
"help" :"Show this screen", |
45 |
"help" :"Show this screen", |
46 |
"commit":"Scan current directory tree for QA issues; if OK, commit via cvs" |
46 |
"commit":"Scan current directory tree for QA issues; if OK, commit via cvs", |
|
|
47 |
"last" :"Remember report from last run", |
48 |
"lfull" :"Remember report from last run (full listing)" |
47 |
} |
49 |
} |
48 |
options=["--pretend","--help","--commitmsg","--commitmsgfile"] |
50 |
options=["--pretend","--help","--commitmsg","--commitmsgfile"] |
49 |
shortoptions={"-m":"--commitmsg","-M":"--commitmsgfile","-p":"--pretend"} |
51 |
shortoptions={"-m":"--commitmsg","-M":"--commitmsgfile","-p":"--pretend"} |
Lines 172-177
Link Here
|
172 |
print |
174 |
print |
173 |
sys.exit(1) |
175 |
sys.exit(1) |
174 |
|
176 |
|
|
|
177 |
def last(): |
178 |
try: |
179 |
#Retrieve and unpickle stats and fails from saved files |
180 |
savedf=open('/tmp/repo.stats','r') |
181 |
stats = pickle.load(savedf) |
182 |
savedf.close() |
183 |
savedf=open('/tmp/repo.fails','r') |
184 |
fails = pickle.load(savedf) |
185 |
savedf.close() |
186 |
except: |
187 |
err("Error retrieving last repoman run data; exiting.") |
188 |
|
189 |
#dofail will be set to 1 if we have failed in at least one non-warning category |
190 |
dofail=0 |
191 |
#dowarn will be set to 1 if we tripped any warnings |
192 |
dowarn=0 |
193 |
#dofull will be set if we should print a "repoman full" informational message |
194 |
dofull=0 |
195 |
|
196 |
print |
197 |
print green("RepoMan remembers...") |
198 |
print |
199 |
for x in qacats: |
200 |
if stats[x]: |
201 |
dowarn=1 |
202 |
if x not in qawarnings: |
203 |
dofail=1 |
204 |
else: |
205 |
if mymode!="lfull": |
206 |
continue |
207 |
print " "+string.ljust(x,20), |
208 |
if stats[x]==0: |
209 |
print green(`stats[x]`) |
210 |
continue |
211 |
elif x in qawarnings: |
212 |
print yellow(`stats[x]`) |
213 |
else: |
214 |
print red(`stats[x]`) |
215 |
if mymode!="lfull": |
216 |
if stats[x]<12: |
217 |
for y in fails[x]: |
218 |
print " "+y |
219 |
else: |
220 |
dofull=1 |
221 |
else: |
222 |
for y in fails[x]: |
223 |
print " "+y |
224 |
print |
225 |
if dofull: |
226 |
print bold("Note: type \"repoman lfull\" for a complete listing of repomans last run.") |
227 |
print |
228 |
if dowarn and not dofail: |
229 |
print green("RepoMan sez:"),"\"You only gave me a partial QA payment last time?\nI took it, but I wasn't happy.\"" |
230 |
elif not dofail: |
231 |
print green("RepoMan sez:"),"\"If everyone were like you, I'd be out of business!\"" |
232 |
print |
233 |
sys.exit(1) |
175 |
|
234 |
|
176 |
mymode=None |
235 |
mymode=None |
177 |
myoptions=[] |
236 |
myoptions=[] |
Lines 204-210
Link Here
|
204 |
mymode="scan" |
263 |
mymode="scan" |
205 |
if mymode=="help" or ("--help" in myoptions): |
264 |
if mymode=="help" or ("--help" in myoptions): |
206 |
help() |
265 |
help() |
207 |
|
266 |
if mymode=="last" or (mymode=="lfull"): |
|
|
267 |
last() |
208 |
if not os.path.isdir("CVS"): |
268 |
if not os.path.isdir("CVS"): |
209 |
err("We do not appear to be inside a local repository. Exiting.") |
269 |
err("We do not appear to be inside a local repository. Exiting.") |
210 |
try: |
270 |
try: |
Lines 554-559
Link Here
|
554 |
stats["ebuild.allmasked"]+=1 |
614 |
stats["ebuild.allmasked"]+=1 |
555 |
fails["ebuild.allmasked"].append(x) |
615 |
fails["ebuild.allmasked"].append(x) |
556 |
|
616 |
|
|
|
617 |
#Pickle and save results for instant reuse in last and lfull |
618 |
savef=open('/tmp/repo.stats','w') |
619 |
pickle.dump(stats,savef) |
620 |
savef.close() |
621 |
savef=open('/tmp/repo.fails','w') |
622 |
pickle.dump(fails,savef) |
623 |
savef.close() |
557 |
|
624 |
|
558 |
print |
625 |
print |
559 |
#dofail will be set to 1 if we have failed in at least one non-warning category |
626 |
#dofail will be set to 1 if we have failed in at least one non-warning category |