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.
|
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
|
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
|
dependency, it will use the the pre-installed OpenMPI in
|
||||||
the given directory. This example also specifies that Spack should never
|
the given directory.
|
||||||
build its own OpenMPI via the ``nobuild: True`` option.
|
|
||||||
|
|
||||||
Each ``packages.yaml`` begins with a ``packages:`` token, followed
|
Each ``packages.yaml`` begins with a ``packages:`` token, followed
|
||||||
by a list of package names. To specify externals, add a ``paths``
|
by a list of package names. To specify externals, add a ``paths``
|
||||||
@ -111,16 +110,16 @@ be:
|
|||||||
paths:
|
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: /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.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
|
openmpi@1.6.5%intel@10.1=chaos_5_x86_64_ib: /opt/openmpi-1.6.5-intel
|
||||||
nobuild: True
|
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
|
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.
|
a package name.
|
||||||
|
|
||||||
The ``nobuild`` does not need to be paired with external packages.
|
The ``buildable`` does not need to be paired with external packages.
|
||||||
It could also be used alone to forbid packages that may be
|
It could also be used alone to forbid packages that may be
|
||||||
buggy or otherwise undesirable.
|
buggy or otherwise undesirable.
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,12 +69,12 @@ def _valid_virtuals_and_externals(self, spec):
|
|||||||
packages = [spec]
|
packages = [spec]
|
||||||
|
|
||||||
# For each candidate package, if it has externals add those to the candidates
|
# 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 = []
|
candidates = []
|
||||||
all_compilers = spack.compilers.all_compilers()
|
all_compilers = spack.compilers.all_compilers()
|
||||||
for pkg in packages:
|
for pkg in packages:
|
||||||
externals = spec_externals(pkg)
|
externals = spec_externals(pkg)
|
||||||
buildable = not is_spec_nobuild(pkg)
|
buildable = is_spec_buildable(pkg)
|
||||||
if buildable:
|
if buildable:
|
||||||
candidates.append((pkg, None))
|
candidates.append((pkg, None))
|
||||||
for ext in externals:
|
for ext in externals:
|
||||||
@ -369,8 +369,8 @@ def __init__(self, spec):
|
|||||||
|
|
||||||
|
|
||||||
class NoBuildError(spack.error.SpackError):
|
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"""
|
no satisfactory external versions can be found"""
|
||||||
def __init__(self, spec):
|
def __init__(self, spec):
|
||||||
super(NoBuildError, self).__init__(
|
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',
|
'type' : 'array',
|
||||||
'default' : [],
|
'default' : [],
|
||||||
'items' : { 'type' : 'string' } }, #compiler specs
|
'items' : { 'type' : 'string' } }, #compiler specs
|
||||||
'nobuild': {
|
'buildable': {
|
||||||
'type': 'boolean',
|
'type': 'boolean',
|
||||||
'default': False,
|
'default': True,
|
||||||
},
|
},
|
||||||
'providers': {
|
'providers': {
|
||||||
'type': 'object',
|
'type': 'object',
|
||||||
@ -557,15 +557,15 @@ def spec_externals(spec):
|
|||||||
return spec_locations
|
return spec_locations
|
||||||
|
|
||||||
|
|
||||||
def is_spec_nobuild(spec):
|
def is_spec_buildable(spec):
|
||||||
"""Return true if the spec pkgspec is configured as nobuild"""
|
"""Return true if the spec pkgspec is configured as buildable"""
|
||||||
allpkgs = get_config('packages')
|
allpkgs = get_config('packages')
|
||||||
name = spec.name
|
name = spec.name
|
||||||
if not spec.name in allpkgs:
|
if not spec.name in allpkgs:
|
||||||
return False
|
return True
|
||||||
if not 'nobuild' in allpkgs[spec.name]:
|
if not 'buildable' in allpkgs[spec.name]:
|
||||||
return False
|
return True
|
||||||
return allpkgs[spec.name]['nobuild']
|
return allpkgs[spec.name]['buildable']
|
||||||
|
|
||||||
|
|
||||||
class ConfigError(SpackError): pass
|
class ConfigError(SpackError): pass
|
||||||
|
@ -52,11 +52,11 @@
|
|||||||
mock_packages_config = """\
|
mock_packages_config = """\
|
||||||
packages:
|
packages:
|
||||||
externaltool:
|
externaltool:
|
||||||
nobuild: True
|
buildable: False
|
||||||
paths:
|
paths:
|
||||||
externaltool@1.0%gcc@4.5.0: /path/to/external_tool
|
externaltool@1.0%gcc@4.5.0: /path/to/external_tool
|
||||||
externalvirtual:
|
externalvirtual:
|
||||||
nobuild: True
|
buildable: False
|
||||||
paths:
|
paths:
|
||||||
externalvirtual@2.0%clang@3.3: /path/to/external_virtual_clang
|
externalvirtual@2.0%clang@3.3: /path/to/external_virtual_clang
|
||||||
externalvirtual@1.0%gcc@4.5.0: /path/to/external_virtual_gcc
|
externalvirtual@1.0%gcc@4.5.0: /path/to/external_virtual_gcc
|
||||||
|
Loading…
Reference in New Issue
Block a user