Skip to content

Commit 8456a25

Browse files
authored
Merge pull request #506 from climbfuji/bugfix/bootstrap_airgapped_spack_stack_dev
This PR is pulling in the updates from spack#48252, modified for the v0.23 spack base branch (PR 48252 is for spack develop, which is v1.0-alpha). PR 48252 is ready as far as spack core code changes are concerned, the only reason the PR isn't merged yet is because the GitHub actions are missing a spack buildcache update-index command.
2 parents 0ee54ff + a231b4b commit 8456a25

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

lib/spack/docs/bootstrapping.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ bootstrapping.
171171
To register the mirror on the platform where it's supposed to be used run the following command(s):
172172
% spack bootstrap add --trust local-sources /opt/bootstrap/metadata/sources
173173
% spack bootstrap add --trust local-binaries /opt/bootstrap/metadata/binaries
174+
% spack buildcache update-index /opt/bootstrap/bootstrap_cache
174175
175176
176177
This command needs to be run on a machine with internet access and the resulting folder

lib/spack/spack/bootstrap/core.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,12 @@ def __init__(self, conf: ConfigDictionary) -> None:
9090
self.name = conf["name"]
9191
self.metadata_dir = spack.util.path.canonicalize_path(conf["metadata"])
9292

93-
# Promote (relative) paths to file urls
94-
self.url = spack.mirror.Mirror(conf["info"]["url"]).fetch_url
93+
# Check for relative paths, and turn them into absolute paths
94+
# root is the metadata_dir
95+
maybe_url = conf["info"]["url"]
96+
if spack.util.url.is_path_instead_of_url(maybe_url) and not os.path.isabs(maybe_url):
97+
maybe_url = os.path.join(self.metadata_dir, maybe_url)
98+
self.url = spack.mirror.Mirror(maybe_url).fetch_url
9599

96100
@property
97101
def mirror_scope(self) -> spack.config.InternalConfigScope:

lib/spack/spack/cmd/bootstrap.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030

3131
# Tarball to be downloaded if binary packages are requested in a local mirror
32-
BINARY_TARBALL = "https://github.com/spack/spack-bootstrap-mirrors/releases/download/v0.4/bootstrap-buildcache.tar.gz"
32+
BINARY_TARBALL = "https://github.com/spack/spack-bootstrap-mirrors/releases/download/v0.5/bootstrap-buildcache.tar.gz"
3333

3434
#: Subdirectory where to create the mirror
3535
LOCAL_MIRROR_DIR = "bootstrap_cache"
@@ -51,9 +51,9 @@
5151
},
5252
}
5353

54-
CLINGO_JSON = "$spack/share/spack/bootstrap/github-actions-v0.4/clingo.json"
55-
GNUPG_JSON = "$spack/share/spack/bootstrap/github-actions-v0.4/gnupg.json"
56-
PATCHELF_JSON = "$spack/share/spack/bootstrap/github-actions-v0.4/patchelf.json"
54+
CLINGO_JSON = "$spack/share/spack/bootstrap/github-actions-v0.5/clingo.json"
55+
GNUPG_JSON = "$spack/share/spack/bootstrap/github-actions-v0.5/gnupg.json"
56+
PATCHELF_JSON = "$spack/share/spack/bootstrap/github-actions-v0.5/patchelf.json"
5757

5858
# Metadata for a generated source mirror
5959
SOURCE_METADATA = {
@@ -437,6 +437,7 @@ def write_metadata(subdir, metadata):
437437
shutil.copy(spack.util.path.canonicalize_path(GNUPG_JSON), abs_directory)
438438
shutil.copy(spack.util.path.canonicalize_path(PATCHELF_JSON), abs_directory)
439439
instructions += cmd.format("local-binaries", rel_directory)
440+
instructions += " % spack buildcache update-index <final-path>/bootstrap_cache\n"
440441
print(instructions)
441442

442443

0 commit comments

Comments
 (0)