patch config.guess after autoreconf step (#4604)
This commit is contained in:
parent
e003e2f78b
commit
28cb1e4379
@ -95,10 +95,15 @@ class AutotoolsPackage(PackageBase):
|
|||||||
#: Options to be passed to autoreconf when using the default implementation
|
#: Options to be passed to autoreconf when using the default implementation
|
||||||
autoreconf_extra_args = []
|
autoreconf_extra_args = []
|
||||||
|
|
||||||
|
@run_after('autoreconf')
|
||||||
def _do_patch_config_guess(self):
|
def _do_patch_config_guess(self):
|
||||||
"""Some packages ship with an older config.guess and need to have
|
"""Some packages ship with an older config.guess and need to have
|
||||||
this updated when installed on a newer architecture."""
|
this updated when installed on a newer architecture."""
|
||||||
|
|
||||||
|
if not self.patch_config_guess or not self.spec.satisfies(
|
||||||
|
'arch=linux-rhel7-ppc64le'
|
||||||
|
):
|
||||||
|
return
|
||||||
my_config_guess = None
|
my_config_guess = None
|
||||||
config_guess = None
|
config_guess = None
|
||||||
if os.path.exists('config.guess'):
|
if os.path.exists('config.guess'):
|
||||||
@ -120,11 +125,11 @@ def _do_patch_config_guess(self):
|
|||||||
try:
|
try:
|
||||||
check_call([my_config_guess], stdout=PIPE, stderr=PIPE)
|
check_call([my_config_guess], stdout=PIPE, stderr=PIPE)
|
||||||
# The package's config.guess already runs OK, so just use it
|
# The package's config.guess already runs OK, so just use it
|
||||||
return True
|
return
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
return True
|
return
|
||||||
|
|
||||||
# Look for a spack-installed automake package
|
# Look for a spack-installed automake package
|
||||||
if 'automake' in self.spec:
|
if 'automake' in self.spec:
|
||||||
@ -149,11 +154,11 @@ def _do_patch_config_guess(self):
|
|||||||
mod = stat(my_config_guess).st_mode & 0o777 | S_IWUSR
|
mod = stat(my_config_guess).st_mode & 0o777 | S_IWUSR
|
||||||
os.chmod(my_config_guess, mod)
|
os.chmod(my_config_guess, mod)
|
||||||
shutil.copyfile(config_guess, my_config_guess)
|
shutil.copyfile(config_guess, my_config_guess)
|
||||||
return True
|
return
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return False
|
raise RuntimeError('Failed to find suitable config.guess')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def configure_directory(self):
|
def configure_directory(self):
|
||||||
@ -176,20 +181,6 @@ def build_directory(self):
|
|||||||
"""Override to provide another place to build the package"""
|
"""Override to provide another place to build the package"""
|
||||||
return self.configure_directory
|
return self.configure_directory
|
||||||
|
|
||||||
def patch(self):
|
|
||||||
"""Patches config.guess if
|
|
||||||
:py:attr:``~.AutotoolsPackage.patch_config_guess`` is True
|
|
||||||
|
|
||||||
:raise RuntimeError: if something goes wrong when patching
|
|
||||||
``config.guess``
|
|
||||||
"""
|
|
||||||
|
|
||||||
if self.patch_config_guess and self.spec.satisfies(
|
|
||||||
'arch=linux-rhel7-ppc64le'
|
|
||||||
):
|
|
||||||
if not self._do_patch_config_guess():
|
|
||||||
raise RuntimeError('Failed to find suitable config.guess')
|
|
||||||
|
|
||||||
@run_before('autoreconf')
|
@run_before('autoreconf')
|
||||||
def delete_configure_to_force_update(self):
|
def delete_configure_to_force_update(self):
|
||||||
if self.force_autoreconf:
|
if self.force_autoreconf:
|
||||||
|
Loading…
Reference in New Issue
Block a user