environment.py: write lockfile last (#30039)
This makes it easier to write `spack.lock: spack.yaml` type of rules in `Makefiles`.
This commit is contained in:
parent
dc3cf5c6b0
commit
abc162cf3b
@ -1897,10 +1897,14 @@ def write(self, regenerate=True):
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user