summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorHarmen Stoppels <harmenstoppels@gmail.com>2022-10-19 22:57:06 +0200
committerGitHub <noreply@github.com>2022-10-19 13:57:06 -0700
commite1344067fdfa30f8f1b377bf3e6391291f7bf30f (patch)
tree0b33085cfa6e6ac10524adbdf3029ce0bdaa6903 /share
parentae7999d7a1957465bd5848b263352ebf49ef8015 (diff)
downloadspack-e1344067fdfa30f8f1b377bf3e6391291f7bf30f.tar.gz
spack-e1344067fdfa30f8f1b377bf3e6391291f7bf30f.tar.bz2
spack-e1344067fdfa30f8f1b377bf3e6391291f7bf30f.tar.xz
spack-e1344067fdfa30f8f1b377bf3e6391291f7bf30f.zip
depfile: buildcache support (#33315)
When installing some/all specs from a buildcache, build edges are pruned from those specs. This can result in a much smaller effective DAG. Until now, `spack env depfile` would always generate a full DAG. Ths PR adds the `spack env depfile --use-buildcache` flag that was introduced for `spack install` before. This way, not only can we drop build edges, but also we can automatically set the right buildcache related flags on the specific specs that are gonna get installed. This way we get parallel installs of binary deps without redundancy, which is useful for Gitlab CI.
Diffstat (limited to 'share')
-rwxr-xr-xshare/spack/spack-completion.bash7
-rw-r--r--share/spack/templates/depfile/Makefile18
2 files changed, 13 insertions, 12 deletions
diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash
index 8b12116fe9..c6d407b4d5 100755
--- a/share/spack/spack-completion.bash
+++ b/share/spack/spack-completion.bash
@@ -1022,7 +1022,12 @@ _spack_env_revert() {
}
_spack_env_depfile() {
- SPACK_COMPREPLY="-h --help --make-target-prefix --make-disable-jobserver -o --output -G --generator"
+ if $list_options
+ then
+ SPACK_COMPREPLY="-h --help --make-target-prefix --make-disable-jobserver --use-buildcache -o --output -G --generator"
+ else
+ _all_packages
+ fi
}
_spack_extensions() {
diff --git a/share/spack/templates/depfile/Makefile b/share/spack/templates/depfile/Makefile
index a149951d9f..5078f0016f 100644
--- a/share/spack/templates/depfile/Makefile
+++ b/share/spack/templates/depfile/Makefile
@@ -15,23 +15,19 @@ SPACK ?= spack
# This is an involved way of expressing that Spack should only install
# an individual concrete spec from the environment without deps.
{{ install_target }}/%: {{ install_deps_target }}/% | {{ dirs_target }}
- $(info Installing $(SPEC))
- {{ jobserver_support }}$(SPACK) -e '{{ environment }}' install $(SPACK_INSTALL_FLAGS) --only-concrete --only=package --no-add /$(notdir $@)
- @touch $@
-
-# Targets of the form {{ install_deps_target }}/<hash> install dependencies only
-{{ install_deps_target }}/%: | {{ dirs_target }}
+ {{ jobserver_support }}$(SPACK) -e '{{ environment }}' install $(SPACK_BUILDCACHE_FLAG) $(SPACK_INSTALL_FLAGS) --only-concrete --only=package --no-add /$(notdir $@) # $(SPEC)
@touch $@
# Set a human-readable SPEC variable for each target that has a hash
-{% for (hash, name) in hash_with_name -%}
-{{ any_hash_target }}/{{ hash }}: SPEC = {{ name }}
+{% for (parent, name, build_cache, _) in adjacency_list -%}
+{{ any_hash_target }}/{{ parent }}: SPEC = {{ name }}
+{{ any_hash_target }}/{{ parent }}: SPACK_BUILDCACHE_FLAG = {{ build_cache }}
{% endfor %}
# The Spack DAG expressed in targets:
-{% for (target, prereqs) in targets_to_prereqs -%}
-{{ target }}: {{prereqs}}
+{% for (parent, _, _, prereqs) in adjacency_list -%}
+{{ install_deps_target }}/{{ parent }}: {{prereqs}}
{% endfor %}
{{ clean_target }}:
- rm -rf {{ env_target }} {{ all_install_targets }} {{ all_install_deps_targets }}
+ rm -rf {{ env_target }} {{ cleanable_targets }}