Skip to content

Commit a9a9466

Browse files
committed
address review comments
1 parent 05b73b1 commit a9a9466

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

lib/spack/spack/environment.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,10 @@ def __init__(self, path, init_file=None, with_view=None):
426426
self._set_user_specs_from_lockfile()
427427

428428
if read_lock_version == 1:
429+
tty.debug(
430+
"Storing backup of old lockfile {0} at {1}".format(
431+
self.lock_path, self._lock_backup_v1_path))
429432
shutil.copy(self.lock_path, self._lock_backup_v1_path)
430-
tty.debug("Storing backup of old lockfile format")
431433

432434
if with_view is False:
433435
self._view_path = None
@@ -1002,22 +1004,19 @@ def _read_lockfile_dict(self, d):
10021004
old_hash_to_new = {}
10031005
self.specs_by_hash = {}
10041006
for _, spec in specs_by_hash.items():
1005-
old_hash = spec.dag_hash()
1006-
full_hash = spec.dag_hash(all_deps=True)
1007-
if old_hash in root_hashes:
1008-
old_hash_to_new[old_hash] = full_hash
1007+
dag_hash = spec.dag_hash()
1008+
build_hash = spec.dag_hash(all_deps=True)
1009+
if dag_hash in root_hashes:
1010+
old_hash_to_new[dag_hash] = build_hash
10091011

1010-
if (old_hash in root_hashes or full_hash in root_hashes):
1011-
self.specs_by_hash[full_hash] = spec
1012+
if (dag_hash in root_hashes or build_hash in root_hashes):
1013+
self.specs_by_hash[build_hash] = spec
10121014

10131015
if old_hash_to_new:
1014-
updated_hashes_order = list()
1015-
for h in self.concretized_order:
1016-
if h in old_hash_to_new:
1017-
updated_hashes_order.append(old_hash_to_new[h])
1018-
else:
1019-
updated_hashes_order.append(h)
1020-
self.concretized_order = updated_hashes_order
1016+
# Replace any older hashes in concretized_order with hashes
1017+
# that include build deps
1018+
self.concretized_order = [
1019+
old_hash_to_new.get(h, h) for h in self.concretized_order]
10211020

10221021
def write(self):
10231022
"""Writes an in-memory environment to its location on disk.

0 commit comments

Comments
 (0)