fix relocation broken symlink, discovered in testing

This commit is contained in:
Gregory Becker 2023-04-03 16:07:32 -07:00
parent 7904d2f13a
commit 4fbb23b89e

View File

@ -27,7 +27,7 @@
SingleMergeConflictError,
SourceMergeVisitor,
)
from llnl.util.symlink import symlink
from llnl.util.symlink import islink, symlink
from llnl.util.tty.color import colorize
import spack.config
@ -63,7 +63,7 @@ def view_copy(src, dst, view, spec=None):
Use spec and view to generate relocations
"""
shutil.copy2(src, dst)
shutil.copy2(src, dst, follow_symlinks=False)
if spec and not spec.external:
# Not metadata, we have to relocate it
@ -95,6 +95,8 @@ def view_copy(src, dst, view, spec=None):
if spack.relocate.is_binary(dst):
spack.relocate.relocate_text_bin(binaries=[dst], prefixes=prefix_to_projection)
elif islink(dst):
spack.relocate.relocate_links(links=[dst], prefix_to_prefix=prefix_to_projection)
else:
prefix_to_projection[spack.store.layout.root] = root
prefix_to_projection[orig_sbang] = new_sbang