diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-10-23 00:27:33 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-10-23 00:27:33 +0000 |
commit | aeded62f174cf81546dce548b89c58d356dd7bb0 (patch) | |
tree | 310b77a640f3b9c6e8fcc571e410587fe5b264a2 | |
parent | 1ef70e0e0b222b24d5288abe07793f6e6e0289d5 (diff) | |
download | portage-aeded62f174cf81546dce548b89c58d356dd7bb0.tar.gz portage-aeded62f174cf81546dce548b89c58d356dd7bb0.tar.bz2 portage-aeded62f174cf81546dce548b89c58d356dd7bb0.zip |
Bug #196652 - Check for useless ABOUT-NLS|COPYING|LICENSE
files in dodoc arguments.
svn path=/main/trunk/; revision=8236
-rwxr-xr-x | bin/repoman | 7 | ||||
-rw-r--r-- | pym/repoman/checks.py | 19 |
2 files changed, 23 insertions, 3 deletions
diff --git a/bin/repoman b/bin/repoman index c133eb02d..01a7f61bb 100755 --- a/bin/repoman +++ b/bin/repoman @@ -51,12 +51,12 @@ del os.environ["PORTAGE_LEGACY_GLOBALS"] try: from repoman.checks import EbuildWhitespace, EbuildHeader, EbuildQuote, \ - EbuildAssignment, EbuildNestedDie + EbuildAssignment, EbuildNestedDie, EbuildUselessDodoc 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 EbuildWhitespace, EbuildHeader, EbuildQuote, \ - EbuildAssignment, EbuildNestedDie + EbuildAssignment, EbuildNestedDie, EbuildUselessDodoc import portage.checksum import portage.const @@ -1382,7 +1382,8 @@ 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 (EbuildWhitespace, EbuildQuote, EbuildAssignment): + for check in (EbuildWhitespace, EbuildQuote, + EbuildAssignment, EbuildUselessDodoc): c = check(contents) errors = c.Run() for e in errors: diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py index d956b83f8..93c3222b3 100644 --- a/pym/repoman/checks.py +++ b/pym/repoman/checks.py @@ -224,3 +224,22 @@ class EbuildNestedDie(ContentCheck): if match: errors.append((num + 1, NESTED_DIE_ERROR)) return errors + +class EbuildUselessDodoc(ContentCheck): + """Check ebuild for useless files in dodoc arguments.""" + repoman_check_name = 'ebuild.minorsyn' + uselessdodoc_re = re.compile( + r'^\s*dodoc(\s+|\s+.*\s+)(ABOUT-NLS|COPYING|LICENSE)($|\s)') + + def __init__(self, contents): + ContentCheck.__init__(self, contents) + + def Run(self): + errors = [] + uselessdodoc_re = self.uselessdodoc_re + for num, line in enumerate(self.contents): + match = uselessdodoc_re.match(line) + if match: + errors.append((num + 1, "Useless dodoc '%s'" % \ + (match.group(2), ) + " on line: %d")) + return errors |