[jhbuild] autotools: Don't run autogen.sh/configure if newer than configure.ac



commit 81abb5e8de16aefd42788719ec3e880ec63dfde2
Author: Colin Walters <walters verbum org>
Date:   Mon Nov 21 11:03:31 2011 -0500

    autotools: Don't run autogen.sh/configure if newer than configure.ac
    
    This should avoid the main problems of autoreconf != autogen.sh while
    still maintaining speed in the unmodified configure.ac case.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=660844

 jhbuild/commands/make.py      |    1 -
 jhbuild/config.py             |    5 -----
 jhbuild/modtypes/autotools.py |   27 +++++++++++++++++++++++++--
 jhbuild/modtypes/waf.py       |    3 ---
 4 files changed, 25 insertions(+), 11 deletions(-)
---
diff --git a/jhbuild/commands/make.py b/jhbuild/commands/make.py
index d5ee54c..aad0045 100644
--- a/jhbuild/commands/make.py
+++ b/jhbuild/commands/make.py
@@ -58,7 +58,6 @@ class cmd_make(Command):
         # Explicitly don't touch the network for this
         options.nonetwork = True
         options.force_policy = True
-        config._internal_noautogen = not options.autogen
         config.set_from_cmdline_options(options)
 
         makeargs = config.makeargs
diff --git a/jhbuild/config.py b/jhbuild/config.py
index f85217f..49ee693 100644
--- a/jhbuild/config.py
+++ b/jhbuild/config.py
@@ -62,8 +62,6 @@ _known_keys = [ 'moduleset', 'modules', 'skip', 'tags', 'prefix',
                 'cmakeargs', 'module_cmakeargs', 'print_command_pattern',
                 'static_analyzer', 'module_static_analyzer', 'static_analyzer_template', 'static_analyzer_outputdir',
                 'check_sysdeps',
-                # Internal only keys (propagated from command line options)
-                '_internal_noautogen',
                 ]
 
 env_prepends = {}
@@ -185,9 +183,6 @@ class Config:
                 raise FatalError(
                     _('Obsolete JHBuild start script, make sure it is removed '
                       'then do run \'make install\''))
-            
-        # Set defaults for internal variables
-        self._config['_internal_noautogen'] = False
 
         env_prepends.clear()
         try:
diff --git a/jhbuild/modtypes/autotools.py b/jhbuild/modtypes/autotools.py
index f40d839..95eb95a 100644
--- a/jhbuild/modtypes/autotools.py
+++ b/jhbuild/modtypes/autotools.py
@@ -27,6 +27,7 @@ import stat
 from jhbuild.errors import FatalError, BuildStateError, CommandError
 from jhbuild.modtypes import \
      DownloadableModule, register_module_type, MakeModule
+from jhbuild.versioncontrol.tarball import TarballBranch
 
 __all__ = [ 'AutogenModule' ]
 
@@ -80,6 +81,14 @@ class AutogenModule(MakeModule, DownloadableModule):
         else:
             return self.get_srcdir(buildscript)
 
+    def _file_exists_and_is_newer_than(self, potential, other):
+        try:
+            other_stbuf = os.stat(other)
+            potential_stbuf = os.stat(potential)
+        except OSError, e:
+            return False
+        return potential_stbuf.st_mtime > other_stbuf.st_mtime
+
     def skip_configure(self, buildscript, last_phase):
         # skip if manually instructed to do so
         if self.skip_autogen is True:
@@ -96,8 +105,22 @@ class AutogenModule(MakeModule, DownloadableModule):
         if self.skip_autogen == 'never':
             return False
 
-        if buildscript.config._internal_noautogen:
-            return True
+        # We can't rely on the autotools maintainer-mode stuff because many
+        # modules' autogen.sh script includes e.g. gtk-doc and/or intltool,
+        # which also need to be rerun.
+        # https://bugzilla.gnome.org/show_bug.cgi?id=660844
+        if not isinstance(self.branch, TarballBranch):
+            configsrc = None
+            srcdir = self.get_srcdir(buildscript)
+            for name in ['configure.ac', 'configure.in']:
+                path = os.path.join(srcdir, name)
+                if os.path.exists(path):
+                    configsrc = path
+                    break
+            if configsrc is not None:
+                configure = os.path.join(srcdir, 'configure')
+                if self._file_exists_and_is_newer_than(configure, configsrc):
+                    return True
 
         return False
 
diff --git a/jhbuild/modtypes/waf.py b/jhbuild/modtypes/waf.py
index 6edb5ca..10c3942 100644
--- a/jhbuild/modtypes/waf.py
+++ b/jhbuild/modtypes/waf.py
@@ -64,9 +64,6 @@ class WafModule(Package, DownloadableModule):
                           self.PHASE_INSTALL]:
             return False
 
-        if buildscript.config._internal_noautogen:
-            return True
-
         return False
 
     def do_configure(self, buildscript):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]