Skip to content

Commit 93cd216

Browse files
authored
binary_distribution: stop relocating tarballs with relative rpaths (spack#48488)
1 parent c1d385a commit 93cd216

File tree

5 files changed

+31
-550
lines changed

5 files changed

+31
-550
lines changed

lib/spack/spack/binary_distribution.py

Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2189,7 +2189,12 @@ def relocate_package(spec):
21892189
old_spack_prefix = str(buildinfo.get("spackprefix"))
21902190
old_rel_prefix = buildinfo.get("relative_prefix")
21912191
old_prefix = os.path.join(old_layout_root, old_rel_prefix)
2192-
rel = buildinfo.get("relative_rpaths", False)
2192+
2193+
# Warn about old style tarballs created with the now removed --rel flag.
2194+
if buildinfo.get("relative_rpaths", False):
2195+
tty.warn(
2196+
f"Tarball for {spec} uses relative rpaths, " "which can cause library loading issues."
2197+
)
21932198

21942199
# In the past prefix_to_hash was the default and externals were not dropped, so prefixes
21952200
# were not unique.
@@ -2267,19 +2272,11 @@ def relocate_package(spec):
22672272

22682273
tty.debug("Relocating package from", "%s to %s." % (old_layout_root, new_layout_root))
22692274

2270-
# Old archives maybe have hardlinks repeated.
2275+
# Old archives may have hardlinks repeated.
22712276
dedupe_hardlinks_if_necessary(workdir, buildinfo)
22722277

2273-
def is_backup_file(file):
2274-
return file.endswith("~")
2275-
22762278
# Text files containing the prefix text
2277-
text_names = list()
2278-
for filename in buildinfo["relocate_textfiles"]:
2279-
text_name = os.path.join(workdir, filename)
2280-
# Don't add backup files generated by filter_file during install step.
2281-
if not is_backup_file(text_name):
2282-
text_names.append(text_name)
2279+
text_names = [os.path.join(workdir, f) for f in buildinfo["relocate_textfiles"]]
22832280

22842281
# If we are not installing back to the same install tree do the relocation
22852282
if old_prefix != new_prefix:
@@ -2290,29 +2287,11 @@ def is_backup_file(file):
22902287
# do the relocation of path in binaries
22912288
platform = spack.platforms.by_name(spec.platform)
22922289
if "macho" in platform.binary_formats:
2293-
relocate.relocate_macho_binaries(
2294-
files_to_relocate,
2295-
old_layout_root,
2296-
new_layout_root,
2297-
prefix_to_prefix_bin,
2298-
rel,
2299-
old_prefix,
2300-
new_prefix,
2301-
)
2302-
elif "elf" in platform.binary_formats and not rel:
2290+
relocate.relocate_macho_binaries(files_to_relocate, prefix_to_prefix_bin)
2291+
elif "elf" in platform.binary_formats:
23032292
# The new ELF dynamic section relocation logic only handles absolute to
23042293
# absolute relocation.
2305-
relocate.new_relocate_elf_binaries(files_to_relocate, prefix_to_prefix_bin)
2306-
elif "elf" in platform.binary_formats and rel:
2307-
relocate.relocate_elf_binaries(
2308-
files_to_relocate,
2309-
old_layout_root,
2310-
new_layout_root,
2311-
prefix_to_prefix_bin,
2312-
rel,
2313-
old_prefix,
2314-
new_prefix,
2315-
)
2294+
relocate.relocate_elf_binaries(files_to_relocate, prefix_to_prefix_bin)
23162295

23172296
# Relocate links to the new install prefix
23182297
links = [os.path.join(workdir, f) for f in buildinfo.get("relocate_links", [])]

0 commit comments

Comments
 (0)