summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-11-05 06:50:39 +0000
committerZac Medico <zmedico@gentoo.org>2007-11-05 06:50:39 +0000
commit80e42fdf33ccdea0a6a15d067d884e049b6f1a39 (patch)
treecb7d45d1ac11d229bce098f25de4e0e601606a20
parentb791f6f76a70f5b7556abf017a9c8e8405dbeb34 (diff)
downloadportage-80e42fdf33ccdea0a6a15d067d884e049b6f1a39.tar.gz
portage-80e42fdf33ccdea0a6a15d067d884e049b6f1a39.tar.bz2
portage-80e42fdf33ccdea0a6a15d067d884e049b6f1a39.zip
Port the EbuildNestedDie check from trunk since the
python version is much faster than the old one that uses grep. svn path=/main/branches/2.1.2/; revision=8430
-rwxr-xr-xbin/repoman29
1 files changed, 25 insertions, 4 deletions
diff --git a/bin/repoman b/bin/repoman
index d1445d3d5..149dd1729 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -818,6 +818,24 @@ class EbuildQuote(object):
break
return errors
+class EbuildNestedDie(object):
+ """Check ebuild for nested die statements (die statements in subshells"""
+
+ repoman_check_name = 'ebuild.nesteddie'
+ nesteddie_re = re.compile(r'^[^#]*\([^)]*\bdie\b')
+
+ def __init__(self, contents):
+ self.contents = contents
+
+ def Run(self):
+ errors = []
+ for num, line in enumerate(self.contents):
+ match = self.nesteddie_re.match(line)
+ if match:
+ errors.append((num + 1,
+ 'Ebuild calls die in a subshell on line: %d'))
+ return errors
+
class EbuildUselessDodoc(object):
"""Check ebuild for useless files in dodoc arguments."""
repoman_check_name = 'ebuild.minorsyn'
@@ -1403,10 +1421,6 @@ for x in scanlist:
stats["usage.obsolete"] += 1
fails["usage.obsolete"].append("%s/%s.ebuild: not migrated to modular X" % (x, y))
- # this check needs work, it won't catch (\ndie)
- if not os.system("egrep '^[^#]*\([^)]*\<die\>' "+checkdir+"/"+y+".ebuild >/dev/null 2>&1"):
- stats["ebuild.nesteddie"]=stats["ebuild.nesteddie"]+1
- fails["ebuild.nesteddie"].append(x+"/"+y+".ebuild")
# uselist checks - global
myuse = []
default_use = []
@@ -1493,6 +1507,13 @@ for x in scanlist:
stats[c.repoman_check_name] += 1
fails[c.repoman_check_name].append(x + '/' + y + '.ebuild: %s' % e[1] % e[0])
del check
+ check = EbuildNestedDie(contents)
+ errors = check.Run()
+ for e in errors:
+ stats[check.repoman_check_name] += 1
+ fails[check.repoman_check_name].append(
+ x + '/' + y + '.ebuild: %s' % e[1] % e[0])
+ del check
gentoo_copyright = re.compile(r'^# Copyright ((1999|200\d)-)?' + str(myear) + r' Gentoo Foundation')
gentoo_license = re.compile(r'^# Distributed under the terms of the GNU General Public License v2$')