diff options
author | Patrick Gartung <gartung@fnal.gov> | 2020-10-01 15:21:02 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-01 13:21:02 -0700 |
commit | a2795519df8f84526b1a1c3aef7488bb1c526446 (patch) | |
tree | a4a7f0d997674c85081f2ef4a736735ac3617f01 /lib | |
parent | 6aa9866b79a86576b77fe10a236eff15f53cae6e (diff) | |
download | spack-a2795519df8f84526b1a1c3aef7488bb1c526446.tar.gz spack-a2795519df8f84526b1a1c3aef7488bb1c526446.tar.bz2 spack-a2795519df8f84526b1a1c3aef7488bb1c526446.tar.xz spack-a2795519df8f84526b1a1c3aef7488bb1c526446.zip |
Binary caching: avoid duplicate RPATHs, unnecessary updates (#19061)
* Remove duplication of reconstructed RPATHs caused by multiple
identical entries in prefixes dictionary
* Don't rewrite RPATHs if relative RPATHs are unchanged because the
directory layout is unchanged
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/relocate.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/spack/spack/relocate.py b/lib/spack/spack/relocate.py index bc475e6849..a87156902f 100644 --- a/lib/spack/spack/relocate.py +++ b/lib/spack/spack/relocate.py @@ -615,12 +615,13 @@ def _transform_rpaths(orig_rpaths, orig_root, new_prefixes): # Otherwise inspect the mapping and transform + append any prefix # that starts with a registered key + # avoiding duplicates for old_prefix, new_prefix in new_prefixes.items(): if orig_rpath.startswith(old_prefix): - new_rpaths.append( - re.sub(re.escape(old_prefix), new_prefix, orig_rpath) - ) - + new_rpath = re.sub(re.escape(old_prefix), new_prefix, + orig_rpath) + if new_rpath not in new_rpaths: + new_rpaths.append(new_rpath) return new_rpaths @@ -668,7 +669,9 @@ def relocate_elf_binaries(binaries, orig_root, new_root, new_rpaths = _make_relative( new_binary, new_root, new_norm_rpaths ) - _set_elf_rpaths(new_binary, new_rpaths) + # check to see if relative rpaths are changed before rewriting + if sorted(new_rpaths) != sorted(orig_rpaths): + _set_elf_rpaths(new_binary, new_rpaths) else: new_rpaths = _transform_rpaths( orig_rpaths, orig_root, new_prefixes |