Lines 16-21
Link Here
|
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 * |
|
|
19 |
from fileinput import input |
19 |
|
20 |
|
20 |
if "cvs" not in portage.features: |
21 |
if "cvs" not in portage.features: |
21 |
print |
22 |
print |
Lines 65-71
Link Here
|
65 |
"ebuild.syntax","ebuild.output", |
66 |
"ebuild.syntax","ebuild.output", |
66 |
"ebuild.nesteddie","LICENSE.invalid", |
67 |
"ebuild.nesteddie","LICENSE.invalid", |
67 |
"IUSE.invalid","KEYWORDS.invalid", |
68 |
"IUSE.invalid","KEYWORDS.invalid", |
68 |
"ebuild.nostable","ebuild.allmasked" |
69 |
"ebuild.nostable","ebuild.allmasked", |
|
|
70 |
"ebuild.majorsyn", "ebuild.minorsyn", |
71 |
"ebuild.badheader", "metadata.missing" |
69 |
] |
72 |
] |
70 |
qawarnings=[ |
73 |
qawarnings=[ |
71 |
"changelog.missing", |
74 |
"changelog.missing", |
Lines 79-85
Link Here
|
79 |
"digest.unmatch", |
82 |
"digest.unmatch", |
80 |
"DEPEND.badmasked", |
83 |
"DEPEND.badmasked", |
81 |
"RDEPEND.badmasked", |
84 |
"RDEPEND.badmasked", |
82 |
"IUSE.invalid" |
85 |
"IUSE.invalid", |
|
|
86 |
"ebuild.minorsyn", |
87 |
"ebuild.badheader", |
88 |
"metadata.missing" |
83 |
] |
89 |
] |
84 |
missingvars=["KEYWORDS","LICENSE","DESCRIPTION","SLOT"] |
90 |
missingvars=["KEYWORDS","LICENSE","DESCRIPTION","SLOT"] |
85 |
allvars=portage.auxdbkeys |
91 |
allvars=portage.auxdbkeys |
Lines 115-121
Link Here
|
115 |
"LICENSE.invalid":"This ebuild is listing a license that doesnt exist in portages license/ dir.", |
121 |
"LICENSE.invalid":"This ebuild is listing a license that doesnt exist in portages license/ dir.", |
116 |
"KEYWORDS.invalid":"This ebuild contains KEYWORDS that are not listed in profiles/keywords.desc", |
122 |
"KEYWORDS.invalid":"This ebuild contains KEYWORDS that are not listed in profiles/keywords.desc", |
117 |
"ebuild.nostable":"There are no ebuilds that are marked as stable for your ARCH", |
123 |
"ebuild.nostable":"There are no ebuilds that are marked as stable for your ARCH", |
118 |
"ebuild.allmasked":"All ebuilds are masked for this package" |
124 |
"ebuild.allmasked":"All ebuilds are masked for this package", |
|
|
125 |
"ebuild.majorsyn":"This ebuild has a major syntax error that may cause the ebuild to fail partially or fully", |
126 |
"ebuild.minorsyn":"This ebuild has a minor syntax error that contravenes gentoo coding style", |
127 |
"ebuild.badheader":"This ebuild has a malformed header", |
128 |
"metadata.missing":"Missing metadata.xml files" |
119 |
} |
129 |
} |
120 |
|
130 |
|
121 |
def err(txt): |
131 |
def err(txt): |
Lines 446-452
Link Here
|
446 |
if not cladded: |
456 |
if not cladded: |
447 |
stats["changelog.notadded"]+=1 |
457 |
stats["changelog.notadded"]+=1 |
448 |
fails["changelog.notadded"].append(x+"/ChangeLog") |
458 |
fails["changelog.notadded"].append(x+"/ChangeLog") |
449 |
|
459 |
#metadata.xml file check |
|
|
460 |
if "metadata.xml" not in checkdirlist: |
461 |
stats["metadata.missing"]+=1 |
462 |
fails["metadata.missing"].append(x+"/metadata.xml") |
463 |
|
450 |
for y in ebuildlist: |
464 |
for y in ebuildlist: |
451 |
if y not in eadded: |
465 |
if y not in eadded: |
452 |
#ebuild not added to cvs |
466 |
#ebuild not added to cvs |
Lines 544-549
Link Here
|
544 |
if (mykey!="-*") and (myskey not in kwlist): |
558 |
if (mykey!="-*") and (myskey not in kwlist): |
545 |
stats["KEYWORDS.invalid"]=stats["KEYWORDS.invalid"]+1 |
559 |
stats["KEYWORDS.invalid"]=stats["KEYWORDS.invalid"]+1 |
546 |
fails["KEYWORDS.invalid"].append(x+"/"+y+".ebuild: %s" % mykey) |
560 |
fails["KEYWORDS.invalid"].append(x+"/"+y+".ebuild: %s" % mykey) |
|
|
561 |
#syntax checks |
562 |
gentoo_copyright = re.compile(r'^# Copyright 1999-' + strftime("%Y", gmtime()) + r' Gentoo Technologies, Inc\.') |
563 |
gentoo_license = re.compile(r'^# Distributed under the terms of the GNU General Public License v2$') |
564 |
ignore_line = re.compile(r'(^$)|(^(\t)*#)') |
565 |
leading_spaces = re.compile(r'^[\S\t]') |
566 |
trailing_whitespace = re.compile(r'.*([\S]$)') |
567 |
continuation_symbol = re.compile(r'(.*[ ]+[\\][ ].*)') |
568 |
line_continuation_quoted = re.compile(r'(\"|\')(([\w ,:;#\[\]\.`=/|\$\^\*{}()\'-])|(\\.))*\1') |
569 |
line_continuation = re.compile(r'([^#]*\S)(\s+|\t)\\$') |
570 |
linenum=0 |
571 |
for line in input(checkdir+"/"+y+".ebuild"): |
572 |
linenum += 1 |
573 |
# Gentoo copyright check |
574 |
if linenum == 1: |
575 |
match = gentoo_copyright.match(line) |
576 |
if not match: |
577 |
myerrormsg = "Copyright header Error. Possibly date related." |
578 |
stats["ebuild.badheader"] +=1 |
579 |
fails["ebuild.badheader"].append(x+"/"+y+".ebuild: %s" % myerrormsg) |
580 |
# Gentoo license check |
581 |
elif linenum == 2: |
582 |
match = gentoo_license.match(line) |
583 |
if not match: |
584 |
myerrormsg = "Gentoo License Error." |
585 |
stats["ebuild.badheader"] +=1 |
586 |
fails["ebuild.badheader"].append(x+"/"+y+".ebuild: %s" % myerrormsg) |
587 |
else: |
588 |
match = ignore_line.match(line) |
589 |
if not match: |
590 |
# Excluded Blank lines and full line comments. Good! |
591 |
# Leading Spaces Check |
592 |
match = leading_spaces.match(line) |
593 |
if not match: |
594 |
#Line has got leading spaces. Bad! |
595 |
myerrormsg = "Leading Space Syntax Error. Line %d" % linenum |
596 |
stats["ebuild.minorsyn"] +=1 |
597 |
fails["ebuild.minorsyn"].append(x+"/"+y+".ebuild: %s" % myerrormsg) |
598 |
# Trailing whitespace check |
599 |
match = trailing_whitespace.match(line) |
600 |
if not match: |
601 |
#Line has got trailing whitespace. Bad! |
602 |
myerrormsg = "Trailing whitespace Syntax Error. Line %d" % linenum |
603 |
stats["ebuild.minorsyn"] +=1 |
604 |
fails["ebuild.minorsyn"].append(x+"/"+y+".ebuild: %s" % myerrormsg) |
605 |
# Line continuation check |
606 |
match = continuation_symbol.match(line) |
607 |
if match: |
608 |
#Excluded lines not even containing a " \" match. Good! |
609 |
line = re.sub(line_continuation_quoted,"\"\"",line) |
610 |
#line has been edited to collapsed "" and '' quotes to "". Good! |
611 |
match = continuation_symbol.match(line) |
612 |
if match: |
613 |
#Again exclude lines not even containing a " \" match. Good! |
614 |
#This repetition is done for a slight performance increase |
615 |
match = line_continuation.match(line) |
616 |
if not match: |
617 |
#Line has a line continuation error. Bad! |
618 |
myerrormsg = "Line continuation (\"\\\") Syntax Error. Line %d" % linenum |
619 |
stats["ebuild.majorsyn"] +=1 |
620 |
fails["ebuild.majorsyn"].append(x+"/"+y+".ebuild: %s" % myerrormsg) |
547 |
|
621 |
|
548 |
# Check for 'all unstable' or 'all masked' -- ACCEPT_KEYWORDS is stripped |
622 |
# Check for 'all unstable' or 'all masked' -- ACCEPT_KEYWORDS is stripped |
549 |
# XXX -- Needs to be implemented in dep code. Can't determine ~arch nicely. |
623 |
# XXX -- Needs to be implemented in dep code. Can't determine ~arch nicely. |