summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-04-25 21:24:23 +0000
committerZac Medico <zmedico@gentoo.org>2006-04-25 21:24:23 +0000
commitef472c756b09ba9b01a9627300ea1e3a1db33730 (patch)
treea7cd91a71e00186f0dcf3867ea3d8b6c28aa51fc
parentValidate the resume merge list in --ask and --pretend mode for bug #128455. (diff)
downloadportage-ef472c756b09ba9b01a9627300ea1e3a1db33730.tar.gz
portage-ef472c756b09ba9b01a9627300ea1e3a1db33730.tar.bz2
portage-ef472c756b09ba9b01a9627300ea1e3a1db33730.zip
Fix false variable.readonly match on continued lines. Thanks to Flameeyes for reporting.
svn path=/main/trunk/; revision=3236
-rwxr-xr-xbin/repoman7
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/repoman b/bin/repoman
index 5c3b13193..f7f542a2d 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -1219,6 +1219,7 @@ for x in scanlist:
line_continuation_quoted = re.compile(r'(\"|\')(([\w ,:;#\[\]\.`=/|\$\^\*{}()\'-])|(\\.))*\1')
line_continuation = re.compile(r'([^#]*\S)(\s+|\t)\\$')
linenum=0
+ previous_line = None
for line in input(checkdir+"/"+y+".ebuild"):
linenum += 1
# Gentoo copyright check
@@ -1262,7 +1263,9 @@ for x in scanlist:
fails["ebuild.minorsyn"].append(x+"/"+y+".ebuild: %s" % myerrormsg)
# Readonly variable assignment check
match = readonly_assignment.match(line)
- if match:
+ # The regex can give a false positive for continued lines,
+ # so we check the previous line to see if it was continued.
+ if match and (not previous_line or not line_continuation.match(previous_line)):
# invalid assignment, very bad!
myerrormsg = "Readonly variable assignment to %s on line %d" % (match.group(2), linenum)
stats["variable.readonly"] += 1
@@ -1283,6 +1286,8 @@ for x in scanlist:
myerrormsg = "Line continuation (\"\\\") Syntax Error. Line %d" % linenum
stats["ebuild.majorsyn"] +=1
fails["ebuild.majorsyn"].append(x+"/"+y+".ebuild: %s" % myerrormsg)
+ previous_line = line
+ del previous_line
# Check for 'all unstable' or 'all masked' -- ACCEPT_KEYWORDS is stripped
# XXX -- Needs to be implemented in dep code. Can't determine ~arch nicely.