[jhbuild] Add a uninstall-before-install attribute to <autotools/>



commit 23e816b8c3651fb9d5fe613e24436e3e63adbab5
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Mon Dec 2 10:41:51 2013 -0500

    Add a uninstall-before-install attribute to <autotools/>
    
    Add an option to remove the installed copy of a module before
    installing the new version. This is useful to work around problems
    with libtool relinking.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=677672

 doc/C/index.docbook           |   11 +++++++++++
 jhbuild/modtypes/autotools.py |   11 +++++++++++
 modulesets/moduleset.dtd      |    1 +
 modulesets/moduleset.rnc      |    1 +
 4 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/doc/C/index.docbook b/doc/C/index.docbook
index 1d80718..413befe 100644
--- a/doc/C/index.docbook
+++ b/doc/C/index.docbook
@@ -2778,6 +2778,7 @@ Optional packages: (JHBuild will build the missing packages)
              [ makefile="<replaceable>makefile</replaceable>" ]
              [ skip-autogen="<replaceable>skip-autogen</replaceable>" ]
              [ skip-install="<replaceable>skip-install</replaceable>" ]
+             [ uninstall-before-install="<replaceable>uninstall-before-install</replaceable>" ]
              [ autogen-template="<replaceable>autogen-template</replaceable>" ]
              [ check-target="<replaceable>check-target</replaceable>" ]
              [ supports-non-srcdir-builds="<replaceable>supports-non-srcdir-builds</replaceable>" ]&gt;
@@ -2820,6 +2821,16 @@ Optional packages: (JHBuild will build the missing packages)
           command on the module. <sgmltag class="attribute">makefile</sgmltag>
           specifies the filename of the makefile to use.</para>
 
+       <para>The <sgmltag class="attribute">uninstall-before-install</sgmltag>
+         specifies any old installed files from the module should before removed
+         before running the install step. This can be used to work around a
+         problem where libtool tries to link one library it is installing
+         against another library it is installing, but because of jhbuild's
+         use of DESTDIR, finds the old installed library instead. The downside
+          of specifying this is that it could cause problems if the user is
+         currently running code that relies on installed files from the
+         module.</para>
+
         <para>The
           <sgmltag class="attribute">supports-non-srcdir-builds</sgmltag>
           attribute is used to mark modules that can't be cleanly built using a
diff --git a/jhbuild/modtypes/autotools.py b/jhbuild/modtypes/autotools.py
index 0271ac4..e1fa895 100644
--- a/jhbuild/modtypes/autotools.py
+++ b/jhbuild/modtypes/autotools.py
@@ -56,6 +56,7 @@ class AutogenModule(MakeModule, DownloadableModule):
                  supports_non_srcdir_builds=True,
                  skip_autogen=False,
                  skip_install_phase=False,
+                 uninstall_before_install=False,
                  autogen_sh='autogen.sh',
                  makefile='Makefile',
                  autogen_template=None,
@@ -67,6 +68,7 @@ class AutogenModule(MakeModule, DownloadableModule):
         self.supports_non_srcdir_builds = supports_non_srcdir_builds
         self.skip_autogen = skip_autogen
         self.skip_install_phase = skip_install_phase
+        self.uninstall_before_install = uninstall_before_install
         self.autogen_sh = autogen_sh
         self.autogen_template = autogen_template
         self.check_target = check_target
@@ -320,6 +322,12 @@ class AutogenModule(MakeModule, DownloadableModule):
     do_distcheck.error_phases = [PHASE_FORCE_CHECKOUT, PHASE_CONFIGURE]
 
     def do_install(self, buildscript):
+        buildscript.set_action(_('Uninstalling old installed version'), self)
+        if self.uninstall_before_install:
+            packagedb =  buildscript.moduleset.packagedb
+            if packagedb.check(self.name):
+                packagedb.uninstall(self.name)
+
         buildscript.set_action(_('Installing'), self)
         destdir = self.prepare_installroot(buildscript)
         if self.makeinstallargs:
@@ -369,6 +377,7 @@ class AutogenModule(MakeModule, DownloadableModule):
                   'supports_non_srcdir_builds', True),
                  ('skip-autogen', 'skip_autogen', False),
                  ('skip-install', 'skip_install_phase', False),
+                 ('uninstall-before-install', 'uninstall_before_install', False),
                  ('autogen-sh', 'autogen_sh', 'autogen.sh'),
                  ('makefile', 'makefile', 'Makefile'),
                  ('supports-static-analyzer', 'supports_static_analyzer', True),
@@ -410,6 +419,8 @@ def parse_autotools(node, config, uri, repositories, default_repo):
             instance.skip_install_phase = True
         else:
             instance.skip_install_phase = False
+    if node.hasAttribute('uninstall-before-install'):
+        instance.uninstall_before_install = (node.getAttribute('uninstall-before-install') == 'true')
 
     if node.hasAttribute('check-target'):
         instance.check_target = (node.getAttribute('check-target') == 'true')
diff --git a/modulesets/moduleset.dtd b/modulesets/moduleset.dtd
index bad1c0f..15a2e85 100644
--- a/modulesets/moduleset.dtd
+++ b/modulesets/moduleset.dtd
@@ -58,6 +58,7 @@
        autogen-sh      CDATA   #IMPLIED
        makefile        CDATA   #IMPLIED
        skip-autogen    (true|false|never) "false"
+       uninstall-before-install (true|false) "false"
        supports-non-srcdir-builds (yes|no) "yes"
        supports-parallel-builds (yes|no) "yes"
        autogen-template CDATA  #IMPLIED
diff --git a/modulesets/moduleset.rnc b/modulesets/moduleset.rnc
index dabe7ab..b7bac99 100644
--- a/modulesets/moduleset.rnc
+++ b/modulesets/moduleset.rnc
@@ -89,6 +89,7 @@ attlist.autotools &=
   [ a:defaultValue = "false" ]
   attribute skip-autogen { "true" | "false" | "never" }?,
   [ a:defaultValue = "yes" ]
+  attribute uninstall-before-install { "true" | "false" }?,
   attribute supports-non-srcdir-builds { "yes" | "no" }?,
   attribute supports-parallel-builds { "yes" | "no" }?,
   attribute autogen-template { text }?,


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