Update bootstrap buildcache to v0.3 (#32262)

This release allow to bootstrap patchelf from binaries.
This commit is contained in:
Harmen Stoppels 2022-09-02 12:48:46 +02:00 committed by GitHub
parent a2e829c7b9
commit 80389911cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 91 additions and 16 deletions

View file

@ -9,6 +9,8 @@ bootstrap:
# may not be able to bootstrap all the software that Spack needs, # may not be able to bootstrap all the software that Spack needs,
# depending on its type. # depending on its type.
sources: sources:
- name: 'github-actions-v0.3'
metadata: $spack/share/spack/bootstrap/github-actions-v0.3
- name: 'github-actions-v0.2' - name: 'github-actions-v0.2'
metadata: $spack/share/spack/bootstrap/github-actions-v0.2 metadata: $spack/share/spack/bootstrap/github-actions-v0.2
- name: 'github-actions-v0.1' - name: 'github-actions-v0.1'
@ -18,5 +20,5 @@ bootstrap:
trusted: trusted:
# By default we trust bootstrapping from sources and from binaries # By default we trust bootstrapping from sources and from binaries
# produced on Github via the workflow # produced on Github via the workflow
github-actions-v0.2: true github-actions-v0.3: true
spack-install: true spack-install: true

View file

@ -15,6 +15,7 @@
import re import re
import sys import sys
import sysconfig import sysconfig
import uuid
import six import six
@ -40,6 +41,7 @@
import spack.util.path import spack.util.path
import spack.util.spack_yaml import spack.util.spack_yaml
import spack.util.url import spack.util.url
import spack.version
#: Name of the file containing metadata about the bootstrapping source #: Name of the file containing metadata about the bootstrapping source
METADATA_YAML_FILENAME = "metadata.yaml" METADATA_YAML_FILENAME = "metadata.yaml"
@ -260,12 +262,11 @@ def mirror_scope(self):
class _BuildcacheBootstrapper(_BootstrapperBase): class _BuildcacheBootstrapper(_BootstrapperBase):
"""Install the software needed during bootstrapping from a buildcache.""" """Install the software needed during bootstrapping from a buildcache."""
config_scope_name = "bootstrap_buildcache"
def __init__(self, conf): def __init__(self, conf):
super(_BuildcacheBootstrapper, self).__init__(conf) super(_BuildcacheBootstrapper, self).__init__(conf)
self.metadata_dir = spack.util.path.canonicalize_path(conf["metadata"]) self.metadata_dir = spack.util.path.canonicalize_path(conf["metadata"])
self.last_search = None self.last_search = None
self.config_scope_name = "bootstrap_buildcache-{}".format(uuid.uuid4())
@staticmethod @staticmethod
def _spec_and_platform(abstract_spec_str): def _spec_and_platform(abstract_spec_str):
@ -378,13 +379,12 @@ def try_search_path(self, executables, abstract_spec_str):
class _SourceBootstrapper(_BootstrapperBase): class _SourceBootstrapper(_BootstrapperBase):
"""Install the software needed during bootstrapping from sources.""" """Install the software needed during bootstrapping from sources."""
config_scope_name = "bootstrap_source"
def __init__(self, conf): def __init__(self, conf):
super(_SourceBootstrapper, self).__init__(conf) super(_SourceBootstrapper, self).__init__(conf)
self.metadata_dir = spack.util.path.canonicalize_path(conf["metadata"]) self.metadata_dir = spack.util.path.canonicalize_path(conf["metadata"])
self.conf = conf self.conf = conf
self.last_search = None self.last_search = None
self.config_scope_name = "bootstrap_source-{}".format(uuid.uuid4())
def try_import(self, module, abstract_spec_str): def try_import(self, module, abstract_spec_str):
info = {} info = {}
@ -788,17 +788,46 @@ def ensure_gpg_in_path_or_raise():
def patchelf_root_spec(): def patchelf_root_spec():
"""Return the root spec used to bootstrap patchelf""" """Return the root spec used to bootstrap patchelf"""
# TODO: patchelf is restricted to v0.13 since earlier versions have # 0.13.1 is the last version not to require C++17.
# TODO: bugs that we don't to deal with, while v0.14 requires a C++17 return _root_spec("patchelf@0.13.1:")
# TODO: which may not be available on all platforms.
return _root_spec("patchelf@0.13.1:0.13.99")
def verify_patchelf(patchelf):
"""Older patchelf versions can produce broken binaries, so we
verify the version here.
Arguments:
patchelf (spack.util.executable.Executable): patchelf executable
"""
out = patchelf("--version", output=str, error=os.devnull, fail_on_error=False).strip()
if patchelf.returncode != 0:
return False
parts = out.split(" ")
if len(parts) < 2:
return False
try:
version = spack.version.Version(parts[1])
except ValueError:
return False
return version >= spack.version.Version("0.13.1")
def ensure_patchelf_in_path_or_raise(): def ensure_patchelf_in_path_or_raise():
"""Ensure patchelf is in the PATH or raise.""" """Ensure patchelf is in the PATH or raise."""
return ensure_executables_in_path_or_raise( # The old concretizer is not smart and we're doing its job: if the latest patchelf
executables=["patchelf"], abstract_spec=patchelf_root_spec() # does not concretize because the compiler doesn't support C++17, we try to
) # concretize again with an upperbound @:13.
try:
return ensure_executables_in_path_or_raise(
executables=["patchelf"], abstract_spec=patchelf_root_spec(), cmd_check=verify_patchelf
)
except RuntimeError:
return ensure_executables_in_path_or_raise(
executables=["patchelf"],
abstract_spec=_root_spec("patchelf@0.13.1:0.13"),
cmd_check=verify_patchelf,
)
### ###

View file

@ -13,6 +13,7 @@
import llnl.util.lang import llnl.util.lang
import llnl.util.tty as tty import llnl.util.tty as tty
from llnl.util.lang import memoized
from llnl.util.symlink import symlink from llnl.util.symlink import symlink
import spack.bootstrap import spack.bootstrap
@ -76,15 +77,14 @@ def __init__(self, old_path, new_path):
super(BinaryTextReplaceError, self).__init__(msg, err_msg) super(BinaryTextReplaceError, self).__init__(msg, err_msg)
@memoized
def _patchelf(): def _patchelf():
"""Return the full path to the patchelf binary, if available, else None.""" """Return the full path to the patchelf binary, if available, else None."""
if is_macos: if is_macos:
return None return None
patchelf = executable.which("patchelf") with spack.bootstrap.ensure_bootstrap_configuration():
if patchelf is None: patchelf = spack.bootstrap.ensure_patchelf_in_path_or_raise()
with spack.bootstrap.ensure_bootstrap_configuration():
patchelf = spack.bootstrap.ensure_patchelf_in_path_or_raise()
return patchelf.path return patchelf.path

View file

@ -0,0 +1 @@
../github-actions-v0.2/clingo.json

View file

@ -0,0 +1 @@
../github-actions-v0.2/gnupg.json

View file

@ -0,0 +1,8 @@
type: buildcache
description: |
Buildcache generated from a public workflow using Github Actions.
The sha256 checksum of binaries is checked before installation.
info:
url: https://mirror.spack.io/bootstrap/github-actions/v0.3
homepage: https://github.com/spack/spack-bootstrap-mirrors
releases: https://github.com/spack/spack-bootstrap-mirrors/releases

View file

@ -0,0 +1,34 @@
{
"verified": [
{
"binaries": [
[
"patchelf",
"cn4gsqzdnnffk7ynvbcai6wrt5ehqqrl",
"8c6a28cbe8133d719be27ded11159f0aa2c97ed1d0881119ae0ebd71f8ccc755"
]
],
"spec": "patchelf@0.13: %gcc platform=linux target=aarch64"
},
{
"binaries": [
[
"patchelf",
"mgq6n2heyvcx2ebdpchkbknwwn3u63s6",
"1d4ea9167fb8345a178c1352e0377cc37ef2b421935cf2b48fb6fa03a94fca3d"
]
],
"spec": "patchelf@0.13: %gcc platform=linux target=ppc64le"
},
{
"binaries": [
[
"patchelf",
"htk62k7efo2z22kh6kmhaselru7bfkuc",
"833df21b20eaa7999ac4c5779ae26aa90397d9027aebaa686a428589befda693"
]
],
"spec": "patchelf@0.13: %gcc platform=linux target=x86_64"
}
]
}