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>
This commit is contained in:
bernhardkaindl 2021-09-24 17:17:07 +02:00 committed by GitHub
parent bcf708098d
commit cdbb586a93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -252,17 +252,31 @@ def delete_configure_to_force_update(self):
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 *')