Avoid null reference in arch concretization (#2596)
Fixes #2587 The concretizer falls back on using the root architecture (followed by the default system architecture) to fill in unspecified arch properties for a spec. It failed to check cases where the root could be None.
This commit is contained in:
parent
3866dba265
commit
0038ea84a1
@ -222,9 +222,10 @@ def concretize_architecture(self, spec):
|
|||||||
spec.architecture = spack.spec.ArchSpec(sys_arch)
|
spec.architecture = spack.spec.ArchSpec(sys_arch)
|
||||||
spec_changed = True
|
spec_changed = True
|
||||||
|
|
||||||
default_archs = [root_arch, sys_arch]
|
default_archs = list(x for x in [root_arch, sys_arch] if x)
|
||||||
while not spec.architecture.concrete and default_archs:
|
for arch in default_archs:
|
||||||
arch = default_archs.pop(0)
|
if spec.architecture.concrete:
|
||||||
|
break
|
||||||
|
|
||||||
replacement_fields = [k for k, v in iteritems(arch.to_cmp_dict())
|
replacement_fields = [k for k, v in iteritems(arch.to_cmp_dict())
|
||||||
if v and not getattr(spec.architecture, k)]
|
if v and not getattr(spec.architecture, k)]
|
||||||
@ -232,6 +233,9 @@ def concretize_architecture(self, spec):
|
|||||||
setattr(spec.architecture, field, getattr(arch, field))
|
setattr(spec.architecture, field, getattr(arch, field))
|
||||||
spec_changed = True
|
spec_changed = True
|
||||||
|
|
||||||
|
if not spec.architecture.concrete:
|
||||||
|
raise InsufficientArchitectureInfoError(spec, default_archs)
|
||||||
|
|
||||||
return spec_changed
|
return spec_changed
|
||||||
|
|
||||||
def concretize_variants(self, spec):
|
def concretize_variants(self, spec):
|
||||||
@ -466,6 +470,17 @@ def __init__(self, spec):
|
|||||||
% (spec.name, spec.versions))
|
% (spec.name, spec.versions))
|
||||||
|
|
||||||
|
|
||||||
|
class InsufficientArchitectureInfoError(spack.error.SpackError):
|
||||||
|
|
||||||
|
"""Raised when details on architecture cannot be collected from the
|
||||||
|
system"""
|
||||||
|
|
||||||
|
def __init__(self, spec, archs):
|
||||||
|
super(InsufficientArchitectureInfoError, self).__init__(
|
||||||
|
"Cannot determine necessary architecture information for '%s': %s"
|
||||||
|
% (spec.name, str(archs)))
|
||||||
|
|
||||||
|
|
||||||
class NoBuildError(spack.error.SpackError):
|
class NoBuildError(spack.error.SpackError):
|
||||||
"""Raised when a package is configured with the buildable option False, but
|
"""Raised when a package is configured with the buildable option False, but
|
||||||
no satisfactory external versions can be found"""
|
no satisfactory external versions can be found"""
|
||||||
|
Loading…
Reference in New Issue
Block a user