summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorJason Stubbs <jstubbs@gentoo.org>2005-12-25 10:17:43 +0000
committerJason Stubbs <jstubbs@gentoo.org>2005-12-25 10:17:43 +0000
commit7a06a1c15704b6df9e2b0adea209fa633d39df20 (patch)
tree03617f6b68d8902b047f83d93aee346f941d01e8 /bin
parentcb9e32a10b4115398bf0299689c00a48ffbc1d33 (diff)
downloadportage-7a06a1c15704b6df9e2b0adea209fa633d39df20.tar.gz
portage-7a06a1c15704b6df9e2b0adea209fa633d39df20.tar.bz2
portage-7a06a1c15704b6df9e2b0adea209fa633d39df20.zip
Check for adequate spacing around "||", "(" and ")" tokens.
svn path=/main/trunk/; revision=2466
Diffstat (limited to 'bin')
-rwxr-xr-xbin/repoman46
1 files changed, 34 insertions, 12 deletions
diff --git a/bin/repoman b/bin/repoman
index 85136e886..8937a5799 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -117,6 +117,7 @@ qahelp={
"RDEPEND.syntax":"Syntax error in RDEPEND (usually an extra/missing space/parenthesis)",
"PDEPEND.syntax":"Syntax error in PDEPEND (usually an extra/missing space/parenthesis)",
"LICENSE.syntax":"Syntax error in LICENSE (usually an extra/missing space/parenthesis)",
+ "PROVIDE.syntax":"Syntax error in PROVIDE (usually an extra/missing space/parenthesis)",
"ebuild.syntax":"Error generating cache entry for ebuild; typically caused by ebuild syntax error",
"ebuild.output":"A simple sourcing of the ebuild produces output; this breaks ebuild policy.",
"ebuild.nesteddie":"Placing 'die' inside ( ) prints an error, but doesn't stop the ebuild.",
@@ -956,29 +957,50 @@ for x in scanlist:
baddepsyntax = False
badlicsyntax = False
+ badprovsyntax = False
catpkg = catdir+"/"+y
- for mytype in ["DEPEND","RDEPEND","PDEPEND","LICENSE"]:
+ for mytype in ("DEPEND", "RDEPEND", "PDEPEND", "LICENSE", "PROVIDE"):
mydepstr = myaux[mytype]
+ badsyntax = None
+
if (string.find(mydepstr, " ?") != -1):
- stats[mytype+".syntax"] += 1
- fails[mytype+".syntax"].append(catpkg+".ebuild "+mytype+": '?' preceded by space")
- if mytype != "LICENSE":
- baddepsyntax = True
- else:
- badlicsyntax = True
+ badsyntax = "'?' preceded by space"
+
try:
# Missing closing parenthesis will result in a ValueError
- mydeplist=portage_dep.paren_reduce(mydepstr)
+ mydeplist = portage_dep.paren_reduce(mydepstr)
# Missing opening parenthesis will result in a final "" element
if "" in mydeplist or "(" in mydeplist:
raise ValueError
except ValueError:
- stats[mytype+".syntax"] += 1
- fails[mytype+".syntax"].append(catpkg+".ebuild "+mytype+": Mismatched parenthesis")
- if mytype != "LICENSE":
- baddepsyntax = True
+ badsyntax = "parenthesis mismatch"
+
+ for token in ("||", "(", ")"):
+ if mydepstr.startswith(token+" "):
+ myteststr = mydepstr[len(token):]
else:
+ myteststr = mydepstr
+ if myteststr.endswith(" "+token):
+ myteststr = myteststr[:-len(token)]
+ while myteststr.find(" "+token+" ") != -1:
+ myteststr = " ".join(myteststr.split(" "+token+" ", 1))
+ if myteststr.find(token) != -1:
+ print mydepstr
+ print myteststr
+ print token
+ badsyntax = "'%s' not separated by space" % (token)
+ break
+
+ if badsyntax:
+ stats[mytype+".syntax"] += 1
+ fails[mytype+".syntax"].append(catpkg+".ebuild "+mytype+": "+badsyntax)
+ if mytype == "LICENSE":
badlicsyntax = True
+ elif mytype == "PROVIDE":
+ badprovsyntax = True
+ else:
+ baddepsyntax = True
+ continue
for keyword,arch,groups in arches:
portage.groups=groups