concretizer: each external version is allowed by definition (#20247)
Registering external versions among the lists of allowed ones generates the correct rules for `version_satisfies`
This commit is contained in:
parent
a6d433b937
commit
ecfba13d89
@ -1060,6 +1060,7 @@ def external_packages(self):
|
||||
for id, spec in enumerate(external_specs):
|
||||
self.gen.newline()
|
||||
spec_id = fn.external_spec(pkg_name, id)
|
||||
self.possible_versions[spec.name].add(spec.version)
|
||||
clauses = self.spec_clauses(spec, body=True)
|
||||
# This is an iff below, wish it could be written in a
|
||||
# more compact form
|
||||
|
@ -979,3 +979,21 @@ def test_all_patches_applied(self):
|
||||
def test_dont_select_version_that_brings_more_variants_in(self):
|
||||
s = Spec('dep-with-variants-if-develop-root').concretized()
|
||||
assert s['dep-with-variants-if-develop'].satisfies('@1.0')
|
||||
|
||||
@pytest.mark.regression('20244')
|
||||
@pytest.mark.parametrize('spec_str,is_external,expected', [
|
||||
# These are all externals, and 0_8 is a version not in package.py
|
||||
('externaltool@1.0', True, '@1.0'),
|
||||
('externaltool@0.9', True, '@0.9'),
|
||||
('externaltool@0_8', True, '@0_8'),
|
||||
# This external package is buildable, has a custom version
|
||||
# in packages.yaml that is greater than the ones in package.py
|
||||
# and specifies a variant
|
||||
('external-buildable-with-variant +baz', True, '@1.1.special +baz'),
|
||||
('external-buildable-with-variant ~baz', False, '@1.0 ~baz'),
|
||||
('external-buildable-with-variant@1.0: ~baz', False, '@1.0 ~baz'),
|
||||
])
|
||||
def test_external_package_versions(self, spec_str, is_external, expected):
|
||||
s = Spec(spec_str).concretized()
|
||||
assert s.external == is_external
|
||||
assert s.satisfies(expected)
|
||||
|
@ -9,6 +9,8 @@ packages:
|
||||
prefix: /path/to/external_tool
|
||||
- spec: externaltool@0.9%gcc@4.5.0
|
||||
prefix: /usr
|
||||
- spec: externaltool@0_8%gcc@4.5.0
|
||||
prefix: /usr
|
||||
externalvirtual:
|
||||
buildable: False
|
||||
externals:
|
||||
@ -27,3 +29,8 @@ packages:
|
||||
externals:
|
||||
- spec: requires-virtual@2.0
|
||||
prefix: /usr
|
||||
'external-buildable-with-variant':
|
||||
buildable: True
|
||||
externals:
|
||||
- spec: external-buildable-with-variant@1.1.special +baz
|
||||
prefix: /usr
|
||||
|
@ -0,0 +1,15 @@
|
||||
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
|
||||
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||
#
|
||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||
|
||||
from spack import *
|
||||
|
||||
|
||||
class ExternalBuildableWithVariant(Package):
|
||||
homepage = "http://somewhere.com"
|
||||
url = "http://somewhere.com/module-1.0.tar.gz"
|
||||
|
||||
version('1.0', '1234567890abcdef1234567890abcdef')
|
||||
|
||||
variant('baz', default=False, description='nope')
|
@ -12,5 +12,6 @@ class Externaltool(Package):
|
||||
|
||||
version('1.0', '1234567890abcdef1234567890abcdef')
|
||||
version('0.9', '1234567890abcdef1234567890abcdef')
|
||||
version('0.8.1', '1234567890abcdef1234567890abcdef')
|
||||
|
||||
depends_on('externalprereq')
|
||||
|
Loading…
Reference in New Issue
Block a user