External packages have a consistent hash across different concretizers

This commit is contained in:
Massimiliano Culpo 2020-11-04 20:54:37 +01:00 committed by Todd Gamblin
parent 5c5a44988e
commit 522be6cadf
2 changed files with 12 additions and 1 deletions

View File

@ -1644,7 +1644,7 @@ def external_spec(self, pkg, idx):
spec_info = packages_yaml[pkg]['externals'][int(idx)]
self._specs[pkg].external_path = spec_info.get('prefix', None)
self._specs[pkg].external_modules = (
spack.spec.Spec._format_module_list(spec_info.get('modules', []))
spack.spec.Spec._format_module_list(spec_info.get('modules', None))
)
self._specs[pkg].extra_attributes = spec_info.get(
'extra_attributes', {}

View File

@ -855,3 +855,14 @@ def test_compiler_constraint_with_external_package(
s = Spec(spec_str).concretized()
assert s.external
assert s.satisfies(expected)
def test_external_packages_have_consistent_hash(self):
if spack.config.get('config:concretizer') == 'original':
pytest.skip('This tests needs the ASP-based concretizer')
s, t = Spec('externaltool'), Spec('externaltool')
s._old_concretize(), t._new_concretize()
assert s.dag_hash() == t.dag_hash()
assert s.build_hash() == t.build_hash()
assert s.full_hash() == t.full_hash()