From e1344067fdfa30f8f1b377bf3e6391291f7bf30f Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Wed, 19 Oct 2022 22:57:06 +0200 Subject: 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. --- share/spack/spack-completion.bash | 7 ++++++- share/spack/templates/depfile/Makefile | 18 +++++++----------- 2 files changed, 13 insertions(+), 12 deletions(-) (limited to 'share') 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 }}/ 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 }} -- cgit v1.2.3-70-g09d2