As suggested by Flameeyes, add a new 'inherit.autotools' check which warns
authorZac Medico <zmedico@gentoo.org>
Sat, 7 Jun 2008 22:07:21 +0000 (22:07 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 7 Jun 2008 22:07:21 +0000 (22:07 -0000)
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

bin/repoman
man/repoman.1
pym/repoman/checks.py

index cf8047eaf10ed0ba9b6ee5f77d0e6b863c3c3321..3cabe0a73368781547e98c61f923321356ae469e 100755 (executable)
@@ -255,6 +255,7 @@ qahelp={
        "file.size":"Files in the files directory must be under 20k",
        "file.name":"File/dir name must be composed of only the following chars: %s " % allowed_filename_chars,
        "file.UTF8":"File is not UTF8 compliant",
+       "inherit.autotools":"Ebuild inherits autotools but does not call eautomake, eautoconf or eautoreconf",
        "java.eclassesnotused":"With virtual/jdk in DEPEND you must inherit a java eclass",
        "KEYWORDS.dropped":"Ebuilds that appear to have dropped KEYWORDS for some arch",
        "KEYWORDS.missing":"Ebuilds that have a missing or empty KEYWORDS variable",
@@ -335,6 +336,7 @@ qawarnings=[
 "ebuild.badheader",
 "ebuild.patches",
 "file.size",
+"inherit.autotools",
 "java.eclassesnotused",
 "metadata.missing",
 "metadata.bad",
@@ -1073,7 +1075,7 @@ for x in scanlist:
 
                myaux = ebuild_metadata[y]
                eapi = myaux["EAPI"]
-               inherited = myaux["INHERITED"].split()
+               inherited = frozenset(myaux["INHERITED"].split())
 
                # Test for negative logic and bad words in the RESTRICT var.
                #for x in myaux[allvars.index("RESTRICT")].split():
@@ -1381,7 +1383,8 @@ for x in scanlist:
                full_path = os.path.join(repodir, relative_path)
                f = open(full_path, 'rb')
                try:
-                       for check_name, e in run_checks(f, os.stat(full_path).st_mtime):
+                       for check_name, e in run_checks(f, os.stat(full_path).st_mtime,
+                               inherited=inherited):
                                stats[check_name] += 1
                                fails[check_name].append(relative_path + ': %s' % e)
                finally:
index a9e240140cd28e4188586517afbeeb1c67675fed..eddba39197b9160768e3ee87c30ce5409a31155c 100644 (file)
@@ -244,6 +244,9 @@ Files in the files directory must be under 20k
 .B filedir.missing
 Package lacks a files directory
 .TP
+.B inherit.autotools
+Ebuild inherits autotools but does not call eautomake, eautoconf or eautoreconf
+.TP
 .B java.eclassesnotused
 With virtual/jdk in DEPEND you must inherit a java eclass. Refer to
 \fIhttp://www.gentoo.org/proj/en/java/java\-devel.xml\fR for more information.
index 0a314518c8d0e87fedef7d08febafa3b5c6232c6..bfd06bc34d8772bc7e63e469f7ca654ba3b753c0 100644 (file)
@@ -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'