From ff40a09812839da695eba0c993a77a8856b902c8 Mon Sep 17 00:00:00 2001 From: Alec Warner Date: Mon, 1 Oct 2007 12:28:17 +0000 Subject: [PATCH] Apply new checks, minor cleanup svn path=/main/trunk/; revision=7899 --- bin/repoman | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/bin/repoman b/bin/repoman index 2d3ea5c66..a3b86e358 100755 --- a/bin/repoman +++ b/bin/repoman @@ -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 '^[^#]*\([^)]*\' "+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: -- 2.26.2