-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Build type dependencies enter "partially" in DAG hash #21491
Copy link
Copy link
Closed
Labels
Description
Adding the type "build" to a dependency with another type results in a change in the hash. Adding a "build" type only dependency instead doesn't affect the hash.
Steps to reproduce the issue
Change the xz package adding a:
depends_on('zlib', type='link')and check the dag hash and dependency types by:
$ spack spec -lt xz
Input spec
--------------------------------
[ ] xz
Concretized
--------------------------------
ry7x4qn [ ] [email protected]%[email protected]~pic arch=linux-ubuntu18.04-broadwell
kepdmuv [ l ] ^[email protected]%[email protected]+optimize+pic+shared arch=linux-ubuntu18.04-broadwellNow modify the directive above into:
depends_on('zlib')This results in:
$ spack spec -lt xz
Input spec
--------------------------------
[ ] xz
Concretized
--------------------------------
eaa3ko3 [ ] [email protected]%[email protected]~pic arch=linux-ubuntu18.04-broadwell
kepdmuv [bl ] ^[email protected]%[email protected]+optimize+pic+shared arch=linux-ubuntu18.04-broadwellError Message
No error message, but an unexpected behavior.
Information on your system
- Spack: 0.16.0-1128-39a429b2a3
- Python: 3.8.5
- Platform: linux-ubuntu18.04-broadwell
- Concretizer: original
Additional information
This diff seems to make the hash computation invariant with respect to build type edges, regardless of other types that may be applied to the same edge:
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index 06767d6c7d..4d0550add1 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -1633,13 +1633,18 @@ def to_node_dict(self, hash=ht.dag_hash):
deps = self.dependencies_dict(deptype=hash.deptype)
if deps:
- d['dependencies'] = syaml.syaml_dict([
+ sorted_items = [x for x in sorted(deps.items())]
+ entries = [
(name,
syaml.syaml_dict([
('hash', dspec.spec._cached_hash(hash)),
- ('type', sorted(str(s) for s in dspec.deptypes))])
- ) for name, dspec in sorted(deps.items())
- ])
+ ('type', sorted(str(s) for s in dspec.deptypes
+ if str(s) in hash.deptype)
+ )])
+ ) for name, dspec in sorted_items
+ ]
+ dependency_dictionary = syaml.syaml_dict(entries)
+ d['dependencies'] = dependency_dictionaryIt makes a lot of tests fail though, so further modifications may be needed.
- I have run
spack debug reportand reported the version of Spack/Python/Platform - I have searched the issues of this repo and believe this is not a duplicate
- I have run the failing commands in debug mode and reported the output
Reactions are currently unavailable