Apply new checks, minor cleanup
authorAlec Warner <antarus@gentoo.org>
Mon, 1 Oct 2007 12:28:17 +0000 (12:28 -0000)
committerAlec Warner <antarus@gentoo.org>
Mon, 1 Oct 2007 12:28:17 +0000 (12:28 -0000)
svn path=/main/trunk/; revision=7899

bin/repoman

index 2d3ea5c667a3d52936c025c9fd5de9c8d488b527..a3b86e3586435b3a832369eb764fab4a7b1408e5 100755 (executable)
@@ -53,8 +53,8 @@ try:
 except ImportError:
        from os import path as osp
        sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), 'pym'))
-       from repoman.checks import EbuildWhitespaceCheck, EbuildHeaderCheck, EbuildQuoteCheck, \
-               EbuildAssignmentCheck
+       from repoman.checks import EbuildWhitespace, EbuildHeader, EbuildQuote, \
+               EbuildAssignment, EbuildNestedDie
 
 import portage.checksum
 import portage.const
@@ -1262,10 +1262,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 = []
@@ -1340,7 +1336,7 @@ for x in scanlist:
                path = checkdir + '/' + y + '.ebuild'
                myear = time.gmtime(os.stat(path)[ST_MTIME])[0]
                contents = StringIO.StringIO(open(path, 'rb').read())
-               for check in (EbuildWhitespaceCheck, EbuildQuoteCheck, EbuildAssignmentCheck):
+               for check in (EbuildWhitespace, EbuildQuote, EbuildAssignment):
                        c = check(contents)
                        errors = c.Run()
                        for e in errors:
@@ -1348,11 +1344,18 @@ for x in scanlist:
                                fails[c.repoman_check_name].append(x + '/' + y + '.ebuild: %s' % e[1] % e[0])
                        contents.seek(0) # move fp to the beginning of the StringIO Object
                del check
-               check = EbuildHeaderCheck(contents, str(myear))
+               check = EbuildHeader(contents, str(myear))
                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])
+               contents.seek(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)
                del check, errors, path, contents, myear
 
                if "--force" in myoptions: