diff options
author | Mikael Simberg <mikael.simberg@iki.fi> | 2022-08-10 17:54:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-10 17:54:09 +0200 |
commit | f237e669f28dce343b7366523ef94fe4cf869b58 (patch) | |
tree | 96bc019e2086f9219e59c61c83850d403439437b /lib | |
parent | 9df2c7190f8bc2402f486bacf274718640bc9cec (diff) | |
download | spack-f237e669f28dce343b7366523ef94fe4cf869b58.tar.gz spack-f237e669f28dce343b7366523ef94fe4cf869b58.tar.bz2 spack-f237e669f28dce343b7366523ef94fe4cf869b58.tar.xz spack-f237e669f28dce343b7366523ef94fe4cf869b58.zip |
Patch /usr/bin/file to file when on nixos (#30718)
These changes make many packages build on nixos where nearly nothing
comes from /bin or /usr/bin (the only things in "system locations" are
/bin/sh and /usr/bin/env, all the rest is found through PATH).
Many configuration scripts hardcode /usr/bin/file instead of using the
one from PATH. This patches them to use file from PATH.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/build_systems/autotools.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/spack/spack/build_systems/autotools.py b/lib/spack/spack/build_systems/autotools.py index 0a9946a1c0..97b5e9ef51 100644 --- a/lib/spack/spack/build_systems/autotools.py +++ b/lib/spack/spack/build_systems/autotools.py @@ -239,6 +239,15 @@ To resolve this problem, please try the following: os.chmod(abs_path, mode) @run_before("configure") + def _patch_usr_bin_file(self): + """On NixOS file is not available in /usr/bin/file. Patch configure + scripts to use file from path.""" + + if self.spec.os.startswith("nixos"): + for configure_file in fs.find(".", files=["configure"], recursive=True): + fs.filter_file("/usr/bin/file", "file", configure_file, string=True) + + @run_before("configure") def _set_autotools_environment_variables(self): """Many autotools builds use a version of mknod.m4 that fails when running as root unless FORCE_UNSAFE_CONFIGURE is set to 1. |