diff options
author | eugeneswalker <38933153+eugeneswalker@users.noreply.github.com> | 2020-08-17 13:21:36 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-17 13:21:36 -0700 |
commit | 1b965ac507e0564d6836ed5a723917c8d75f2a14 (patch) | |
tree | 5df7ef5f6155f757f8cbf74150f9386b315ff26f /lib | |
parent | 525a9f02ca434da6b5feec1489654c84320d0b27 (diff) | |
download | spack-1b965ac507e0564d6836ed5a723917c8d75f2a14.tar.gz spack-1b965ac507e0564d6836ed5a723917c8d75f2a14.tar.bz2 spack-1b965ac507e0564d6836ed5a723917c8d75f2a14.tar.xz spack-1b965ac507e0564d6836ed5a723917c8d75f2a14.zip |
Binary Distribution: Relocate RPATH on Cray (#18110)
* make_package_relative: relocate rpaths on cray
* relocate_package: relocate rpaths on cray
* platforms: add `binary_formats` property
We need to know which binary formats are supported on a platform so we
know which types of relocations to try. This adds a list of binary
formats to the platform and removes a bunch of special cases from
`binary_distribution.py`.
Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/architecture.py | 8 | ||||
-rw-r--r-- | lib/spack/spack/binary_distribution.py | 31 | ||||
-rw-r--r-- | lib/spack/spack/platforms/darwin.py | 2 | ||||
-rw-r--r-- | lib/spack/spack/platforms/test.py | 5 |
4 files changed, 27 insertions, 19 deletions
diff --git a/lib/spack/spack/architecture.py b/lib/spack/spack/architecture.py index 975cb9e56d..e4a20759cf 100644 --- a/lib/spack/spack/architecture.py +++ b/lib/spack/spack/architecture.py @@ -233,10 +233,14 @@ class Platform(object): Will return a instance of it once it is returned. """ - priority = None # Subclass sets number. Controls detection order + priority = None # Subclass sets number. Controls detection order + + #: binary formats used on this platform; used by relocation logic + binary_formats = ['elf'] + front_end = None back_end = None - default = None # The default back end target. On cray ivybridge + default = None # The default back end target. On cray ivybridge front_os = None back_os = None diff --git a/lib/spack/spack/binary_distribution.py b/lib/spack/spack/binary_distribution.py index 220686f831..590f6e6710 100644 --- a/lib/spack/spack/binary_distribution.py +++ b/lib/spack/spack/binary_distribution.py @@ -11,7 +11,6 @@ import shutil import tempfile import hashlib import glob -import platform from contextlib import closing import ruamel.yaml as yaml @@ -520,16 +519,16 @@ def make_package_relative(workdir, spec, allow_root): for filename in buildinfo['relocate_binaries']: orig_path_names.append(os.path.join(prefix, filename)) cur_path_names.append(os.path.join(workdir, filename)) - if (spec.architecture.platform == 'darwin' or - spec.architecture.platform == 'test' and - platform.system().lower() == 'darwin'): - relocate.make_macho_binaries_relative(cur_path_names, orig_path_names, - old_layout_root) - if (spec.architecture.platform == 'linux' or - spec.architecture.platform == 'test' and - platform.system().lower() == 'linux'): - relocate.make_elf_binaries_relative(cur_path_names, orig_path_names, - old_layout_root) + + platform = spack.architecture.get_platform(spec.platform) + if 'macho' in platform.binary_formats: + relocate.make_macho_binaries_relative( + cur_path_names, orig_path_names, old_layout_root) + + if 'elf' in platform.binary_formats: + relocate.make_elf_binaries_relative( + cur_path_names, orig_path_names, old_layout_root) + relocate.raise_if_not_relocatable(cur_path_names, allow_root) orig_path_names = list() cur_path_names = list() @@ -609,18 +608,16 @@ def relocate_package(spec, allow_root): ] # If the buildcache was not created with relativized rpaths # do the relocation of path in binaries - if (spec.architecture.platform == 'darwin' or - spec.architecture.platform == 'test' and - platform.system().lower() == 'darwin'): + platform = spack.architecture.get_platform(spec.platform) + if 'macho' in platform.binary_formats: relocate.relocate_macho_binaries(files_to_relocate, old_layout_root, new_layout_root, prefix_to_prefix, rel, old_prefix, new_prefix) - if (spec.architecture.platform == 'linux' or - spec.architecture.platform == 'test' and - platform.system().lower() == 'linux'): + + if 'elf' in platform.binary_formats: relocate.relocate_elf_binaries(files_to_relocate, old_layout_root, new_layout_root, diff --git a/lib/spack/spack/platforms/darwin.py b/lib/spack/spack/platforms/darwin.py index 9a3fffd881..99a28cec9f 100644 --- a/lib/spack/spack/platforms/darwin.py +++ b/lib/spack/spack/platforms/darwin.py @@ -12,6 +12,8 @@ from spack.operating_systems.mac_os import MacOs class Darwin(Platform): priority = 89 + binary_formats = ['macho'] + def __init__(self): super(Darwin, self).__init__('darwin') diff --git a/lib/spack/spack/platforms/test.py b/lib/spack/spack/platforms/test.py index 9be160731e..3480275328 100644 --- a/lib/spack/spack/platforms/test.py +++ b/lib/spack/spack/platforms/test.py @@ -3,12 +3,17 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +import platform from spack.architecture import Platform, Target from spack.architecture import OperatingSystem class Test(Platform): priority = 1000000 + + if platform.system().lower() == 'darwin': + binary_formats = ['macho'] + front_end = 'x86' back_end = 'x86_64' default = 'x86_64' |