summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHarmen Stoppels <harmenstoppels@gmail.com>2022-04-19 21:32:59 +0200
committerGitHub <noreply@github.com>2022-04-19 12:32:59 -0700
commitabc162cf3b39ae1907e4bad3b27cb704feb4f0a8 (patch)
treefb99ea6569b9fec13eface32336083bb0b54a916 /lib
parentdc3cf5c6b0e2c817de2b01c5c73fcc7611af3c49 (diff)
downloadspack-abc162cf3b39ae1907e4bad3b27cb704feb4f0a8.tar.gz
spack-abc162cf3b39ae1907e4bad3b27cb704feb4f0a8.tar.bz2
spack-abc162cf3b39ae1907e4bad3b27cb704feb4f0a8.tar.xz
spack-abc162cf3b39ae1907e4bad3b27cb704feb4f0a8.zip
environment.py: write lockfile last (#30039)
This makes it easier to write `spack.lock: spack.yaml` type of rules in `Makefiles`.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/environment/environment.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/spack/spack/environment/environment.py b/lib/spack/spack/environment/environment.py
index b6875653df..720819695b 100644
--- a/lib/spack/spack/environment/environment.py
+++ b/lib/spack/spack/environment/environment.py
@@ -1897,10 +1897,14 @@ class Environment(object):
fs.mkdirp(pkg_dir)
spack.repo.path.dump_provenance(dep, pkg_dir)
- # write the lock file last
+ self._update_and_write_manifest(raw_yaml_dict, yaml_dict)
+
+ # Write the lock file last. This is useful for Makefiles
+ # with `spack.lock: spack.yaml` rules, where the target
+ # should be newer than the prerequisite to avoid
+ # redundant re-concretization.
with fs.write_tmp_and_move(self.lock_path) as f:
sjson.dump(self._to_lockfile_dict(), stream=f)
- self._update_and_write_manifest(raw_yaml_dict, yaml_dict)
else:
with fs.safe_remove(self.lock_path):
self._update_and_write_manifest(raw_yaml_dict, yaml_dict)