Invert and rename the nobuild
option in package.yaml configs to buildable
.
This commit is contained in:
parent
4574f768ef
commit
1c7f754e5b
@ -78,8 +78,7 @@ This example lists three installations of OpenMPI, one built with gcc,
|
||||
one built with gcc and debug information, and another built with Intel.
|
||||
If Spack is asked to build a package that uses one of these MPIs as a
|
||||
dependency, it will use the the pre-installed OpenMPI in
|
||||
the given directory. This example also specifies that Spack should never
|
||||
build its own OpenMPI via the ``nobuild: True`` option.
|
||||
the given directory.
|
||||
|
||||
Each ``packages.yaml`` begins with a ``packages:`` token, followed
|
||||
by a list of package names. To specify externals, add a ``paths``
|
||||
@ -111,16 +110,16 @@ be:
|
||||
paths:
|
||||
openmpi@1.4.3%gcc@4.4.7=chaos_5_x86_64_ib: /opt/openmpi-1.4.3
|
||||
openmpi@1.4.3%gcc@4.4.7=chaos_5_x86_64_ib+debug: /opt/openmpi-1.4.3-debug
|
||||
openmpi@1.6.5%intel@10.1=chaos_5_x86_64_ib: /opt/openmpi-1.6.5-intel
|
||||
nobuild: True
|
||||
openmpi@1.6.5%intel@10.1=chaos_5_x86_64_ib: /opt/openmpi-1.6.5-intel
|
||||
buildable: False
|
||||
|
||||
The addition of the ``nobuild`` flag tells Spack that it should never build
|
||||
The addition of the ``buildable`` flag tells Spack that it should never build
|
||||
its own version of OpenMPI, and it will instead always rely on a pre-built
|
||||
OpenMPI. Similar to ``paths``, ``nobuild`` is specified as a property under
|
||||
OpenMPI. Similar to ``paths``, ``buildable`` is specified as a property under
|
||||
a package name.
|
||||
|
||||
The ``nobuild`` does not need to be paired with external packages.
|
||||
It could also be used alone to forbid packages that may be
|
||||
The ``buildable`` does not need to be paired with external packages.
|
||||
It could also be used alone to forbid packages that may be
|
||||
buggy or otherwise undesirable.
|
||||
|
||||
|
||||
|
@ -69,12 +69,12 @@ def _valid_virtuals_and_externals(self, spec):
|
||||
packages = [spec]
|
||||
|
||||
# For each candidate package, if it has externals add those to the candidates
|
||||
# if it's a nobuild, then only add the externals.
|
||||
# if it's not buildable, then only add the externals.
|
||||
candidates = []
|
||||
all_compilers = spack.compilers.all_compilers()
|
||||
for pkg in packages:
|
||||
externals = spec_externals(pkg)
|
||||
buildable = not is_spec_nobuild(pkg)
|
||||
buildable = is_spec_buildable(pkg)
|
||||
if buildable:
|
||||
candidates.append((pkg, None))
|
||||
for ext in externals:
|
||||
@ -369,8 +369,8 @@ def __init__(self, spec):
|
||||
|
||||
|
||||
class NoBuildError(spack.error.SpackError):
|
||||
"""Raised when a package is configured with the nobuild option, but
|
||||
"""Raised when a package is configured with the buildable option False, but
|
||||
no satisfactory external versions can be found"""
|
||||
def __init__(self, spec):
|
||||
super(NoBuildError, self).__init__(
|
||||
"The spec '%s' is configured as nobuild, and no matching external installs were found" % spec.name)
|
||||
"The spec '%s' is configured as not buildable, and no matching external installs were found" % spec.name)
|
||||
|
@ -220,9 +220,9 @@
|
||||
'type' : 'array',
|
||||
'default' : [],
|
||||
'items' : { 'type' : 'string' } }, #compiler specs
|
||||
'nobuild': {
|
||||
'buildable': {
|
||||
'type': 'boolean',
|
||||
'default': False,
|
||||
'default': True,
|
||||
},
|
||||
'providers': {
|
||||
'type': 'object',
|
||||
@ -557,15 +557,15 @@ def spec_externals(spec):
|
||||
return spec_locations
|
||||
|
||||
|
||||
def is_spec_nobuild(spec):
|
||||
"""Return true if the spec pkgspec is configured as nobuild"""
|
||||
def is_spec_buildable(spec):
|
||||
"""Return true if the spec pkgspec is configured as buildable"""
|
||||
allpkgs = get_config('packages')
|
||||
name = spec.name
|
||||
if not spec.name in allpkgs:
|
||||
return False
|
||||
if not 'nobuild' in allpkgs[spec.name]:
|
||||
return False
|
||||
return allpkgs[spec.name]['nobuild']
|
||||
return True
|
||||
if not 'buildable' in allpkgs[spec.name]:
|
||||
return True
|
||||
return allpkgs[spec.name]['buildable']
|
||||
|
||||
|
||||
class ConfigError(SpackError): pass
|
||||
|
@ -52,11 +52,11 @@
|
||||
mock_packages_config = """\
|
||||
packages:
|
||||
externaltool:
|
||||
nobuild: True
|
||||
buildable: False
|
||||
paths:
|
||||
externaltool@1.0%gcc@4.5.0: /path/to/external_tool
|
||||
externalvirtual:
|
||||
nobuild: True
|
||||
buildable: False
|
||||
paths:
|
||||
externalvirtual@2.0%clang@3.3: /path/to/external_virtual_clang
|
||||
externalvirtual@1.0%gcc@4.5.0: /path/to/external_virtual_gcc
|
||||
|
Loading…
Reference in New Issue
Block a user