Quick fix for relocation issues.
This commit is contained in:
parent
fffcd77662
commit
57608a6dc4
@ -44,6 +44,9 @@
|
|||||||
import spack.relocate as relocate
|
import spack.relocate as relocate
|
||||||
|
|
||||||
|
|
||||||
|
_relocation_blacklist = (".spack", "man")
|
||||||
|
|
||||||
|
|
||||||
class NoOverwriteException(Exception):
|
class NoOverwriteException(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -95,18 +98,14 @@ def read_buildinfo_file(prefix):
|
|||||||
return buildinfo
|
return buildinfo
|
||||||
|
|
||||||
|
|
||||||
def write_buildinfo_file(prefix, rel=False):
|
def _find_relocations(prefix):
|
||||||
"""
|
|
||||||
Create a cache file containing information
|
|
||||||
required for the relocation
|
|
||||||
"""
|
|
||||||
text_to_relocate = []
|
text_to_relocate = []
|
||||||
binary_to_relocate = []
|
binary_to_relocate = []
|
||||||
blacklist = (".spack", "man")
|
|
||||||
# Do this at during tarball creation to save time when tarball unpacked.
|
# Do this at during tarball creation to save time when tarball unpacked.
|
||||||
# Used by make_package_relative to determine binaries to change.
|
# Used by make_package_relative to determine binaries to change.
|
||||||
for root, dirs, files in os.walk(prefix, topdown=True):
|
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:
|
for filename in files:
|
||||||
path_name = os.path.join(root, filename)
|
path_name = os.path.join(root, filename)
|
||||||
filetype = relocate.get_filetype(path_name)
|
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)
|
rel_path_name = os.path.relpath(path_name, prefix)
|
||||||
text_to_relocate.append(rel_path_name)
|
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
|
# Create buildinfo data and write it to disk
|
||||||
buildinfo = {}
|
buildinfo = {}
|
||||||
buildinfo['relative_rpaths'] = rel
|
buildinfo['relative_rpaths'] = rel
|
||||||
@ -354,18 +363,28 @@ def relocate_package(prefix):
|
|||||||
if new_path == old_path and not rel:
|
if new_path == old_path and not rel:
|
||||||
return
|
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",
|
tty.msg("Relocating package from",
|
||||||
"%s to %s." % (old_path, new_path))
|
"%s to %s." % (old_path, new_path))
|
||||||
path_names = set()
|
path_names = set()
|
||||||
for filename in buildinfo['relocate_textfiles']:
|
for filename in text_relocs:
|
||||||
path_name = os.path.join(prefix, filename)
|
path_name = os.path.join(prefix, filename)
|
||||||
path_names.add(path_name)
|
path_names.add(path_name)
|
||||||
relocate.relocate_text(path_names, old_path, new_path)
|
relocate.relocate_text(path_names, old_path, new_path)
|
||||||
|
|
||||||
# If the binary files in the package were not edited to use
|
# If the binary files in the package were not edited to use
|
||||||
# relative RPATHs, then the RPATHs need to be relocated
|
# relative RPATHs, then the RPATHs need to be relocated
|
||||||
if not rel:
|
if not rel:
|
||||||
path_names = set()
|
path_names = set()
|
||||||
for filename in buildinfo['relocate_binaries']:
|
for filename in binary_relocs:
|
||||||
path_name = os.path.join(prefix, filename)
|
path_name = os.path.join(prefix, filename)
|
||||||
path_names.add(path_name)
|
path_names.add(path_name)
|
||||||
relocate.relocate_binary(path_names, old_path, new_path)
|
relocate.relocate_binary(path_names, old_path, new_path)
|
||||||
|
@ -217,7 +217,7 @@ def needs_binary_relocation(filetype):
|
|||||||
retval = False
|
retval = False
|
||||||
if "relocatable" in filetype:
|
if "relocatable" in filetype:
|
||||||
return False
|
return False
|
||||||
if "link" in filetype:
|
if "symbolic link" in filetype:
|
||||||
return False
|
return False
|
||||||
if platform.system() == 'Darwin':
|
if platform.system() == 'Darwin':
|
||||||
return ('Mach-O' in filetype)
|
return ('Mach-O' in filetype)
|
||||||
|
Loading…
Reference in New Issue
Block a user