From 03b1ed2f3e1af3a6f64c6e9b51b073a81d1b9789 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 7 Jun 2008 22:07:21 +0000 Subject: As suggested by Flameeyes, add a new 'inherit.autotools' check which warns when autotools has been inherited but none of the eautomake, eautoconf or eautoreconf functions are called like they are supposed to be. svn path=/main/trunk/; revision=10592 --- pym/repoman/checks.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'pym/repoman/checks.py') diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py index 0a314518c..bfd06bc34 100644 --- a/pym/repoman/checks.py +++ b/pym/repoman/checks.py @@ -218,14 +218,22 @@ _constant_checks = tuple((c() for c in ( EbuildPatches, EbuildQuotedA))) _iuse_def_re = re.compile(r'^IUSE=.*') +_comment_re = re.compile(r'(^|\s*)#') +_autotools_func_re = re.compile(r'(^|\s)(eautomake|eautoconf|eautoreconf)(\s|$)') -def run_checks(contents, st_mtime): +def run_checks(contents, st_mtime, inherited=None): checks = list(_constant_checks) checks.append(EbuildHeader(st_mtime)) iuse_def = None + inherit_autotools = inherited and "autotools" in inherited + autotools_func_call = None for num, line in enumerate(contents): - if iuse_def is None: - iuse_def = _iuse_def_re.match(line) + comment = _comment_re.match(line) + if comment is None: + if inherit_autotools and autotools_func_call is None: + autotools_func_call = _autotools_func_re.search(line) + if iuse_def is None: + iuse_def = _iuse_def_re.match(line) for lc in checks: ignore = lc.ignore_line if not ignore or not ignore.match(line): @@ -234,3 +242,5 @@ def run_checks(contents, st_mtime): yield lc.repoman_check_name, e % (num + 1) if iuse_def is None: yield 'ebuild.minorsyn', 'IUSE is not defined' + if inherit_autotools and autotools_func_call is None: + yield 'inherit.autotools', 'no eauto* function called' -- cgit v1.2.3-1-g7c22