spec_list: do not resolve abstract hashes (#44760)
This commit is contained in:
@@ -212,10 +212,7 @@ def _expand_matrix_constraints(matrix_config):
|
|||||||
results = []
|
results = []
|
||||||
for combo in itertools.product(*expanded_rows):
|
for combo in itertools.product(*expanded_rows):
|
||||||
# Construct a combined spec to test against excludes
|
# Construct a combined spec to test against excludes
|
||||||
flat_combo = [constraint for constraint_list in combo for constraint in constraint_list]
|
flat_combo = [Spec(constraint) for constraints in combo for constraint in constraints]
|
||||||
|
|
||||||
# Resolve abstract hashes so we can exclude by their concrete properties
|
|
||||||
flat_combo = [Spec(x).lookup_hash() for x in flat_combo]
|
|
||||||
|
|
||||||
test_spec = flat_combo[0].copy()
|
test_spec = flat_combo[0].copy()
|
||||||
for constraint in flat_combo[1:]:
|
for constraint in flat_combo[1:]:
|
||||||
@@ -231,7 +228,9 @@ def _expand_matrix_constraints(matrix_config):
|
|||||||
spack.variant.substitute_abstract_variants(test_spec)
|
spack.variant.substitute_abstract_variants(test_spec)
|
||||||
except spack.variant.UnknownVariantError:
|
except spack.variant.UnknownVariantError:
|
||||||
pass
|
pass
|
||||||
if any(test_spec.satisfies(x) for x in excludes):
|
|
||||||
|
# Resolve abstract hashes for exclusion criteria
|
||||||
|
if any(test_spec.lookup_hash().satisfies(x) for x in excludes):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if sigil:
|
if sigil:
|
||||||
|
|||||||
@@ -196,21 +196,29 @@ def test_spec_list_matrix_exclude(self, mock_packages):
|
|||||||
speclist = SpecList("specs", matrix)
|
speclist = SpecList("specs", matrix)
|
||||||
assert len(speclist.specs) == 1
|
assert len(speclist.specs) == 1
|
||||||
|
|
||||||
@pytest.mark.regression("22991")
|
def test_spec_list_exclude_with_abstract_hashes(self, mock_packages, install_mockery):
|
||||||
def test_spec_list_constraints_with_structure(
|
# Put mpich in the database so it can be referred to by hash.
|
||||||
self, mock_packages, mock_fetch, install_mockery
|
mpich_1 = Spec("mpich+debug").concretized()
|
||||||
):
|
mpich_2 = Spec("mpich~debug").concretized()
|
||||||
# Setup by getting hash and installing package with dep
|
mpich_1.package.do_install(fake=True)
|
||||||
libdwarf_spec = Spec("libdwarf").concretized()
|
mpich_2.package.do_install(fake=True)
|
||||||
libdwarf_spec.package.do_install()
|
|
||||||
|
|
||||||
# Create matrix
|
# Create matrix and exclude +debug, which excludes the first mpich after its abstract hash
|
||||||
matrix = {
|
# is resolved.
|
||||||
"matrix": [["mpileaks"], ["^callpath"], ["^libdwarf/%s" % libdwarf_spec.dag_hash()]]
|
speclist = SpecList(
|
||||||
|
"specs",
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"matrix": [
|
||||||
|
["mpileaks"],
|
||||||
|
["^callpath"],
|
||||||
|
[f"^mpich/{mpich_1.dag_hash(5)}", f"^mpich/{mpich_2.dag_hash(5)}"],
|
||||||
|
],
|
||||||
|
"exclude": ["^mpich+debug"],
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
# ensure the concrete spec was retained in the matrix entry of which
|
# Ensure that only mpich~debug is selected, and that the assembled spec remains abstract.
|
||||||
# it is a dependency
|
|
||||||
speclist = SpecList("specs", [matrix])
|
|
||||||
assert len(speclist.specs) == 1
|
assert len(speclist.specs) == 1
|
||||||
assert libdwarf_spec in speclist.specs[0]
|
assert speclist.specs[0] == Spec(f"mpileaks ^callpath ^mpich/{mpich_2.dag_hash(5)}")
|
||||||
|
|||||||
Reference in New Issue
Block a user