From 57608a6dc495af6c042945767ac3bd0c009fadd5 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Mon, 13 Nov 2017 10:21:03 +0000 Subject: Quick fix for relocation issues. --- lib/spack/spack/binary_distribution.py | 37 +++++++++++++++++++++++++--------- lib/spack/spack/relocate.py | 2 +- 2 files changed, 29 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/spack/spack/binary_distribution.py b/lib/spack/spack/binary_distribution.py index 3198e7b4ee..fb43f252cf 100644 --- a/lib/spack/spack/binary_distribution.py +++ b/lib/spack/spack/binary_distribution.py @@ -44,6 +44,9 @@ from spack.util.executable import ProcessError import spack.relocate as relocate +_relocation_blacklist = (".spack", "man") + + class NoOverwriteException(Exception): pass @@ -95,18 +98,14 @@ def read_buildinfo_file(prefix): return buildinfo -def write_buildinfo_file(prefix, rel=False): - """ - Create a cache file containing information - required for the relocation - """ +def _find_relocations(prefix): text_to_relocate = [] binary_to_relocate = [] - blacklist = (".spack", "man") # Do this at during tarball creation to save time when tarball unpacked. # Used by make_package_relative to determine binaries to change. for root, dirs, files in os.walk(prefix, topdown=True): - dirs[:] = [d for d in dirs if d not in blacklist] + dirs[:] = [d for d in dirs if d not in _relocation_blacklist] + for filename in files: path_name = os.path.join(root, filename) filetype = relocate.get_filetype(path_name) @@ -117,6 +116,16 @@ def write_buildinfo_file(prefix, rel=False): rel_path_name = os.path.relpath(path_name, prefix) text_to_relocate.append(rel_path_name) + return text_to_relocate, binary_to_relocate + + +def write_buildinfo_file(prefix, rel=False): + """ + Create a cache file containing information + required for the relocation + """ + text_to_relocate, binary_to_relocate = _find_relocations(prefix) + # Create buildinfo data and write it to disk buildinfo = {} buildinfo['relative_rpaths'] = rel @@ -354,18 +363,28 @@ def relocate_package(prefix): if new_path == old_path and not rel: return + text_relocs = buildinfo['relocate_textfiles'] + binary_relocs = buildinfo['relocate_binaries'] + + # if there are no relocations, search for them instead + # TODO: revisit this in a 0.11 point release + if not text_relocs or not binary_relocs: + text_relocs, binary_relocs = _find_relocations(prefix) + rel = False + tty.msg("Relocating package from", "%s to %s." % (old_path, new_path)) path_names = set() - for filename in buildinfo['relocate_textfiles']: + for filename in text_relocs: path_name = os.path.join(prefix, filename) path_names.add(path_name) relocate.relocate_text(path_names, old_path, new_path) + # If the binary files in the package were not edited to use # relative RPATHs, then the RPATHs need to be relocated if not rel: path_names = set() - for filename in buildinfo['relocate_binaries']: + for filename in binary_relocs: path_name = os.path.join(prefix, filename) path_names.add(path_name) relocate.relocate_binary(path_names, old_path, new_path) diff --git a/lib/spack/spack/relocate.py b/lib/spack/spack/relocate.py index 9341b55c86..246ed7510c 100644 --- a/lib/spack/spack/relocate.py +++ b/lib/spack/spack/relocate.py @@ -217,7 +217,7 @@ def needs_binary_relocation(filetype): retval = False if "relocatable" in filetype: return False - if "link" in filetype: + if "symbolic link" in filetype: return False if platform.system() == 'Darwin': return ('Mach-O' in filetype) -- cgit v1.2.3-60-g2f50