diff options
author | bernhardkaindl <43588962+bernhardkaindl@users.noreply.github.com> | 2021-09-24 17:17:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-24 09:17:07 -0600 |
commit | cdbb586a93b8f1149e98b79be62856e663ff1ea5 (patch) | |
tree | a110234e2ddd6f3429dff37f95bbc3dede1d44cd /lib | |
parent | bcf708098de5db0890020cc786f7290ea99377b4 (diff) | |
download | spack-cdbb586a93b8f1149e98b79be62856e663ff1ea5.tar.gz spack-cdbb586a93b8f1149e98b79be62856e663ff1ea5.tar.bz2 spack-cdbb586a93b8f1149e98b79be62856e663ff1ea5.tar.xz spack-cdbb586a93b8f1149e98b79be62856e663ff1ea5.zip |
autotools.py/autoreconf: Show the depends_on()s to add to the package (#26115)
This commit shows a template for cut-and-paste into the package to fix it:
```py
==> fast-global-file-status: Executing phase: 'autoreconf'
==> Error: RuntimeError: Cannot generate configure: missing dependencies autoconf, automake, libtool.
Please add the following lines to the package:
depends_on('autoconf', type='build', when='@master')
depends_on('automake', type='build', when='@master')
depends_on('libtool', type='build', when='@master')
Update the version (when='@master') as needed.
```
Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/build_systems/autotools.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/lib/spack/spack/build_systems/autotools.py b/lib/spack/spack/build_systems/autotools.py index b12a1afc2e..66b5379975 100644 --- a/lib/spack/spack/build_systems/autotools.py +++ b/lib/spack/spack/build_systems/autotools.py @@ -252,17 +252,31 @@ class AutotoolsPackage(PackageBase): if self.force_autoreconf: force_remove(self.configure_abs_path) + def _autoreconf_warning(self, spec, missing): + msg = ("Cannot generate configure: missing dependencies {0}.\n\nPlease add " + "the following lines to the package:\n\n".format(", ".join(missing))) + + for dep in missing: + msg += (" depends_on('{0}', type='build', when='@{1}')\n" + .format(dep, spec.version)) + + msg += "\nUpdate the version (when='@{0}') as needed.".format(spec.version) + + return msg + def autoreconf(self, spec, prefix): """Not needed usually, configure should be already there""" # If configure exists nothing needs to be done if os.path.exists(self.configure_abs_path): return # Else try to regenerate it - autotools = ['m4', 'autoconf', 'automake', 'libtool'] - missing = [x for x in autotools if x not in spec] + needed_dependencies = ['autoconf', 'automake', 'libtool'] + build_deps = [d.name for d in spec.dependencies(deptype='build')] + missing = [x for x in needed_dependencies if x not in build_deps] + if missing: - msg = 'Cannot generate configure: missing dependencies {0}' - raise RuntimeError(msg.format(missing)) + raise RuntimeError(self._autoreconf_warning(spec, missing)) + tty.msg('Configure script not found: trying to generate it') tty.warn('*********************************************************') tty.warn('* If the default procedure fails, consider implementing *') |