From a5a291820296d8125810b794d03d0d1dafbc579a Mon Sep 17 00:00:00 2001 From: "Benjamin S. Kirk" Date: Tue, 10 Jan 2023 15:27:29 -0700 Subject: autoconf: fix for long perl shebangs with autoconf@2.70+ (#34331) autoconf 2.70 uses use warnings instead of -w so that PERL=/usr/bin/env perl can be passed, but we want to fix absolute paths anyhow through sbang upon install. So, we stick to patching the one perl script that's used during the build. --- var/spack/repos/builtin/packages/autoconf/package.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/autoconf/package.py b/var/spack/repos/builtin/packages/autoconf/package.py index 615221527a..9379a7ced1 100644 --- a/var/spack/repos/builtin/packages/autoconf/package.py +++ b/var/spack/repos/builtin/packages/autoconf/package.py @@ -83,7 +83,11 @@ class Autoconf(AutotoolsPackage, GNUMirrorPackage): # We save and restore the modification timestamp of the file to prevent # regeneration of the respective man page: with keep_modification_time(patched_file): - filter_file("^#! @PERL@ -w", "#! /usr/bin/env perl", patched_file) + if "@2.70:" in self.spec: + shebang_string = "^#! @PERL@" + else: + shebang_string = "^#! @PERL@ -w" + filter_file(shebang_string, "#! /usr/bin/env perl", patched_file) if self.version == Version("2.62"): # skip help2man for patched autoheader.in and autoscan.in touch("man/autoheader.1") @@ -99,10 +103,15 @@ class Autoconf(AutotoolsPackage, GNUMirrorPackage): # target will try to rebuild the binaries (filter_file updates the # timestamps) + if "@2.70:" in self.spec: + shebang_string = "#! {0}" + else: + shebang_string = "#! {0} -w" + # Revert sbang, so Spack's sbang hook can fix it up filter_file( "^#! /usr/bin/env perl", - "#! {0} -w".format(self.spec["perl"].command.path), + shebang_string.format(self.spec["perl"].command.path), self.prefix.bin.autom4te, backup=False, ) -- cgit v1.2.3-70-g09d2