Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 27353 | Differences between
and this patch

Collapse All | Expand All

(-)repoman.rem (-5 / +79 lines)
Lines 8-14 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
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
from grp import getgrnam
20
from grp import getgrnam
20
21
21
if "cvs" not in portage.features:
22
if "cvs" not in portage.features:
Lines 68-74 Link Here
68
"ebuild.syntax","ebuild.output",
69
"ebuild.syntax","ebuild.output",
69
"ebuild.nesteddie","LICENSE.invalid",
70
"ebuild.nesteddie","LICENSE.invalid",
70
"IUSE.invalid","KEYWORDS.invalid",
71
"IUSE.invalid","KEYWORDS.invalid",
71
"ebuild.nostable","ebuild.allmasked"
72
"ebuild.nostable","ebuild.allmasked",
73
"ebuild.majorsyn", "ebuild.minorsyn",
74
"ebuild.badheader", "metadata.missing"
72
]
75
]
73
qawarnings=[
76
qawarnings=[
74
"changelog.missing",
77
"changelog.missing",
Lines 82-88 Link Here
82
"digest.unmatch",
85
"digest.unmatch",
83
"DEPEND.badmasked",
86
"DEPEND.badmasked",
84
"RDEPEND.badmasked",
87
"RDEPEND.badmasked",
85
"IUSE.invalid"
88
"IUSE.invalid",
89
"ebuild.minorsyn",
90
"ebuild.badheader",
91
"metadata.missing"
86
]
92
]
87
missingvars=["KEYWORDS","LICENSE","DESCRIPTION","SLOT"]
93
missingvars=["KEYWORDS","LICENSE","DESCRIPTION","SLOT"]
88
allvars=portage.auxdbkeys
94
allvars=portage.auxdbkeys
Lines 118-124 Link Here
118
	"LICENSE.invalid":"This ebuild is listing a license that doesnt exist in portages license/ dir.",
124
	"LICENSE.invalid":"This ebuild is listing a license that doesnt exist in portages license/ dir.",
119
	"KEYWORDS.invalid":"This ebuild contains KEYWORDS that are not listed in profiles/keywords.desc",
125
	"KEYWORDS.invalid":"This ebuild contains KEYWORDS that are not listed in profiles/keywords.desc",
120
	"ebuild.nostable":"There are no ebuilds that are marked as stable for your ARCH",
126
	"ebuild.nostable":"There are no ebuilds that are marked as stable for your ARCH",
121
	"ebuild.allmasked":"All ebuilds are masked for this package"
127
	"ebuild.allmasked":"All ebuilds are masked for this package",
128
	"ebuild.majorsyn":"This ebuild has a major syntax error that may cause the ebuild to fail partially or fully",
129
	"ebuild.minorsyn":"This ebuild has a minor syntax error that contravenes gentoo coding style",
130
	"ebuild.badheader":"This ebuild has a malformed header",
131
	"metadata.missing":"Missing metadata.xml files"
122
}
132
}
123
133
124
def err(txt):
134
def err(txt):
Lines 507-513 Link Here
507
	if not cladded:
517
	if not cladded:
508
		stats["changelog.notadded"]+=1
518
		stats["changelog.notadded"]+=1
509
		fails["changelog.notadded"].append(x+"/ChangeLog")
519
		fails["changelog.notadded"].append(x+"/ChangeLog")
510
	
520
	#metadata.xml file check
521
	if "metadata.xml" not in checkdirlist:
522
		stats["metadata.missing"]+=1
523
		fails["metadata.missing"].append(x+"/metadata.xml")
524
511
	for y in ebuildlist:
525
	for y in ebuildlist:
512
		if y not in eadded:
526
		if y not in eadded:
513
			#ebuild not added to cvs
527
			#ebuild not added to cvs
Lines 605-610 Link Here
605
			if (mykey!="-*") and (myskey not in kwlist):
619
			if (mykey!="-*") and (myskey not in kwlist):
606
				stats["KEYWORDS.invalid"]=stats["KEYWORDS.invalid"]+1
620
				stats["KEYWORDS.invalid"]=stats["KEYWORDS.invalid"]+1
607
				fails["KEYWORDS.invalid"].append(x+"/"+y+".ebuild: %s" % mykey)
621
				fails["KEYWORDS.invalid"].append(x+"/"+y+".ebuild: %s" % mykey)
622
		#syntax checks
623
		gentoo_copyright = re.compile(r'^# Copyright 1999-' + strftime("%Y", gmtime()) + r' Gentoo Technologies, Inc\.')
624
		gentoo_license = re.compile(r'^# Distributed under the terms of the GNU General Public License v2$')
625
		ignore_line = re.compile(r'(^$)|(^(\t)*#)')
626
		leading_spaces = re.compile(r'^[\S\t]')
627
		trailing_whitespace = re.compile(r'.*([\S]$)')
628
		continuation_symbol = re.compile(r'(.*[ ]+[\\][ ].*)')
629
		line_continuation_quoted = re.compile(r'(\"|\')(([\w ,:;#\[\]\.`=/|\$\^\*{}()\'-])|(\\.))*\1')
630
		line_continuation = re.compile(r'([^#]*\S)(\s+|\t)\\$')
631
		linenum=0
632
		for line in input(checkdir+"/"+y+".ebuild"):
633
			linenum += 1
634
			# Gentoo copyright check
635
			if linenum == 1:
636
				match = gentoo_copyright.match(line)
637
				if not match:
638
					myerrormsg = "Copyright header Error. Possibly date related."
639
					stats["ebuild.badheader"] +=1
640
					fails["ebuild.badheader"].append(x+"/"+y+".ebuild: %s" % myerrormsg)
641
			# Gentoo license check
642
			elif linenum == 2:
643
				match = gentoo_license.match(line)
644
				if not match:
645
					myerrormsg = "Gentoo License Error."
646
					stats["ebuild.badheader"] +=1
647
					fails["ebuild.badheader"].append(x+"/"+y+".ebuild: %s" % myerrormsg)
648
			else:
649
				match = ignore_line.match(line)
650
				if not match:
651
					# Excluded Blank lines and full line comments. Good!
652
					# Leading Spaces Check
653
					match = leading_spaces.match(line)
654
					if not match:
655
						#Line has got leading spaces. Bad!
656
						myerrormsg = "Leading Space Syntax Error. Line %d" % linenum
657
						stats["ebuild.minorsyn"] +=1
658
						fails["ebuild.minorsyn"].append(x+"/"+y+".ebuild: %s" % myerrormsg)
659
					# Trailing whitespace check
660
					match = trailing_whitespace.match(line)
661
					if not match:
662
						#Line has got trailing whitespace. Bad!
663
						myerrormsg = "Trailing whitespace Syntax Error. Line %d" % linenum
664
						stats["ebuild.minorsyn"] +=1
665
						fails["ebuild.minorsyn"].append(x+"/"+y+".ebuild: %s" % myerrormsg)
666
					# Line continuation check
667
					match = continuation_symbol.match(line)
668
					if match:
669
						#Excluded lines not even containing a " \" match. Good!
670
						line = re.sub(line_continuation_quoted,"\"\"",line)
671
						#line has been edited to collapsed "" and '' quotes to "". Good!
672
						match = continuation_symbol.match(line)
673
						if match:
674
							#Again exclude lines not even containing a " \" match. Good!
675
							#This repetition is done for a slight performance increase
676
							match = line_continuation.match(line)
677
							if not match:
678
								#Line has a line continuation error. Bad!
679
								myerrormsg = "Line continuation (\"\\\") Syntax Error. Line %d" % linenum
680
								stats["ebuild.majorsyn"] +=1
681
								fails["ebuild.majorsyn"].append(x+"/"+y+".ebuild: %s" % myerrormsg)
608
682
609
	# Check for 'all unstable' or 'all masked' -- ACCEPT_KEYWORDS is stripped
683
	# Check for 'all unstable' or 'all masked' -- ACCEPT_KEYWORDS is stripped
610
	# XXX -- Needs to be implemented in dep code. Can't determine ~arch nicely.
684
	# XXX -- Needs to be implemented in dep code. Can't determine ~arch nicely.

Return to bug 27353