Merge remote-tracking branch 'upstream/develop' into develop

This commit is contained in:
Jim Galarowicz 2017-01-16 14:48:43 -08:00
commit d5730a17b1
53 changed files with 854 additions and 273 deletions

View File

@ -647,8 +647,8 @@ avoid ambiguity.
When spack normalizes specs, it prints them out with no spaces boolean When spack normalizes specs, it prints them out with no spaces boolean
variants using the backwards compatibility syntax and uses only ``~`` variants using the backwards compatibility syntax and uses only ``~``
for disabled boolean variants. We allow ``-`` and spaces on the command for disabled boolean variants. The ``-`` and spaces on the command
line is provided for convenience and legibility. line are provided for convenience and legibility.
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
Compiler Flags Compiler Flags
@ -658,14 +658,17 @@ Compiler flags are specified using the same syntax as non-boolean variants,
but fulfill a different purpose. While the function of a variant is set by but fulfill a different purpose. While the function of a variant is set by
the package, compiler flags are used by the compiler wrappers to inject the package, compiler flags are used by the compiler wrappers to inject
flags into the compile line of the build. Additionally, compiler flags are flags into the compile line of the build. Additionally, compiler flags are
inherited by dependencies. ``spack install libdwarf cppflags=\"-g\"`` will inherited by dependencies. ``spack install libdwarf cppflags="-g"`` will
install both libdwarf and libelf with the ``-g`` flag injected into their install both libdwarf and libelf with the ``-g`` flag injected into their
compile line. compile line.
Notice that the value of the compiler flags must be escape quoted on the Notice that the value of the compiler flags must be quoted if it
command line. From within python files, the same spec would be specified contains any spaces. Any of ``cppflags=-O3``, ``cppflags="-O3"``,
``libdwarf cppflags="-g"``. This is necessary because of how the shell ``cppflags='-O3'``, and ``cppflags="-O3 -fPIC"`` are acceptable, but
handles the quote symbols. ``cppflags=-O3 -fPIC`` is not. Additionally, if they value of the
compiler flags is not the last thing on the line, it must be followed
by a space. The commmand ``spack install libelf cppflags="-O3"%intel``
will be interpreted as an attempt to set `cppflags="-O3%intel"``.
The six compiler flags are injected in the order of implicit make commands The six compiler flags are injected in the order of implicit make commands
in GNU Autotools. If all flags are set, the order is in GNU Autotools. If all flags are set, the order is

View File

@ -41,7 +41,7 @@ platform, all on the command line.
$ spack install mpileaks@1.1.2 %gcc@4.7.3 +debug $ spack install mpileaks@1.1.2 %gcc@4.7.3 +debug
# Add compiler flags using the conventional names # Add compiler flags using the conventional names
$ spack install mpileaks@1.1.2 %gcc@4.7.3 cppflags=\"-O3 -floop-block\" $ spack install mpileaks@1.1.2 %gcc@4.7.3 cppflags="-O3 -floop-block"
# Cross-compile for a different architecture with arch= # Cross-compile for a different architecture with arch=
$ spack install mpileaks@1.1.2 arch=bgqos_0 $ spack install mpileaks@1.1.2 arch=bgqos_0

View File

@ -632,7 +632,7 @@ the command line:
.. code-block:: console .. code-block:: console
$ spack install openmpi fflags=\"-mismatch\" $ spack install openmpi fflags="-mismatch"
Or it can be set permanently in your ``compilers.yaml``: Or it can be set permanently in your ``compilers.yaml``:

View File

@ -184,15 +184,15 @@ compilers.
[+] ~/spack/opt/spack/linux-redhat6-x86_64/intel-15.0.4/libelf-0.8.13-w33hrejdyqu2j2gggdswitls2zv6kdsi [+] ~/spack/opt/spack/linux-redhat6-x86_64/intel-15.0.4/libelf-0.8.13-w33hrejdyqu2j2gggdswitls2zv6kdsi
The spec syntax also includes compiler flags. Spack accepts ``cppflags``, The spec syntax also includes compiler flags. Spack accepts
``cflags``, ``cxxflags``, ``fflags``, ``ldflags``, and ``ldlibs`` ``cppflags``, ``cflags``, ``cxxflags``, ``fflags``, ``ldflags``, and
parameters. The values of these fields must be escape-quoted with ``\"`` ``ldlibs`` parameters. The values of these fields must be quoted on
on the command line. These values are injected into the compile line the command line if they include spaces. These values are injected
automatically by the Spack compiler wrappers. into the compile line automatically by the Spack compiler wrappers.
.. code-block:: console .. code-block:: console
$ spack install libelf @0.8.12 cppflags=\"-O3\" $ spack install libelf @0.8.12 cppflags="-O3"
==> Installing libelf ==> Installing libelf
==> Trying to fetch from ~/spack/var/spack/cache/libelf/libelf-0.8.12.tar.gz ==> Trying to fetch from ~/spack/var/spack/cache/libelf/libelf-0.8.12.tar.gz
################################################################################################################################################################################# 100.0% ################################################################################################################################################################################# 100.0%
@ -309,7 +309,7 @@ top-level package, we can also specify about a dependency using ``^``.
Packages can also be referred to from the command line by their package Packages can also be referred to from the command line by their package
hash. Using the ``spack find -lf`` command earlier we saw that the hash hash. Using the ``spack find -lf`` command earlier we saw that the hash
of our optimized installation of libelf (``cppflags=\"-O3\"``) began with of our optimized installation of libelf (``cppflags="-O3"``) began with
``vrv2ttb``. We can now explicitly build with that package without typing ``vrv2ttb``. We can now explicitly build with that package without typing
the entire spec, by using the ``/`` sigil to refer to it by hash. As with the entire spec, by using the ``/`` sigil to refer to it by hash. As with
other tools like git, you do not need to specify an *entire* hash on the other tools like git, you do not need to specify an *entire* hash on the
@ -1103,8 +1103,8 @@ already covered in the :ref:`basics-tutorial-install` and
The ``spack find`` command can accept what we call "anonymous specs." The ``spack find`` command can accept what we call "anonymous specs."
These are expressions in spec syntax that do not contain a package These are expressions in spec syntax that do not contain a package
name. For example, `spack find %intel` will return every package built name. For example, `spack find %intel` will return every package built
with the intel compiler, and ``spack find cppflags=\\"-O3\\"`` will with the intel compiler, and ``spack find cppflags="-O3"`` will
return every package which was built with ``cppflags=\\"-O3\\"``. return every package which was built with ``cppflags="-O3"``.
.. code-block:: console .. code-block:: console
@ -1115,7 +1115,7 @@ return every package which was built with ``cppflags=\\"-O3\\"``.
$ spack find cppflags=\"-O3\" $ spack find cppflags="-O3"
==> 1 installed packages. ==> 1 installed packages.
-- linux-redhat6-x86_64 / gcc@4.4.7 ----------------------------- -- linux-redhat6-x86_64 / gcc@4.4.7 -----------------------------
libelf@0.8.12 libelf@0.8.12

View File

@ -432,19 +432,15 @@ def get_rpaths(pkg):
return rpaths return rpaths
def get_std_cmake_args(cmake_pkg): def get_std_cmake_args(pkg):
# standard CMake arguments """Returns the list of standard arguments that would be used if this
ret = ['-DCMAKE_INSTALL_PREFIX=%s' % cmake_pkg.prefix, package was a CMakePackage instance.
'-DCMAKE_BUILD_TYPE=RelWithDebInfo',
'-DCMAKE_VERBOSE_MAKEFILE=ON']
if platform.mac_ver()[0]:
ret.append('-DCMAKE_FIND_FRAMEWORK=LAST')
# Set up CMake rpath :param pkg: pkg under consideration
ret.append('-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=FALSE')
ret.append('-DCMAKE_INSTALL_RPATH=%s' % ":".join(get_rpaths(cmake_pkg)))
return ret :return: list of arguments for cmake
"""
return spack.CMakePackage._std_args(pkg)
def parent_class_modules(cls): def parent_class_modules(cls):
@ -553,6 +549,11 @@ def child_execution(child_connection, input_stream):
setup_package(pkg, dirty=dirty) setup_package(pkg, dirty=dirty)
function(input_stream) function(input_stream)
child_connection.send(None) child_connection.send(None)
except StopIteration as e:
# StopIteration is used to stop installations
# before the final stage, mainly for debug purposes
tty.msg(e.message)
child_connection.send(None)
except: except:
# catch ANYTHING that goes wrong in the child process # catch ANYTHING that goes wrong in the child process
exc_type, exc, tb = sys.exc_info() exc_type, exc, tb = sys.exc_info()

View File

@ -31,6 +31,7 @@
from subprocess import check_call from subprocess import check_call
import llnl.util.tty as tty import llnl.util.tty as tty
from llnl.util.filesystem import working_dir
from spack.package import PackageBase from spack.package import PackageBase
@ -38,16 +39,17 @@ class AutotoolsPackage(PackageBase):
"""Specialized class for packages that are built using GNU Autotools """Specialized class for packages that are built using GNU Autotools
This class provides four phases that can be overridden: This class provides four phases that can be overridden:
- autoreconf
- configure * autoreconf
- build * configure
- install * build
* install
They all have sensible defaults and for many packages the only thing They all have sensible defaults and for many packages the only thing
necessary will be to override `configure_args` necessary will be to override ``configure_args``
Additionally, you may specify make targets for build and install Additionally, you may specify make targets for build and install
phases by overriding `build_targets` and `install_targets` phases by overriding ``build_targets`` and ``install_targets``
""" """
phases = ['autoreconf', 'configure', 'build', 'install'] phases = ['autoreconf', 'configure', 'build', 'install']
# To be used in UI queries that require to know which # To be used in UI queries that require to know which
@ -124,6 +126,10 @@ def do_patch_config_guess(self):
return False return False
def build_directory(self):
"""Override to provide another place to build the package"""
return self.stage.source_path
def patch(self): def patch(self):
"""Perform any required patches.""" """Perform any required patches."""
@ -138,39 +144,44 @@ def autoreconf(self, spec, prefix):
@PackageBase.sanity_check('autoreconf') @PackageBase.sanity_check('autoreconf')
def is_configure_or_die(self): def is_configure_or_die(self):
"""Checks the presence of a `configure` file after the """Checks the presence of a ``configure`` file after the
autoreconf phase""" autoreconf phase"""
if not os.path.exists('configure'): with working_dir(self.build_directory()):
raise RuntimeError( if not os.path.exists('configure'):
'configure script not found in {0}'.format(os.getcwd())) raise RuntimeError(
'configure script not found in {0}'.format(os.getcwd()))
def configure_args(self): def configure_args(self):
"""Method to be overridden. Should return an iterable containing """Method to be overridden. Should return an iterable containing
all the arguments that must be passed to configure, except --prefix all the arguments that must be passed to configure, except ``--prefix``
""" """
return [] return []
def configure(self, spec, prefix): def configure(self, spec, prefix):
"""Runs configure with the arguments specified in `configure_args` """Runs configure with the arguments specified in ``configure_args``
and an appropriately set prefix and an appropriately set prefix
""" """
options = ['--prefix={0}'.format(prefix)] + self.configure_args() options = ['--prefix={0}'.format(prefix)] + self.configure_args()
inspect.getmodule(self).configure(*options)
with working_dir(self.build_directory()):
inspect.getmodule(self).configure(*options)
def build(self, spec, prefix): def build(self, spec, prefix):
"""Make the build targets""" """Make the build targets"""
inspect.getmodule(self).make(*self.build_targets) with working_dir(self.build_directory()):
inspect.getmodule(self).make(*self.build_targets)
def install(self, spec, prefix): def install(self, spec, prefix):
"""Make the install targets""" """Make the install targets"""
inspect.getmodule(self).make(*self.install_targets) with working_dir(self.build_directory()):
inspect.getmodule(self).make(*self.install_targets)
@PackageBase.sanity_check('build') @PackageBase.sanity_check('build')
@PackageBase.on_package_attributes(run_tests=True) @PackageBase.on_package_attributes(run_tests=True)
def _run_default_function(self): def _run_default_function(self):
"""This function is run after build if self.run_tests == True """This function is run after build if ``self.run_tests == True``
It will search for a method named `check` and run it. A sensible It will search for a method named ``check`` and run it. A sensible
default is provided in the base class. default is provided in the base class.
""" """
try: try:
@ -181,11 +192,12 @@ def _run_default_function(self):
tty.msg('Skipping default sanity checks [method `check` not implemented]') # NOQA: ignore=E501 tty.msg('Skipping default sanity checks [method `check` not implemented]') # NOQA: ignore=E501
def check(self): def check(self):
"""Default test : search the Makefile for targets `test` and `check` """Default test: search the Makefile for targets ``test`` and ``check``
and run them if found. and run them if found.
""" """
self._if_make_target_execute('test') with working_dir(self.build_directory()):
self._if_make_target_execute('check') self._if_make_target_execute('test')
self._if_make_target_execute('check')
# Check that self.prefix is there after installation # Check that self.prefix is there after installation
PackageBase.sanity_check('install')(PackageBase.sanity_check_prefix) PackageBase.sanity_check('install')(PackageBase.sanity_check_prefix)

View File

@ -24,7 +24,6 @@
############################################################################## ##############################################################################
import inspect import inspect
import os
import platform import platform
import llnl.util.tty as tty import llnl.util.tty as tty
@ -35,21 +34,28 @@
class CMakePackage(PackageBase): class CMakePackage(PackageBase):
"""Specialized class for packages that are built using cmake """Specialized class for packages that are built using CMake
This class provides three phases that can be overridden: This class provides three phases that can be overridden:
- cmake
- build * cmake
- install * build
* install
They all have sensible defaults and for many packages the only thing They all have sensible defaults and for many packages the only thing
necessary will be to override `cmake_args` necessary will be to override ``cmake_args``
Additionally, you may specify make targets for build and install
phases by overriding ``build_targets`` and ``install_targets``
""" """
phases = ['cmake', 'build', 'install'] phases = ['cmake', 'build', 'install']
# To be used in UI queries that require to know which # To be used in UI queries that require to know which
# build-system class we are using # build-system class we are using
build_system_class = 'CMakePackage' build_system_class = 'CMakePackage'
build_targets = []
install_targets = ['install']
depends_on('cmake', type='build') depends_on('cmake', type='build')
def build_type(self): def build_type(self):
@ -97,8 +103,9 @@ def build_directory(self):
def cmake_args(self): def cmake_args(self):
"""Method to be overridden. Should return an iterable containing """Method to be overridden. Should return an iterable containing
all the arguments that must be passed to configure, except: all the arguments that must be passed to configure, except:
- CMAKE_INSTALL_PREFIX
- CMAKE_BUILD_TYPE * CMAKE_INSTALL_PREFIX
* CMAKE_BUILD_TYPE
""" """
return [] return []
@ -106,26 +113,25 @@ def cmake(self, spec, prefix):
"""Run cmake in the build directory""" """Run cmake in the build directory"""
options = [self.root_cmakelists_dir()] + self.std_cmake_args + \ options = [self.root_cmakelists_dir()] + self.std_cmake_args + \
self.cmake_args() self.cmake_args()
create = not os.path.exists(self.build_directory()) with working_dir(self.build_directory(), create=True):
with working_dir(self.build_directory(), create=create):
inspect.getmodule(self).cmake(*options) inspect.getmodule(self).cmake(*options)
def build(self, spec, prefix): def build(self, spec, prefix):
"""The usual `make` after cmake""" """Make the build targets"""
with working_dir(self.build_directory()): with working_dir(self.build_directory()):
inspect.getmodule(self).make() inspect.getmodule(self).make(*self.build_targets)
def install(self, spec, prefix): def install(self, spec, prefix):
"""...and the final `make install` after cmake""" """Make the install targets"""
with working_dir(self.build_directory()): with working_dir(self.build_directory()):
inspect.getmodule(self).make('install') inspect.getmodule(self).make(*self.install_targets)
@PackageBase.sanity_check('build') @PackageBase.sanity_check('build')
@PackageBase.on_package_attributes(run_tests=True) @PackageBase.on_package_attributes(run_tests=True)
def _run_default_function(self): def _run_default_function(self):
"""This function is run after build if self.run_tests == True """This function is run after build if ``self.run_tests == True``
It will search for a method named `check` and run it. A sensible It will search for a method named ``check`` and run it. A sensible
default is provided in the base class. default is provided in the base class.
""" """
try: try:
@ -136,7 +142,7 @@ def _run_default_function(self):
tty.msg('Skipping default build sanity checks [method `check` not implemented]') # NOQA: ignore=E501 tty.msg('Skipping default build sanity checks [method `check` not implemented]') # NOQA: ignore=E501
def check(self): def check(self):
"""Default test : search the Makefile for the target `test` """Default test: search the Makefile for the target ``test``
and run them if found. and run them if found.
""" """
with working_dir(self.build_directory()): with working_dir(self.build_directory()):

View File

@ -34,9 +34,10 @@ class MakefilePackage(PackageBase):
"""Specialized class for packages that are built using editable Makefiles """Specialized class for packages that are built using editable Makefiles
This class provides three phases that can be overridden: This class provides three phases that can be overridden:
- edit
- build * edit
- install * build
* install
It is necessary to override the 'edit' phase, while 'build' and 'install' It is necessary to override the 'edit' phase, while 'build' and 'install'
have sensible defaults. have sensible defaults.
@ -58,12 +59,12 @@ def edit(self, spec, prefix):
tty.msg('Using default implementation: skipping edit phase.') tty.msg('Using default implementation: skipping edit phase.')
def build(self, spec, prefix): def build(self, spec, prefix):
"""Default build phase : call make passing build_args""" """Make the build targets"""
with working_dir(self.build_directory()): with working_dir(self.build_directory()):
inspect.getmodule(self).make(*self.build_targets) inspect.getmodule(self).make(*self.build_targets)
def install(self, spec, prefix): def install(self, spec, prefix):
"""Default install phase : call make passing install_args""" """Make the install targets"""
with working_dir(self.build_directory()): with working_dir(self.build_directory()):
inspect.getmodule(self).make(*self.install_targets) inspect.getmodule(self).make(*self.install_targets)

View File

@ -33,6 +33,7 @@ class RPackage(PackageBase):
"""Specialized class for packages that are built using R """Specialized class for packages that are built using R
This class provides a single phase that can be overridden: This class provides a single phase that can be overridden:
* install * install
It has sensible defaults and for many packages the only thing It has sensible defaults and for many packages the only thing

View File

@ -108,9 +108,6 @@ def parse_specs(args, **kwargs):
concretize = kwargs.get('concretize', False) concretize = kwargs.get('concretize', False)
normalize = kwargs.get('normalize', False) normalize = kwargs.get('normalize', False)
if isinstance(args, (python_list, tuple)):
args = " ".join(args)
try: try:
specs = spack.spec.parse(args) specs = spack.spec.parse(args)
for spec in specs: for spec in specs:
@ -219,9 +216,8 @@ def display_specs(specs, **kwargs):
format = " %%-%ds%%s" % width format = " %%-%ds%%s" % width
for abbrv, spec in zip(abbreviated, specs): for abbrv, spec in zip(abbreviated, specs):
if hashes: prefix = gray_hash(spec, hlen) if hashes else ''
print(gray_hash(spec, hlen), ) print prefix + (format % (abbrv, spec.prefix))
print(format % (abbrv, spec.prefix))
elif mode == 'deps': elif mode == 'deps':
for spec in specs: for spec in specs:

View File

@ -155,10 +155,6 @@ class CMakeGuess(DefaultGuess):
"""Provides appropriate overrides for cmake-based packages""" """Provides appropriate overrides for cmake-based packages"""
base_class_name = 'CMakePackage' base_class_name = 'CMakePackage'
dependencies = """\
# FIXME: Add additional dependencies if required.
depends_on('cmake', type='build')"""
body = """\ body = """\
def cmake_args(self): def cmake_args(self):
# FIXME: Add arguments other than # FIXME: Add arguments other than

View File

@ -315,36 +315,36 @@ def install(parser, args, **kwargs):
# Spec from cli # Spec from cli
specs = spack.cmd.parse_specs(args.package, concretize=True) specs = spack.cmd.parse_specs(args.package, concretize=True)
if len(specs) != 1: if len(specs) == 0:
tty.error('only one spec can be installed at a time.') tty.error('The `spack install` command requires a spec to install.')
spec = specs.pop()
# Check if we were asked to produce some log for dashboards for spec in specs:
if args.log_format is not None: # Check if we were asked to produce some log for dashboards
# Compute the filename for logging if args.log_format is not None:
log_filename = args.log_file # Compute the filename for logging
if not log_filename: log_filename = args.log_file
log_filename = default_log_file(spec) if not log_filename:
# Create the test suite in which to log results log_filename = default_log_file(spec)
test_suite = TestSuite(spec) # Create the test suite in which to log results
# Decorate PackageBase.do_install to get installation status test_suite = TestSuite(spec)
PackageBase.do_install = junit_output( # Decorate PackageBase.do_install to get installation status
spec, test_suite PackageBase.do_install = junit_output(
)(PackageBase.do_install) spec, test_suite
)(PackageBase.do_install)
# Do the actual installation # Do the actual installation
if args.things_to_install == 'dependencies': if args.things_to_install == 'dependencies':
# Install dependencies as-if they were installed # Install dependencies as-if they were installed
# for root (explicit=False in the DB) # for root (explicit=False in the DB)
kwargs['explicit'] = False kwargs['explicit'] = False
for s in spec.dependencies(): for s in spec.dependencies():
p = spack.repo.get(s) p = spack.repo.get(s)
p.do_install(**kwargs) p.do_install(**kwargs)
else: else:
package = spack.repo.get(spec) package = spack.repo.get(spec)
kwargs['explicit'] = True kwargs['explicit'] = True
package.do_install(**kwargs) package.do_install(**kwargs)
# Dump log file if asked to # Dump log file if asked to
if args.log_format is not None: if args.log_format is not None:
test_suite.dump(log_filename) test_suite.dump(log_filename)

View File

@ -132,6 +132,7 @@ def loads(mtype, specs, args):
module_commands = { module_commands = {
'tcl': 'module load ', 'tcl': 'module load ',
'lmod': 'module load ',
'dotkit': 'dotkit use ' 'dotkit': 'dotkit use '
} }

View File

@ -23,6 +23,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
############################################################################## ##############################################################################
import re import re
import shlex
import itertools import itertools
import spack.error import spack.error
@ -53,18 +54,55 @@ def __cmp__(self, other):
class Lexer(object): class Lexer(object):
"""Base class for Lexers that keep track of line numbers.""" """Base class for Lexers that keep track of line numbers."""
def __init__(self, lexicon): def __init__(self, lexicon0, mode_switches_01=[],
self.scanner = re.Scanner(lexicon) lexicon1=[], mode_switches_10=[]):
self.scanner0 = re.Scanner(lexicon0)
self.mode_switches_01 = mode_switches_01
self.scanner1 = re.Scanner(lexicon1)
self.mode_switches_10 = mode_switches_10
self.mode = 0
def token(self, type, value=''): def token(self, type, value=''):
return Token(type, value, if self.mode == 0:
self.scanner.match.start(0), self.scanner.match.end(0)) return Token(type, value,
self.scanner0.match.start(0),
self.scanner0.match.end(0))
else:
return Token(type, value,
self.scanner1.match.start(0),
self.scanner1.match.end(0))
def lex_word(self, word):
scanner = self.scanner0
mode_switches = self.mode_switches_01
if self.mode == 1:
scanner = self.scanner1
mode_switches = self.mode_switches_10
tokens, remainder = scanner.scan(word)
remainder_used = 0
for i, t in enumerate(tokens):
if t.type in mode_switches:
# Combine post-switch tokens with remainder and
# scan in other mode
self.mode = 1 - self.mode # swap 0/1
remainder_used = 1
tokens = tokens[:i + 1] + self.lex_word(
word[word.index(t.value) + len(t.value):])
break
if remainder and not remainder_used:
raise LexError("Invalid character", word, word.index(remainder))
return tokens
def lex(self, text): def lex(self, text):
tokens, remainder = self.scanner.scan(text) lexed = []
if remainder: for word in text:
raise LexError("Invalid character", text, text.index(remainder)) tokens = self.lex_word(word)
return tokens lexed.extend(tokens)
return lexed
class Parser(object): class Parser(object):
@ -121,6 +159,8 @@ def expect(self, id):
sys.exit(1) sys.exit(1)
def setup(self, text): def setup(self, text):
if isinstance(text, basestring):
text = shlex.split(text)
self.text = text self.text = text
self.push_tokens(self.lexer.lex(text)) self.push_tokens(self.lexer.lex(text))

View File

@ -614,7 +614,7 @@ def __str__(self):
if type(self.value) == bool: if type(self.value) == bool:
return '{0}{1}'.format('+' if self.value else '~', self.name) return '{0}{1}'.format('+' if self.value else '~', self.name)
else: else:
return ' {0}={1}'.format(self.name, self.value) return ' {0}={1} '.format(self.name, self.value)
class VariantMap(HashableMap): class VariantMap(HashableMap):
@ -731,7 +731,8 @@ def __str__(self):
cond_symbol = ' ' if len(sorted_keys) > 0 else '' cond_symbol = ' ' if len(sorted_keys) > 0 else ''
return cond_symbol + ' '.join( return cond_symbol + ' '.join(
str(key) + '=\"' + ' '.join( str(key) + '=\"' + ' '.join(
str(f) for f in self[key]) + '\"' for key in sorted_keys) str(f) for f in self[key]) + '\"'
for key in sorted_keys) + cond_symbol
class DependencyMap(HashableMap): class DependencyMap(HashableMap):
@ -2447,7 +2448,8 @@ def write(s, c):
write(fmt % str(self.variants), c) write(fmt % str(self.variants), c)
elif c == '=': elif c == '=':
if self.architecture and str(self.architecture): if self.architecture and str(self.architecture):
write(fmt % (' arch' + c + str(self.architecture)), c) a_str = ' arch' + c + str(self.architecture) + ' '
write(fmt % (a_str), c)
elif c == '#': elif c == '#':
out.write('-' + fmt % (self.dag_hash(7))) out.write('-' + fmt % (self.dag_hash(7)))
elif c == '$': elif c == '$':
@ -2506,7 +2508,7 @@ def write(s, c):
write(fmt % str(self.variants), '+') write(fmt % str(self.variants), '+')
elif named_str == 'ARCHITECTURE': elif named_str == 'ARCHITECTURE':
if self.architecture and str(self.architecture): if self.architecture and str(self.architecture):
write(fmt % str(self.architecture), ' arch=') write(fmt % str(self.architecture) + ' ', ' arch=')
elif named_str == 'SHA1': elif named_str == 'SHA1':
if self.dependencies: if self.dependencies:
out.write(fmt % str(self.dag_hash(7))) out.write(fmt % str(self.dag_hash(7)))
@ -2576,7 +2578,8 @@ def __cmp__(self, other):
return 0 return 0
def __str__(self): def __str__(self):
return self.format() + self.dep_string() ret = self.format() + self.dep_string()
return ret.strip()
def _install_status(self): def _install_status(self):
"""Helper for tree to print DB install status.""" """Helper for tree to print DB install status."""
@ -2650,7 +2653,7 @@ def __repr__(self):
# #
# These are possible token types in the spec grammar. # These are possible token types in the spec grammar.
# #
HASH, DEP, AT, COLON, COMMA, ON, OFF, PCT, EQ, QT, ID = range(11) HASH, DEP, AT, COLON, COMMA, ON, OFF, PCT, EQ, ID, VAL = range(11)
class SpecLexer(spack.parse.Lexer): class SpecLexer(spack.parse.Lexer):
@ -2671,10 +2674,12 @@ def __init__(self):
(r'\=', lambda scanner, val: self.token(EQ, val)), (r'\=', lambda scanner, val: self.token(EQ, val)),
# This is more liberal than identifier_re (see above). # This is more liberal than identifier_re (see above).
# Checked by check_identifier() for better error messages. # Checked by check_identifier() for better error messages.
(r'([\"\'])(?:(?=(\\?))\2.)*?\1',
lambda scanner, val: self.token(QT, val)),
(r'\w[\w.-]*', lambda scanner, val: self.token(ID, val)), (r'\w[\w.-]*', lambda scanner, val: self.token(ID, val)),
(r'\s+', lambda scanner, val: None)]) (r'\s+', lambda scanner, val: None)],
[EQ],
[(r'[\S].*', lambda scanner, val: self.token(VAL, val)),
(r'\s+', lambda scanner, val: None)],
[VAL])
# Lexer is always the same for every parser. # Lexer is always the same for every parser.
@ -2689,36 +2694,49 @@ def __init__(self):
def do_parse(self): def do_parse(self):
specs = [] specs = []
try: try:
while self.next: while self.next or self.previous:
# TODO: clean this parsing up a bit # TODO: clean this parsing up a bit
if self.previous: if self.previous:
# We picked up the name of this spec while finishing the
# previous spec
specs.append(self.spec(self.previous.value)) specs.append(self.spec(self.previous.value))
if self.accept(ID): self.previous = None
elif self.accept(ID):
self.previous = self.token self.previous = self.token
if self.accept(EQ): if self.accept(EQ):
# We're either parsing an anonymous spec beginning
# with a key-value pair or adding a key-value pair
# to the last spec
if not specs: if not specs:
specs.append(self.spec(None)) specs.append(self.spec(None))
if self.accept(QT): self.expect(VAL)
self.token.value = self.token.value[1:-1]
else:
self.expect(ID)
specs[-1]._add_flag( specs[-1]._add_flag(
self.previous.value, self.token.value) self.previous.value, self.token.value)
self.previous = None
else: else:
specs.append(self.spec(self.previous.value)) # We're parsing a new spec by name
self.previous = None value = self.previous.value
self.previous = None
specs.append(self.spec(value))
elif self.accept(HASH): elif self.accept(HASH):
# We're finding a spec by hash
specs.append(self.spec_by_hash()) specs.append(self.spec_by_hash())
elif self.accept(DEP): elif self.accept(DEP):
if not specs: if not specs:
# We're parsing an anonymous spec beginning with a
# dependency
self.previous = self.token self.previous = self.token
specs.append(self.spec(None)) specs.append(self.spec(None))
self.previous = None self.previous = None
if self.accept(HASH): if self.accept(HASH):
# We're finding a dependency by hash for an anonymous
# spec
dep = self.spec_by_hash() dep = self.spec_by_hash()
else: else:
# We're adding a dependency to the last spec
self.expect(ID) self.expect(ID)
dep = self.spec(self.token.value) dep = self.spec(self.token.value)
@ -2727,11 +2745,12 @@ def do_parse(self):
specs[-1]._add_dependency(dep, ()) specs[-1]._add_dependency(dep, ())
else: else:
# Attempt to construct an anonymous spec, but check that # If the next token can be part of a valid anonymous spec,
# the first token is valid # create the anonymous spec
# TODO: Is this check even necessary, or will it all be Lex if self.next.type in (AT, ON, OFF, PCT):
# errors now? specs.append(self.spec(None))
specs.append(self.spec(None, True)) else:
self.unexpected_token()
except spack.parse.ParseError as e: except spack.parse.ParseError as e:
raise SpecParseError(e) raise SpecParseError(e)
@ -2768,7 +2787,7 @@ def spec_by_hash(self):
return matches[0] return matches[0]
def spec(self, name, check_valid_token=False): def spec(self, name):
"""Parse a spec out of the input. If a spec is supplied, then initialize """Parse a spec out of the input. If a spec is supplied, then initialize
and return it instead of creating a new one.""" and return it instead of creating a new one."""
if name: if name:
@ -2819,35 +2838,28 @@ def spec(self, name, check_valid_token=False):
for version in vlist: for version in vlist:
spec._add_version(version) spec._add_version(version)
added_version = True added_version = True
check_valid_token = False
elif self.accept(ON): elif self.accept(ON):
spec._add_variant(self.variant(), True) spec._add_variant(self.variant(), True)
check_valid_token = False
elif self.accept(OFF): elif self.accept(OFF):
spec._add_variant(self.variant(), False) spec._add_variant(self.variant(), False)
check_valid_token = False
elif self.accept(PCT): elif self.accept(PCT):
spec._set_compiler(self.compiler()) spec._set_compiler(self.compiler())
check_valid_token = False
elif self.accept(ID): elif self.accept(ID):
self.previous = self.token self.previous = self.token
if self.accept(EQ): if self.accept(EQ):
if self.accept(QT): # We're adding a key-value pair to the spec
self.token.value = self.token.value[1:-1] self.expect(VAL)
else:
self.expect(ID)
spec._add_flag(self.previous.value, self.token.value) spec._add_flag(self.previous.value, self.token.value)
self.previous = None self.previous = None
else: else:
return spec # We've found the start of a new spec. Go back to do_parse
break
else: else:
if check_valid_token:
self.unexpected_token()
break break
# If there was no version in the spec, consier it an open range # If there was no version in the spec, consier it an open range

View File

@ -0,0 +1,42 @@
##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/llnl/spack
# Please also see the LICENSE file for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
# published by the Free Software Foundation) version 2.1, February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import spack
from spack.build_environment import get_std_cmake_args
from spack.spec import Spec
def test_cmake_std_args(config, builtin_mock):
# Call the function on a CMakePackage instance
s = Spec('cmake-client')
s.concretize()
pkg = spack.repo.get(s)
assert pkg.std_cmake_args == get_std_cmake_args(pkg)
# Call it on another kind of package
s = Spec('mpich')
s.concretize()
pkg = spack.repo.get(s)
assert get_std_cmake_args(pkg)

View File

@ -43,6 +43,9 @@ def concretize_scope(config, tmpdir):
spack.config.config_scopes.pop('concretize') spack.config.config_scopes.pop('concretize')
spack.package_prefs._pkgsort = PreferredPackages() spack.package_prefs._pkgsort = PreferredPackages()
# reset provider index each time, too
spack.repo._provider_index = None
def concretize(abstract_spec): def concretize(abstract_spec):
return Spec(abstract_spec).concretized() return Spec(abstract_spec).concretized()
@ -123,7 +126,8 @@ def test_no_virtuals_in_packages_yaml(self):
# set up a packages.yaml file with a vdep as a key. We use # set up a packages.yaml file with a vdep as a key. We use
# syaml.load here to make sure source lines in the config are # syaml.load here to make sure source lines in the config are
# attached to parsed strings, as the error message uses them. # attached to parsed strings, as the error message uses them.
conf = syaml.load("""mpi: conf = syaml.load("""\
mpi:
paths: paths:
mpi-with-lapack@2.1: /path/to/lapack mpi-with-lapack@2.1: /path/to/lapack
""") """)
@ -135,7 +139,8 @@ def test_no_virtuals_in_packages_yaml(self):
def test_all_is_not_a_virtual(self): def test_all_is_not_a_virtual(self):
"""Verify that `all` is allowed in packages.yaml.""" """Verify that `all` is allowed in packages.yaml."""
conf = syaml.load("""all: conf = syaml.load("""\
all:
variants: [+mpi] variants: [+mpi]
""") """)
spack.config.update_config('packages', conf, 'concretize') spack.config.update_config('packages', conf, 'concretize')
@ -143,3 +148,26 @@ def test_all_is_not_a_virtual(self):
# should be no error for 'all': # should be no error for 'all':
spack.package_prefs._pkgsort = PreferredPackages() spack.package_prefs._pkgsort = PreferredPackages()
spack.package_prefs.get_packages_config() spack.package_prefs.get_packages_config()
def test_external_mpi(self):
# make sure this doesn't give us an external first.
spec = Spec('mpi')
spec.concretize()
assert not spec['mpi'].external
# load config
conf = syaml.load("""\
all:
providers:
mpi: [mpich]
mpich:
buildable: false
paths:
mpich@3.0.4: /dummy/path
""")
spack.config.update_config('packages', conf, 'concretize')
# ensure that once config is in place, external is used
spec = Spec('mpi')
spec.concretize()
assert spec['mpich'].external == '/dummy/path'

View File

@ -23,6 +23,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
############################################################################## ##############################################################################
import pytest import pytest
import shlex
import spack.spec as sp import spack.spec as sp
from spack.parse import Token from spack.parse import Token
@ -53,6 +54,34 @@
Token(sp.AT), Token(sp.AT),
Token(sp.ID, '8.1_1e')] Token(sp.ID, '8.1_1e')]
# Another sample lexer output with a kv pair.
kv_lex = [Token(sp.ID, 'mvapich_foo'),
Token(sp.ID, 'debug'),
Token(sp.EQ),
Token(sp.VAL, '4'),
Token(sp.DEP),
Token(sp.ID, '_openmpi'),
Token(sp.AT),
Token(sp.ID, '1.2'),
Token(sp.COLON),
Token(sp.ID, '1.4'),
Token(sp.COMMA),
Token(sp.ID, '1.6'),
Token(sp.PCT),
Token(sp.ID, 'intel'),
Token(sp.AT),
Token(sp.ID, '12.1'),
Token(sp.COLON),
Token(sp.ID, '12.6'),
Token(sp.ON),
Token(sp.ID, 'debug'),
Token(sp.OFF),
Token(sp.ID, 'qt_4'),
Token(sp.DEP),
Token(sp.ID, 'stackwalker'),
Token(sp.AT),
Token(sp.ID, '8.1_1e')]
class TestSpecSyntax(object): class TestSpecSyntax(object):
# ======================================================================== # ========================================================================
@ -81,9 +110,10 @@ def check_parse(self, expected, spec=None, remove_arch=True):
def check_lex(self, tokens, spec): def check_lex(self, tokens, spec):
"""Check that the provided spec parses to the provided token list.""" """Check that the provided spec parses to the provided token list."""
spec = shlex.split(spec)
lex_output = sp.SpecLexer().lex(spec) lex_output = sp.SpecLexer().lex(spec)
for tok, spec_tok in zip(tokens, lex_output): for tok, spec_tok in zip(tokens, lex_output):
if tok.type == sp.ID: if tok.type == sp.ID or tok.type == sp.VAL:
assert tok == spec_tok assert tok == spec_tok
else: else:
# Only check the type for non-identifiers. # Only check the type for non-identifiers.
@ -112,10 +142,19 @@ def test_dependencies_with_versions(self):
self.check_parse("openmpi^hwloc@:1.4b7-rc3") self.check_parse("openmpi^hwloc@:1.4b7-rc3")
self.check_parse("openmpi^hwloc@1.2e6:1.4b7-rc3") self.check_parse("openmpi^hwloc@1.2e6:1.4b7-rc3")
@pytest.mark.xfail
def test_multiple_specs(self): def test_multiple_specs(self):
self.check_parse("mvapich emacs") self.check_parse("mvapich emacs")
def test_multiple_specs_after_kv(self):
self.check_parse('mvapich cppflags="-O3 -fPIC" emacs')
self.check_parse('mvapich cflags="-O3" emacs',
'mvapich cflags=-O3 emacs')
def test_multiple_specs_long_second(self):
self.check_parse('mvapich emacs@1.1.1%intel cflags="-O3"',
'mvapich emacs @1.1.1 %intel cflags=-O3')
self.check_parse('mvapich cflags="-O3 -fPIC" emacs^ncurses%intel')
def test_full_specs(self): def test_full_specs(self):
self.check_parse( self.check_parse(
"mvapich_foo" "mvapich_foo"
@ -123,15 +162,15 @@ def test_full_specs(self):
"^stackwalker@8.1_1e") "^stackwalker@8.1_1e")
self.check_parse( self.check_parse(
"mvapich_foo" "mvapich_foo"
"^_openmpi@1.2:1.4,1.6%intel@12.1 debug=2~qt_4" "^_openmpi@1.2:1.4,1.6%intel@12.1 debug=2 ~qt_4"
"^stackwalker@8.1_1e") "^stackwalker@8.1_1e")
self.check_parse( self.check_parse(
'mvapich_foo' 'mvapich_foo'
'^_openmpi@1.2:1.4,1.6%intel@12.1 cppflags="-O3"+debug~qt_4' '^_openmpi@1.2:1.4,1.6%intel@12.1 cppflags="-O3" +debug~qt_4'
'^stackwalker@8.1_1e') '^stackwalker@8.1_1e')
self.check_parse( self.check_parse(
"mvapich_foo" "mvapich_foo"
"^_openmpi@1.2:1.4,1.6%intel@12.1 debug=2~qt_4" "^_openmpi@1.2:1.4,1.6%intel@12.1 debug=2 ~qt_4"
"^stackwalker@8.1_1e arch=test-redhat6-x86_32") "^stackwalker@8.1_1e arch=test-redhat6-x86_32")
def test_canonicalize(self): def test_canonicalize(self):
@ -158,19 +197,19 @@ def test_canonicalize(self):
"x ^y~f+e~d+c~b+a@4,2:3,1%intel@4,3,2,1") "x ^y~f+e~d+c~b+a@4,2:3,1%intel@4,3,2,1")
self.check_parse( self.check_parse(
"x arch=test-redhat6-None" "x arch=test-redhat6-None "
"^y arch=test-None-x86_64" "^y arch=test-None-x86_64 "
"^z arch=linux-None-None", "^z arch=linux-None-None",
"x os=fe" "x os=fe "
"^y target=be" "^y target=be "
"^z platform=linux") "^z platform=linux")
self.check_parse( self.check_parse(
"x arch=test-debian6-x86_64" "x arch=test-debian6-x86_64 "
"^y arch=test-debian6-x86_64", "^y arch=test-debian6-x86_64",
"x os=default_os target=default_target" "x os=default_os target=default_target "
"^y os=default_os target=default_target") "^y os=default_os target=default_target")
self.check_parse("x^y", "x@: ^y@:") self.check_parse("x^y", "x@: ^y@:")
@ -184,7 +223,7 @@ def test_duplicate_variant(self):
'x@1.2+debug+debug', 'x@1.2+debug+debug',
'x ^y@1.2+debug debug=true', 'x ^y@1.2+debug debug=true',
'x ^y@1.2 debug=false debug=true', 'x ^y@1.2 debug=false debug=true',
'x ^y@1.2 debug=false~debug' 'x ^y@1.2 debug=false ~debug'
] ]
self._check_raises(DuplicateVariantError, duplicates) self._check_raises(DuplicateVariantError, duplicates)
@ -277,3 +316,49 @@ def test_way_too_many_spaces(self):
"mvapich_foo " "mvapich_foo "
"^ _openmpi @1.2 : 1.4 , 1.6 % intel @ 12.1 : 12.6 + debug - qt_4 " "^ _openmpi @1.2 : 1.4 , 1.6 % intel @ 12.1 : 12.6 + debug - qt_4 "
"^ stackwalker @ 8.1_1e") "^ stackwalker @ 8.1_1e")
self.check_lex(
complex_lex,
"mvapich_foo "
"^ _openmpi @1.2 : 1.4 , 1.6 % intel @ 12.1 : 12.6 + debug ~ qt_4 "
"^ stackwalker @ 8.1_1e")
def test_kv_with_quotes(self):
self.check_lex(
kv_lex,
"mvapich_foo debug='4' "
"^ _openmpi @1.2 : 1.4 , 1.6 % intel @ 12.1 : 12.6 + debug - qt_4 "
"^ stackwalker @ 8.1_1e")
self.check_lex(
kv_lex,
'mvapich_foo debug="4" '
"^ _openmpi @1.2 : 1.4 , 1.6 % intel @ 12.1 : 12.6 + debug - qt_4 "
"^ stackwalker @ 8.1_1e")
self.check_lex(
kv_lex,
"mvapich_foo 'debug = 4' "
"^ _openmpi @1.2 : 1.4 , 1.6 % intel @ 12.1 : 12.6 + debug - qt_4 "
"^ stackwalker @ 8.1_1e")
def test_kv_without_quotes(self):
self.check_lex(
kv_lex,
"mvapich_foo debug=4 "
"^ _openmpi @1.2 : 1.4 , 1.6 % intel @ 12.1 : 12.6 + debug - qt_4 "
"^ stackwalker @ 8.1_1e")
def test_kv_with_spaces(self):
self.check_lex(
kv_lex,
"mvapich_foo debug = 4 "
"^ _openmpi @1.2 : 1.4 , 1.6 % intel @ 12.1 : 12.6 + debug - qt_4 "
"^ stackwalker @ 8.1_1e")
self.check_lex(
kv_lex,
"mvapich_foo debug =4 "
"^ _openmpi @1.2 : 1.4 , 1.6 % intel @ 12.1 : 12.6 + debug - qt_4 "
"^ stackwalker @ 8.1_1e")
self.check_lex(
kv_lex,
"mvapich_foo debug= 4 "
"^ _openmpi @1.2 : 1.4 , 1.6 % intel @ 12.1 : 12.6 + debug - qt_4 "
"^ stackwalker @ 8.1_1e")

View File

@ -32,15 +32,13 @@ def check(condition, msg):
raise InstallError(msg) raise InstallError(msg)
class CmakeClient(Package): class CmakeClient(CMakePackage):
"""A dumy package that uses cmake.""" """A dumy package that uses cmake."""
homepage = 'https://www.example.com' homepage = 'https://www.example.com'
url = 'https://www.example.com/cmake-client-1.0.tar.gz' url = 'https://www.example.com/cmake-client-1.0.tar.gz'
version('1.0', '4cb3ff35b2472aae70f542116d616e63') version('1.0', '4cb3ff35b2472aae70f542116d616e63')
depends_on('cmake', type='build')
def setup_environment(self, spack_env, run_env): def setup_environment(self, spack_env, run_env):
spack_cc # Ensure spack module-scope variable is avaiabl spack_cc # Ensure spack module-scope variable is avaiabl
check(from_cmake == "from_cmake", check(from_cmake == "from_cmake",
@ -68,6 +66,11 @@ def setup_dependent_package(self, module, dspec):
"link arg on dependency spec not readable from " "link arg on dependency spec not readable from "
"setup_dependent_package.") "setup_dependent_package.")
def cmake(self, spec, prefix):
pass
build = cmake
def install(self, spec, prefix): def install(self, spec, prefix):
# check that cmake is in the global scope. # check that cmake is in the global scope.
global cmake global cmake

View File

@ -0,0 +1,41 @@
##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/llnl/spack
# Please also see the LICENSE file for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
# published by the Free Software Foundation) version 2.1, February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
class Astra(Package):
"""A Space Charge Tracking Algorithm."""
homepage = "http://www.desy.de/~mpyflo/"
version('2016-11-30', '17135b7a4adbacc1843a50a6a2ae2c25', expand=False,
url='http://www.desy.de/~mpyflo/Astra_for_64_Bit_Linux/Astra')
def install(self, spec, prefix):
mkdir(prefix.bin)
install('Astra', prefix.bin)
chmod = which('chmod')
chmod('+x', join_path(prefix.bin, 'Astra'))

View File

@ -0,0 +1,51 @@
--- a/boost/thread/pthread/once.hpp
+++ b/boost/thread/pthread/once.hpp
@@ -42,7 +42,7 @@ namespace boost
}
#ifdef BOOST_THREAD_PROVIDES_ONCE_CXX11
-#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES
+#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template<typename Function, class ...ArgTypes>
inline void call_once(once_flag& flag, BOOST_THREAD_RV_REF(Function) f, BOOST_THREAD_RV_REF(ArgTypes)... args);
#else
@@ -65,7 +65,7 @@ namespace boost
private:
volatile thread_detail::uintmax_atomic_t epoch;
-#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES
+#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template<typename Function, class ...ArgTypes>
friend void call_once(once_flag& flag, BOOST_THREAD_RV_REF(Function) f, BOOST_THREAD_RV_REF(ArgTypes)... args);
#else
@@ -118,7 +118,7 @@ namespace boost
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2444.html
-#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES
+#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template<typename Function, class ...ArgTypes>
--- a/boost/thread/pthread/once_atomic.hpp
+++ b/boost/thread/pthread/once_atomic.hpp
@@ -115,7 +115,7 @@ namespace boost
#endif
-#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES
+#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template<typename Function, class ...ArgTypes>
inline void call_once(once_flag& flag, BOOST_THREAD_RV_REF(Function) f, BOOST_THREAD_RV_REF(ArgTypes)... args)
--- a/boost/thread/win32/once.hpp
+++ b/boost/thread/win32/once.hpp
@@ -227,7 +227,7 @@ namespace boost
}
}
-#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES
+#if !defined BOOST_NO_CXX11_VARIADIC_TEMPLATES && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
//#if defined(BOOST_THREAD_RVALUE_REFERENCES_DONT_MATCH_FUNTION_PTR)
inline void call_once(once_flag& flag, void (*f)())
{

View File

@ -130,6 +130,9 @@ class Boost(Package):
# Patch fix from https://svn.boost.org/trac/boost/ticket/11856 # Patch fix from https://svn.boost.org/trac/boost/ticket/11856
patch('boost_11856.patch', when='@1.60.0%gcc@4.4.7') patch('boost_11856.patch', when='@1.60.0%gcc@4.4.7')
# Patch fix from https://svn.boost.org/trac/boost/ticket/10125
patch('boost_10125.patch', when='@1.55.0%gcc@5.0:5.9')
def url_for_version(self, version): def url_for_version(self, version):
""" """
Handle Boost's weird URLs, Handle Boost's weird URLs,
@ -251,6 +254,13 @@ def determine_b2_options(self, spec, options):
'toolset=%s' % self.determine_toolset(spec) 'toolset=%s' % self.determine_toolset(spec)
]) ])
# clang is not officially supported for pre-compiled headers
# and at least in clang 3.9 still fails to build
# http://www.boost.org/build/doc/html/bbv2/reference/precompiled_headers.html
# https://svn.boost.org/trac/boost/ticket/12496
if spec.satisfies('%clang'):
options.extend(['pch=off'])
return threadingOpts return threadingOpts
def add_buildopt_symlinks(self, prefix): def add_buildopt_symlinks(self, prefix):

View File

@ -25,26 +25,28 @@
from spack import * from spack import *
class Boxlib(Package): class Boxlib(CMakePackage):
"""BoxLib, a software framework for massively parallel """BoxLib, a software framework for massively parallel
block-structured adaptive mesh refinement (AMR) codes.""" block-structured adaptive mesh refinement (AMR) codes."""
homepage = "https://ccse.lbl.gov/BoxLib/" homepage = "https://ccse.lbl.gov/BoxLib/"
url = "https://ccse.lbl.gov/pub/Downloads/BoxLib.git" url = "https://github.com/BoxLib-Codes/BoxLib/archive/16.12.2.tar.gz"
# TODO: figure out how best to version this. No tags in the repo! version('16.12.2', 'a28d92a5ff3fbbdbbd0a776a59f18526')
version('master', git='https://ccse.lbl.gov/pub/Downloads/BoxLib.git')
depends_on('mpi') depends_on('mpi')
depends_on('cmake', type='build')
def install(self, spec, prefix): def cmake_args(self):
args = std_cmake_args spec = self.spec
args += ['-DCCSE_ENABLE_MPI=1', options = []
'-DCMAKE_C_COMPILER=%s' % which('mpicc'),
'-DCMAKE_CXX_COMPILER=%s' % which('mpicxx'),
'-DCMAKE_Fortran_COMPILER=%s' % which('mpif90')]
cmake('.', *args) options.extend([
make() # '-DBL_SPACEDIM=3',
make("install") '-DENABLE_POSITION_INDEPENDENT_CODE=ON',
'-DENABLE_FBASELIB=ON',
'-DCMAKE_C_COMPILER=%s' % spec['mpi'].mpicc,
'-DCMAKE_CXX_COMPILER=%s' % spec['mpi'].mpicxx,
'-DCMAKE_Fortran_COMPILER=%s' % spec['mpi'].mpifc
])
return options

View File

@ -28,8 +28,10 @@
class Cmake(Package): class Cmake(Package):
"""A cross-platform, open-source build system. CMake is a family of """A cross-platform, open-source build system. CMake is a family of
tools designed to build, test and package software.""" tools designed to build, test and package software."""
homepage = 'https://www.cmake.org' homepage = 'https://www.cmake.org'
url = 'https://cmake.org/files/v3.4/cmake-3.4.3.tar.gz' url = 'https://cmake.org/files/v3.4/cmake-3.4.3.tar.gz'
list_url = 'https://cmake.org/files/'
list_depth = 2
version('3.7.1', 'd031d5a06e9f1c5367cdfc56fbd2a1c8') version('3.7.1', 'd031d5a06e9f1c5367cdfc56fbd2a1c8')
version('3.6.1', 'd6dd661380adacdb12f41b926ec99545') version('3.6.1', 'd6dd661380adacdb12f41b926ec99545')

View File

@ -0,0 +1,48 @@
##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/llnl/spack
# Please also see the LICENSE file for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
# published by the Free Software Foundation) version 2.1, February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
class Cppad(CMakePackage):
"""A Package for Differentiation of C++ Algorithms."""
homepage = "https://www.coin-or.org/CppAD/"
version('20170114', '565a534dc813fa1289764222cd8c11ea')
version('develop', git='https://github.com/coin-or/CppAD.git')
depends_on('cmake', type='build')
def url_for_version(self, version):
"""Handle version-based custom URLs."""
return "http://www.coin-or.org/download/source/CppAD/cppad-%s.gpl.tgz" % (version)
def cmake_args(self):
# This package does not obey CMAKE_INSTALL_PREFIX
args = [
"-Dcppad_prefix=%s" % (self.prefix),
"-Dcmake_install_docdir=share/cppad/doc"
]
return args

View File

@ -50,6 +50,8 @@ class Cuda(Package):
homepage = "http://www.nvidia.com/object/cuda_home_new.html" homepage = "http://www.nvidia.com/object/cuda_home_new.html"
version('8.0.44', '6dca912f9b7e2b7569b0074a41713640', expand=False,
url="file://%s/cuda_8.0.44_linux.run" % os.getcwd())
version('7.5.18', '4b3bcecf0dfc35928a0898793cf3e4c6', expand=False, version('7.5.18', '4b3bcecf0dfc35928a0898793cf3e4c6', expand=False,
url="file://%s/cuda_7.5.18_linux.run" % os.getcwd()) url="file://%s/cuda_7.5.18_linux.run" % os.getcwd())
version('6.5.14', '90b1b8f77313600cc294d9271741f4da', expand=False, version('6.5.14', '90b1b8f77313600cc294d9271741f4da', expand=False,

View File

@ -66,7 +66,7 @@ class Dealii(CMakePackage):
description='Compile with Trilinos (only with MPI)') description='Compile with Trilinos (only with MPI)')
variant('python', default=True, variant('python', default=True,
description='Compile with Python bindings') description='Compile with Python bindings')
variant('64bit', default=False, variant('int64', default=False,
description='Compile with 64 bit indices support') description='Compile with 64 bit indices support')
# required dependencies, light version # required dependencies, light version
@ -108,11 +108,11 @@ class Dealii(CMakePackage):
depends_on("netcdf-cxx", when='+netcdf+mpi') depends_on("netcdf-cxx", when='+netcdf+mpi')
depends_on("oce", when='+oce') depends_on("oce", when='+oce')
depends_on("p4est", when='+p4est+mpi') depends_on("p4est", when='+p4est+mpi')
depends_on("petsc+mpi", when='@8.4.2:+petsc+mpi~64bit') depends_on("petsc+mpi", when='@8.4.2:+petsc+mpi~int64')
depends_on('python', when='@8.5.0:+python') depends_on('python', when='@8.5.0:+python')
depends_on("slepc", when='@8.4.2:+slepc+petsc+mpi~64bit') depends_on("slepc", when='@8.4.2:+slepc+petsc+mpi~int64')
depends_on("petsc@:3.6.4+mpi", when='@:8.4.1+petsc+mpi~64bit') depends_on("petsc@:3.6.4+mpi", when='@:8.4.1+petsc+mpi~int64')
depends_on("slepc@:3.6.3", when='@:8.4.1+slepc+petsc+mpi~64bit') depends_on("slepc@:3.6.3", when='@:8.4.1+slepc+petsc+mpi~int64')
depends_on("trilinos", when='+trilinos+mpi') depends_on("trilinos", when='+trilinos+mpi')
def build_type(self): def build_type(self):
@ -244,7 +244,7 @@ def cmake_args(self):
# 64 bit indices # 64 bit indices
options.extend([ options.extend([
'-DDEAL_II_WITH_64BIT_INDICES=%s' % ('+64bit' in spec) '-DDEAL_II_WITH_64BIT_INDICES=%s' % ('+int64' in spec)
]) ])
return options return options

View File

@ -36,7 +36,7 @@ class Espressopp(CMakePackage):
url = "https://github.com/espressopp/espressopp/tarball/v1.9.4.1" url = "https://github.com/espressopp/espressopp/tarball/v1.9.4.1"
version('develop', git='https://github.com/espressopp/espressopp.git', branch='master') version('develop', git='https://github.com/espressopp/espressopp.git', branch='master')
version('1.9.4.1', '0da74a6d4e1bfa6a2a24fca354245a4f') version('1.9.4.1', '0da74a6d4e1bfa6a2a24fca354245a4f')
version('1.9.4', 'f2a27993a83547ad014335006eea74ea') version('1.9.4', 'f2a27993a83547ad014335006eea74ea')
variant('debug', default=False, description='Build debug version') variant('debug', default=False, description='Build debug version')
@ -54,20 +54,23 @@ class Espressopp(CMakePackage):
depends_on("fftw") depends_on("fftw")
depends_on("py-sphinx", when="+ug", type='build') depends_on("py-sphinx", when="+ug", type='build')
depends_on("py-sphinx", when="+pdf", type='build') depends_on("py-sphinx", when="+pdf", type='build')
depends_on('py-numpy', when="+ug", type='build')
depends_on('py-numpy', when="+pdf", type='build')
depends_on('py-matplotlib', when="+ug", type='build')
depends_on('py-matplotlib', when="+pdf", type='build')
depends_on("texlive", when="+pdf", type='build') depends_on("texlive", when="+pdf", type='build')
depends_on("doxygen", when="+dg", type='build') depends_on("doxygen", when="+dg", type='build')
def cmake_args(self): def build_type(self):
spec = self.spec spec = self.spec
options = []
options.extend(['-DEXTERNAL_MPI4PY=ON', '-DEXTERNAL_BOOST=ON'])
if '+debug' in spec: if '+debug' in spec:
options.extend(['-DCMAKE_BUILD_TYPE:STRING=Debug']) return 'Debug'
else: else:
options.extend(['-DCMAKE_BUILD_TYPE:STRING=Release']) return 'Release'
return options def cmake_args(self):
return ['-DEXTERNAL_MPI4PY=ON', '-DEXTERNAL_BOOST=ON']
def build(self, spec, prefix): def build(self, spec, prefix):
with working_dir(self.build_directory()): with working_dir(self.build_directory()):
make() make()

View File

@ -33,7 +33,6 @@ class EverytraceExample(CMakePackage):
git='https://github.com/citibeth/everytrace-example.git', git='https://github.com/citibeth/everytrace-example.git',
branch='develop') branch='develop')
depends_on('cmake', type='build')
depends_on('everytrace+mpi+fortran') depends_on('everytrace+mpi+fortran')
# Currently the only MPI this everytrace works with. # Currently the only MPI this everytrace works with.

View File

@ -39,7 +39,6 @@ class Everytrace(CMakePackage):
variant('fortran', default=True, variant('fortran', default=True,
description='Enable use with Fortran programs') description='Enable use with Fortran programs')
depends_on('cmake', type='build')
depends_on('mpi', when='+mpi') depends_on('mpi', when='+mpi')
def cmake_args(self): def cmake_args(self):

View File

@ -46,6 +46,8 @@ class Hypre(Package):
# SuperluDist have conflicting headers with those in Hypre # SuperluDist have conflicting headers with those in Hypre
variant('internal-superlu', default=True, variant('internal-superlu', default=True,
description="Use internal Superlu routines") description="Use internal Superlu routines")
variant('int64', default=False,
description="Use 64bit integers")
depends_on("mpi") depends_on("mpi")
depends_on("blas") depends_on("blas")
@ -68,6 +70,9 @@ def install(self, spec, prefix):
'--with-blas-lib-dirs=%s' % ' '.join(blas.directories) '--with-blas-lib-dirs=%s' % ' '.join(blas.directories)
] ]
if '+int64' in self.spec:
configure_args.append('--enable-bigint')
if '+shared' in self.spec: if '+shared' in self.spec:
configure_args.append("--enable-shared") configure_args.append("--enable-shared")

View File

@ -64,7 +64,6 @@ class Ibmisc(CMakePackage):
depends_on('boost', when='+boost') depends_on('boost', when='+boost')
# Build dependencies # Build dependencies
depends_on('cmake', type='build')
depends_on('doxygen', type='build') depends_on('doxygen', type='build')
def cmake_args(self): def cmake_args(self):

View File

@ -36,7 +36,6 @@ class Icet(CMakePackage):
git='https://gitlab.kitware.com/icet/icet.git') git='https://gitlab.kitware.com/icet/icet.git')
version('2.1.1', '4f971c51105a64937460d482adca2a6c') version('2.1.1', '4f971c51105a64937460d482adca2a6c')
depends_on('cmake', type='build')
depends_on('mpi') depends_on('mpi')
def url_for_version(self, version): def url_for_version(self, version):

View File

@ -31,6 +31,7 @@ class Isl(Package):
homepage = "http://isl.gforge.inria.fr" homepage = "http://isl.gforge.inria.fr"
url = "http://isl.gforge.inria.fr/isl-0.14.tar.bz2" url = "http://isl.gforge.inria.fr/isl-0.14.tar.bz2"
version('0.18', '11436d6b205e516635b666090b94ab32')
version('0.14', 'acd347243fca5609e3df37dba47fd0bb') version('0.14', 'acd347243fca5609e3df37dba47fd0bb')
depends_on("gmp") depends_on("gmp")

View File

@ -33,5 +33,3 @@ class Jansson(CMakePackage):
url = "https://github.com/akheron/jansson/archive/v2.9.tar.gz" url = "https://github.com/akheron/jansson/archive/v2.9.tar.gz"
version('2.9', 'd2db25c437b359fc5a065ed938962237') version('2.9', 'd2db25c437b359fc5a065ed938962237')
depends_on('cmake', type='build')

View File

@ -30,5 +30,3 @@ class Libspatialindex(CMakePackage):
url = "https://github.com/libspatialindex/libspatialindex/tarball/1.8.5" url = "https://github.com/libspatialindex/libspatialindex/tarball/1.8.5"
version('1.8.5', 'a95d8159714dbda9a274792cd273d298') version('1.8.5', 'a95d8159714dbda9a274792cd273d298')
depends_on("cmake", type='build')

View File

@ -35,6 +35,5 @@ class Libwebsockets(CMakePackage):
version('2.0.3', 'a025156d606d90579e65d53ccd062a94') version('2.0.3', 'a025156d606d90579e65d53ccd062a94')
version('1.7.9', '7b3692ead5ae00fd0e1d56c080170f07') version('1.7.9', '7b3692ead5ae00fd0e1d56c080170f07')
depends_on('cmake', type='build')
depends_on('zlib') depends_on('zlib')
depends_on('openssl') depends_on('openssl')

View File

@ -23,7 +23,6 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
############################################################################## ##############################################################################
from spack import * from spack import *
import sys
class M4(AutotoolsPackage): class M4(AutotoolsPackage):
@ -52,8 +51,9 @@ def configure_args(self):
args.append('--without-libsigsegv-prefix') args.append('--without-libsigsegv-prefix')
# http://lists.gnu.org/archive/html/bug-m4/2016-09/msg00002.html # http://lists.gnu.org/archive/html/bug-m4/2016-09/msg00002.html
if (sys.platform == 'darwin') and (spec.satisfies('%gcc')) and \ arch = spec.architecture
(spec.architecture.platform_os.version == '10.12'): if (arch.platform == 'darwin' and arch.platform_os == 'sierra' and
'%gcc' in spec):
args.append('ac_cv_type_struct_sched_param=yes') args.append('ac_cv_type_struct_sched_param=yes')
return args return args

View File

@ -47,7 +47,7 @@ class Metis(Package):
variant('debug', default=False, description='Builds the library in debug mode.') variant('debug', default=False, description='Builds the library in debug mode.')
variant('gdb', default=False, description='Enables gdb support.') variant('gdb', default=False, description='Enables gdb support.')
variant('idx64', default=False, description='Sets the bit width of METIS\'s index type to 64.') variant('int64', default=False, description='Sets the bit width of METIS\'s index type to 64.')
variant('real64', default=False, description='Sets the bit width of METIS\'s real type to 64.') variant('real64', default=False, description='Sets the bit width of METIS\'s real type to 64.')
depends_on('cmake@2.8:', when='@5:', type='build') depends_on('cmake@2.8:', when='@5:', type='build')
@ -69,7 +69,7 @@ def patch(self):
metis_header.filter( metis_header.filter(
r'(\b)(IDXTYPEWIDTH )(\d+)(\b)', r'(\b)(IDXTYPEWIDTH )(\d+)(\b)',
r'\1\2{0}\4'.format('64' if '+idx64' in self.spec else '32'), r'\1\2{0}\4'.format('64' if '+int64' in self.spec else '32'),
) )
metis_header.filter( metis_header.filter(
r'(\b)(REALTYPEWIDTH )(\d+)(\b)', r'(\b)(REALTYPEWIDTH )(\d+)(\b)',
@ -87,9 +87,9 @@ def patch(self):
@when('@:4') @when('@:4')
def install(self, spec, prefix): def install(self, spec, prefix):
# Process library spec and options # Process library spec and options
if any('+{0}'.format(v) in spec for v in ['gdb', 'idx64', 'real64']): if any('+{0}'.format(v) in spec for v in ['gdb', 'int64', 'real64']):
raise InstallError('METIS@:4 does not support the following ' raise InstallError('METIS@:4 does not support the following '
'variants: gdb, idx64, real64.') 'variants: gdb, int64, real64.')
options = ['COPTIONS=-fPIC'] options = ['COPTIONS=-fPIC']
if '+debug' in spec: if '+debug' in spec:

View File

@ -55,7 +55,7 @@ class Mumps(Package):
description='Activate the compilation of smumps') description='Activate the compilation of smumps')
variant('complex', default=True, variant('complex', default=True,
description='Activate the compilation of cmumps and/or zmumps') description='Activate the compilation of cmumps and/or zmumps')
variant('idx64', default=False, variant('int64', default=False,
description='Use int64_t/integer*8 as default index type') description='Use int64_t/integer*8 as default index type')
variant('shared', default=True, description='Build shared libraries') variant('shared', default=True, description='Build shared libraries')
@ -125,7 +125,7 @@ def write_makefile_inc(self):
fpic = '-fPIC' if '+shared' in self.spec else '' fpic = '-fPIC' if '+shared' in self.spec else ''
# TODO: test this part, it needs a full blas, scalapack and # TODO: test this part, it needs a full blas, scalapack and
# partitionning environment with 64bit integers # partitionning environment with 64bit integers
if '+idx64' in self.spec: if '+int64' in self.spec:
makefile_conf.extend( makefile_conf.extend(
# the fortran compilation flags most probably are # the fortran compilation flags most probably are
# working only for intel and gnu compilers this is # working only for intel and gnu compilers this is

View File

@ -30,22 +30,47 @@ class Octopus(Package):
theory code.""" theory code."""
homepage = "http://www.tddft.org/programs/octopus/" homepage = "http://www.tddft.org/programs/octopus/"
url = "http://www.tddft.org/programs/octopus/down.php?file=5.0.1/octopus-5.0.1.tar.gz" base_url = "http://www.tddft.org/programs/octopus/down.php?file="
version('6.0', '5d1168c2a8d7fd9cb9492eaebaa7182e')
version('5.0.1', '2b6392ab67b843f9d4ca7413fc07e822') version('5.0.1', '2b6392ab67b843f9d4ca7413fc07e822')
# Sample url is:
# "http://www.tddft.org/programs/octopus/down.php?file=5.0.1/octopus-5.0.1.tar.gz"
def url_for_version(self, version):
return '{0}/{1}/octopus-{1}.tar.gz'.format(Octopus.base_url,
version.dotted)
variant('scalapack', default=False,
description='Compile with Scalapack')
variant('metis', default=True,
description='Compile with METIS')
variant('parmetis', default=False,
description='Compile with ParMETIS')
variant('netcdf', default=False,
description='Compile with Netcdf')
variant('arpack-ng', default=False,
description='Compile with ARPACK-ng')
depends_on('blas') depends_on('blas')
depends_on('gsl') depends_on('gsl')
depends_on('lapack') depends_on('lapack')
depends_on('libxc') depends_on('libxc')
depends_on('mpi') depends_on('mpi')
depends_on('fftw+mpi') depends_on('fftw+mpi')
depends_on('metis@5:', when='+metis')
depends_on('parmetis', when='+parmetis')
depends_on('scalapack', when='+scalapack')
depends_on('netcdf-fortran', when='+netcdf')
depends_on('arpack-ng', when='+arpack-ng')
# optional dependencies: # optional dependencies:
# TODO: scalapack, metis, parmetis, netcdf, etsf-io, sparskit, arpack, # TODO: parmetis, etsf-io, sparskit,
# feast, libfm, pfft, isf, pnfft # feast, libfm, pfft, isf, pnfft
def install(self, spec, prefix): def install(self, spec, prefix):
arpack = find_libraries(['libarpack'], root=spec[
'arpack-ng'].prefix.lib, shared=True)
lapack = spec['lapack'].lapack_libs lapack = spec['lapack'].lapack_libs
blas = spec['blas'].blas_libs blas = spec['blas'].blas_libs
args = [] args = []
@ -58,17 +83,37 @@ def install(self, spec, prefix):
'CC=%s' % spec['mpi'].mpicc, 'CC=%s' % spec['mpi'].mpicc,
'FC=%s' % spec['mpi'].mpifc, 'FC=%s' % spec['mpi'].mpifc,
'--enable-mpi', '--enable-mpi',
'--with-fft-lib=-L%s -lfftw3' % spec['fftw'].prefix.lib '--with-fft-lib=-L%s -lfftw3' % spec['fftw'].prefix.lib,
# --with-blacs=${prefix}/lib/libscalapack.dylib ])
# --with-netcdf-prefix=netcdf-fortran if '+metis' in spec:
args.extend([
'--with-metis-prefix=%s' % spec['metis'].prefix,
])
if '+parmetis' in spec:
args.extend([
'--with-parmetis-prefix=%s' % spec['parmetis'].prefix,
])
if '+netcdf' in spec:
args.extend([
'--with-netcdf-prefix=%s' % spec['netcdf-fortran'].prefix,
'--with-netcdf-include=%s' %
spec['netcdf-fortran'].prefix.include,
])
if '+arpack-ng' in spec:
args.extend([
'--with-arpack={0}'.format(arpack.joined()),
])
if '+scalapack' in spec:
args.extend([
'--with-blacs=%s' % spec['scalapack'].scalapack_libs,
'--with-scalapack=%s' % spec['scalapack'].scalapack_libs,
])
# --with-etsf-io-prefix= # --with-etsf-io-prefix=
# --with-sparskit=${prefix}/lib/libskit.a # --with-sparskit=${prefix}/lib/libskit.a
# --with-pfft-prefix=${prefix} --with-mpifftw-prefix=${prefix} # --with-pfft-prefix=${prefix} --with-mpifftw-prefix=${prefix}
# --with-arpack=${prefix}/lib/libarpack.dylib
# --with-parpack=${prefix}/lib/libparpack.dylib # --with-parpack=${prefix}/lib/libparpack.dylib
# --with-metis-prefix=${prefix} --with-parmetis-prefix=${prefix} # --with-parmetis-prefix=${prefix}
# --with-berkeleygw-prefix=${prefix} # --with-berkeleygw-prefix=${prefix}
])
# When preprocessor expands macros (i.e. CFLAGS) defined as quoted # When preprocessor expands macros (i.e. CFLAGS) defined as quoted
# strings the result may be > 132 chars and is terminated. # strings the result may be > 132 chars and is terminated.

View File

@ -41,6 +41,7 @@ class Petsc(Package):
version('for-pflotran-0.1.0', git='https://bitbucket.org/petsc/petsc.git', version('for-pflotran-0.1.0', git='https://bitbucket.org/petsc/petsc.git',
commit='7943f4e1472fff9cf1fc630a1100136616e4970f') commit='7943f4e1472fff9cf1fc630a1100136616e4970f')
version('3.7.5', 'f00f6e6a3bac39052350dd47194b58a3')
version('3.7.4', 'aaf94fa54ef83022c14091f10866eedf') version('3.7.4', 'aaf94fa54ef83022c14091f10866eedf')
version('3.7.2', '50da49867ce7a49e7a0c1b37f4ec7b34') version('3.7.2', '50da49867ce7a49e7a0c1b37f4ec7b34')
version('3.6.4', '7632da2375a3df35b8891c9526dbdde7') version('3.6.4', '7632da2375a3df35b8891c9526dbdde7')
@ -66,14 +67,19 @@ class Petsc(Package):
variant('hypre', default=True, variant('hypre', default=True,
description='Activates support for Hypre (only parallel)') description='Activates support for Hypre (only parallel)')
variant('mumps', default=True, variant('mumps', default=True,
description='Activates support for MUMPS (only parallel)') description='Activates support for MUMPS (only parallel'
' and 32bit indices)')
variant('superlu-dist', default=True, variant('superlu-dist', default=True,
description='Activates support for SuperluDist (only parallel)') description='Activates support for SuperluDist (only parallel)')
variant('int64', default=False,
description='Compile with 64bit indices')
# Virtual dependencies # Virtual dependencies
# Git repository needs sowing to build Fortran interface # Git repository needs sowing to build Fortran interface
depends_on('sowing', when='@develop') depends_on('sowing', when='@develop')
# PETSc, hypre, superlu_dist when built with int64 use 32 bit integers
# with BLAS/LAPACK
depends_on('blas') depends_on('blas')
depends_on('lapack') depends_on('lapack')
depends_on('mpi', when='+mpi') depends_on('mpi', when='+mpi')
@ -83,7 +89,8 @@ class Petsc(Package):
# Other dependencies # Other dependencies
depends_on('boost', when='@:3.5+boost') depends_on('boost', when='@:3.5+boost')
depends_on('metis@5:', when='+metis') depends_on('metis@5:~int64', when='+metis~int64')
depends_on('metis@5:+int64', when='+metis+int64')
depends_on('hdf5+mpi', when='+hdf5+mpi') depends_on('hdf5+mpi', when='+hdf5+mpi')
depends_on('parmetis', when='+metis+mpi') depends_on('parmetis', when='+metis+mpi')
@ -91,12 +98,16 @@ class Petsc(Package):
# Also PETSc prefer to build it without internal superlu, likely due to # Also PETSc prefer to build it without internal superlu, likely due to
# conflict in headers see # conflict in headers see
# https://bitbucket.org/petsc/petsc/src/90564b43f6b05485163c147b464b5d6d28cde3ef/config/BuildSystem/config/packages/hypre.py # https://bitbucket.org/petsc/petsc/src/90564b43f6b05485163c147b464b5d6d28cde3ef/config/BuildSystem/config/packages/hypre.py
depends_on('hypre~internal-superlu', when='+hypre+mpi~complex') depends_on('hypre~internal-superlu~int64', when='+hypre+mpi~complex~int64')
depends_on('superlu-dist@:4.3', when='@3.4.4:3.6.4+superlu-dist+mpi') depends_on('hypre~internal-superlu+int64', when='+hypre+mpi~complex+int64')
depends_on('superlu-dist@5.0.0:', when='@3.7:+superlu-dist+mpi') depends_on('superlu-dist@:4.3~int64', when='@3.4.4:3.6.4+superlu-dist+mpi~int64')
depends_on('superlu-dist@5.0.0:', when='@for-pflotran-0.1.0+superlu-dist+mpi') depends_on('superlu-dist@:4.3+int64', when='@3.4.4:3.6.4+superlu-dist+mpi+int64')
depends_on('mumps+mpi', when='+mumps+mpi') depends_on('superlu-dist@5.0.0:~int64', when='@3.7:+superlu-dist+mpi~int64')
depends_on('scalapack', when='+mumps+mpi') depends_on('superlu-dist@5.0.0:+int64', when='@3.7:+superlu-dist+mpi+int64')
depends_on('superlu-dist@5.0.0:~int64', when='@for-pflotran-0.1.0+superlu-dist+mpi~int64')
depends_on('superlu-dist@5.0.0:+int64', when='@for-pflotran-0.1.0+superlu-dist+mpi+int64')
depends_on('mumps+mpi', when='+mumps+mpi~int64')
depends_on('scalapack', when='+mumps+mpi~int64')
def mpi_dependent_options(self): def mpi_dependent_options(self):
if '~mpi' in self.spec: if '~mpi' in self.spec:
@ -145,7 +156,8 @@ def install(self, spec, prefix):
'--with-scalar-type=%s' % ( '--with-scalar-type=%s' % (
'complex' if '+complex' in spec else 'real'), 'complex' if '+complex' in spec else 'real'),
'--with-shared-libraries=%s' % ('1' if '+shared' in spec else '0'), '--with-shared-libraries=%s' % ('1' if '+shared' in spec else '0'),
'--with-debugging=%s' % ('1' if '+debug' in spec else '0') '--with-debugging=%s' % ('1' if '+debug' in spec else '0'),
'--with-64-bit-indices=%s' % ('1' if '+int64' in spec else '0')
]) ])
# Make sure we use exactly the same Blas/Lapack libraries # Make sure we use exactly the same Blas/Lapack libraries
# across the DAG. To that end list them explicitly # across the DAG. To that end list them explicitly

View File

@ -39,10 +39,10 @@ class Pgi(Package):
set up a mirror, see http://spack.readthedocs.io/en/latest/mirrors.html""" set up a mirror, see http://spack.readthedocs.io/en/latest/mirrors.html"""
homepage = "http://www.pgroup.com/" homepage = "http://www.pgroup.com/"
url = "file://%s/pgi-16.3.tar.gz" % os.getcwd()
version('16.5', 'a40e8852071b5d600cb42f31631b3de1') version('16.5', 'a40e8852071b5d600cb42f31631b3de1')
version('16.3', '618cb7ddbc57d4e4ed1f21a0ab25f427') version('16.3', '618cb7ddbc57d4e4ed1f21a0ab25f427')
version('15.7', '84a689217b17cdaf78c39270c70bea5d')
variant('network', default=True, variant('network', default=True,
description="Perform a network install") description="Perform a network install")
@ -64,6 +64,10 @@ class Pgi(Package):
license_vars = ['PGROUPD_LICENSE_FILE', 'LM_LICENSE_FILE'] license_vars = ['PGROUPD_LICENSE_FILE', 'LM_LICENSE_FILE']
license_url = 'http://www.pgroup.com/doc/pgiinstall.pdf' license_url = 'http://www.pgroup.com/doc/pgiinstall.pdf'
def url_for_version(self, version):
return "file://{0}/pgilinux-20{1}-{2}-x86_64.tar.gz".format(
os.getcwd(), version.up_to(1), version.joined)
def install(self, spec, prefix): def install(self, spec, prefix):
# Enable the silent installation feature # Enable the silent installation feature
os.environ['PGI_SILENT'] = "true" os.environ['PGI_SILENT'] = "true"

View File

@ -0,0 +1,58 @@
##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/llnl/spack
# Please also see the LICENSE file for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
# published by the Free Software Foundation) version 2.1, February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
class PyIpdb(Package):
"""ipdb is the iPython debugger and has many additional features, including
a better interactive debugging experience via colorized output."""
homepage = "https://pypi.python.org/pypi/ipdb"
url = "https://pypi.io/packages/source/i/ipdb/ipdb-0.10.1.tar.gz"
version('0.10.1', '4aeab65f633ddc98ebdb5eebf08dc713')
# :TODO:
# There might be potential to add variants here, but at the time of writing
# this the original packager does not know what they are. See the 3rd party
# section on ipdb's GitHub:
# https://github.com/gotcha/ipdb#third-party-support
extends('python')
depends_on('python@2.6:2.7,3.2:')
# Dependencies gathered from:
# https://github.com/gotcha/ipdb/blob/master/setup.py
# However additional dependencies added below were found via testing.
depends_on('py-setuptools', type='build')
# ipdb needs iPython and others available at runtime
depends_on('py-ipython@0.10.2:', type=('build', 'link'))
depends_on('py-traitlets', type=('build', 'link'))
depends_on('py-six', type=('build', 'link'))
depends_on('py-pexpect', type=('build', 'link'))
depends_on('py-prompt-toolkit', type=('build', 'link'))
def install(self, spec, prefix):
# Installation is uncomplicated, this should suffice.
setup_py('install', '--prefix={0}'.format(prefix))

View File

@ -0,0 +1,43 @@
##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/llnl/spack
# Please also see the LICENSE file for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
# published by the Free Software Foundation) version 2.1, February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
class PyPsutil(Package):
"""psutil is a cross-platform library for retrieving information on
running processes and system utilization (CPU, memory, disks, network)
in Python."""
homepage = "https://pypi.python.org/pypi/psutil"
url = "https://pypi.python.org/packages/d9/c8/8c7a2ab8ec108ba9ab9a4762c5a0d67c283d41b13b5ce46be81fdcae3656/psutil-5.0.1.tar.gz"
version('5.0.1', '153dc8be94badc4072016ceeac7808dc')
extends('python')
depends_on('python@2.6:')
depends_on('py-setuptools', type='build')
def install(self, spec, prefix):
setup_py('install', '--prefix=%s' % prefix)

View File

@ -0,0 +1,41 @@
##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/llnl/spack
# Please also see the LICENSE file for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
# published by the Free Software Foundation) version 2.1, February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
class PySphinxBootstrapTheme(Package):
"""Sphinx Bootstrap Theme."""
homepage = "https://pypi.python.org/pypi/sphinx-bootstrap-theme/"
url = "https://pypi.io/packages/source/s/sphinx-bootstrap-theme/sphinx-bootstrap-theme-0.4.13.tar.gz"
version('0.4.13', '32e513a9c8ffbb8c1e4b036e8f74fb51')
extends('python')
depends_on('py-setuptools', type='build')
def install(self, spec, prefix):
setup_py('install', '--prefix={0}'.format(prefix))

View File

@ -43,6 +43,9 @@ class SuperluDist(Package):
version('4.0', 'c0b98b611df227ae050bc1635c6940e0') version('4.0', 'c0b98b611df227ae050bc1635c6940e0')
version('3.3', 'f4805659157d93a962500902c219046b') version('3.3', 'f4805659157d93a962500902c219046b')
variant('int64', default=False,
description="Use 64bit integers")
depends_on('mpi') depends_on('mpi')
depends_on('blas') depends_on('blas')
depends_on('lapack') depends_on('lapack')
@ -66,8 +69,10 @@ def install(self, spec, prefix):
'ARCHFLAGS = cr', 'ARCHFLAGS = cr',
'RANLIB = true', 'RANLIB = true',
'CC = {0}'.format(self.spec['mpi'].mpicc), 'CC = {0}'.format(self.spec['mpi'].mpicc),
'CFLAGS = -fPIC -std=c99 -O2 -I%s -I%s' % ( 'CFLAGS = -fPIC -std=c99 -O2 -I%s -I%s %s' % (
spec['parmetis'].prefix.include, spec['metis'].prefix.include), spec['parmetis'].prefix.include,
spec['metis'].prefix.include,
'-D_LONGINT' if '+int64' in spec else ''),
'NOOPTS = -fPIC -std=c99', 'NOOPTS = -fPIC -std=c99',
'FORTRAN = {0}'.format(self.spec['mpi'].mpif77), 'FORTRAN = {0}'.format(self.spec['mpi'].mpif77),
'F90FLAGS = -O2', 'F90FLAGS = -O2',

View File

@ -25,7 +25,7 @@
from spack import * from spack import *
class Tcl(Package): class Tcl(AutotoolsPackage):
"""Tcl (Tool Command Language) is a very powerful but easy to """Tcl (Tool Command Language) is a very powerful but easy to
learn dynamic programming language, suitable for a very wide learn dynamic programming language, suitable for a very wide
range of uses, including web and desktop applications, range of uses, including web and desktop applications,
@ -52,10 +52,10 @@ def setup_environment(self, spack_env, env):
env.set('TCL_LIBRARY', join_path(self.prefix.lib, 'tcl{0}'.format( env.set('TCL_LIBRARY', join_path(self.prefix.lib, 'tcl{0}'.format(
self.spec.version.up_to(2)))) self.spec.version.up_to(2))))
def install(self, spec, prefix): def build_directory(self):
with working_dir('unix'): return 'unix'
configure("--prefix={0}".format(prefix))
make() @AutotoolsPackage.sanity_check('install')
make("install") def symlink_tclsh(self):
with working_dir(prefix.bin): with working_dir(self.prefix.bin):
symlink('tclsh{0}'.format(self.version.up_to(2)), 'tclsh') symlink('tclsh{0}'.format(self.version.up_to(2)), 'tclsh')

View File

@ -25,7 +25,7 @@
from spack import * from spack import *
class Tk(Package): class Tk(AutotoolsPackage):
"""Tk is a graphical user interface toolkit that takes developing """Tk is a graphical user interface toolkit that takes developing
desktop applications to a higher level than conventional desktop applications to a higher level than conventional
approaches. Tk is the standard GUI not only for Tcl, but for approaches. Tk is the standard GUI not only for Tcl, but for
@ -46,15 +46,15 @@ def url_for_version(self, version):
base_url = "http://prdownloads.sourceforge.net/tcl" base_url = "http://prdownloads.sourceforge.net/tcl"
return "{0}/tk{1}-src.tar.gz".format(base_url, version) return "{0}/tk{1}-src.tar.gz".format(base_url, version)
def setup_environment(self, spack_env, env): def setup_environment(self, spack_env, run_env):
# When using Tkinter from within spack provided python+tk, python # When using Tkinter from within spack provided python+tk, python
# will not be able to find Tcl/Tk unless TK_LIBRARY is set. # will not be able to find Tcl/Tk unless TK_LIBRARY is set.
env.set('TK_LIBRARY', join_path(self.prefix.lib, 'tk{0}'.format( run_env.set('TK_LIBRARY', join_path(self.prefix.lib, 'tk{0}'.format(
self.spec.version.up_to(2)))) self.spec.version.up_to(2))))
def install(self, spec, prefix): def build_directory(self):
with working_dir('unix'): return 'unix'
configure("--prefix={0}".format(prefix),
"--with-tcl={0}".format(spec['tcl'].prefix.lib)) def configure_args(self):
make() spec = self.spec
make("install") return ['--with-tcl={0}'.format(spec['tcl'].prefix.lib)]

View File

@ -90,8 +90,6 @@ def url_for_version(self, version):
description='Builds a debug version of the libraries') description='Builds a debug version of the libraries')
variant('boost', default=True, description='Compile with Boost') variant('boost', default=True, description='Compile with Boost')
depends_on('cmake', type='build')
# Everything should be compiled with -fpic # Everything should be compiled with -fpic
depends_on('blas') depends_on('blas')
depends_on('lapack') depends_on('lapack')

View File

@ -44,7 +44,6 @@ class Visit(Package):
def install(self, spec, prefix): def install(self, spec, prefix):
qt_bin = spec['qt'].prefix.bin qt_bin = spec['qt'].prefix.bin
python_bin = spec['python'].prefix.bin
with working_dir('spack-build', create=True): with working_dir('spack-build', create=True):
cmake_args = std_cmake_args[:] cmake_args = std_cmake_args[:]
@ -53,7 +52,7 @@ def install(self, spec, prefix):
'-DVTK_MINOR_VERSION=1', '-DVTK_MINOR_VERSION=1',
'-DVISIT_USE_GLEW=OFF', '-DVISIT_USE_GLEW=OFF',
'-DVISIT_LOC_QMAKE_EXE:FILEPATH={0}/qmake-qt4'.format(qt_bin), '-DVISIT_LOC_QMAKE_EXE:FILEPATH={0}/qmake-qt4'.format(qt_bin),
'-DPYTHON_EXECUTABLE:FILEPATH={0}/python'.format(python_bin), '-DPYTHON_DIR:PATH={0}'.format(spec['python'].prefix),
'-DVISIT_SILO_DIR:PATH={0}'.format(spec['silo'].prefix), '-DVISIT_SILO_DIR:PATH={0}'.format(spec['silo'].prefix),
'-DVISIT_HDF5_DIR:PATH={0}'.format(spec['hdf5'].prefix), '-DVISIT_HDF5_DIR:PATH={0}'.format(spec['hdf5'].prefix),
'-DVISIT_VTK_DIR:PATH={0}'.format(spec['vtk'].prefix), '-DVISIT_VTK_DIR:PATH={0}'.format(spec['vtk'].prefix),

View File

@ -28,7 +28,7 @@
class Xsdktrilinos(CMakePackage): class Xsdktrilinos(CMakePackage):
"""xSDKTrilinos contains the portions of Trilinos that depend on PETSc """xSDKTrilinos contains the portions of Trilinos that depend on PETSc
because they would cause a circular dependency if built as part of because they would cause a circular dependency if built as part of
Trilinos. Trilinos.
""" """
homepage = "https://trilinos.org/" homepage = "https://trilinos.org/"
@ -51,8 +51,6 @@ def url_for_version(self, version):
variant('debug', default=False, variant('debug', default=False,
description='Builds a debug version of the libraries') description='Builds a debug version of the libraries')
depends_on('cmake', type='build')
# MPI related dependencies # MPI related dependencies
depends_on('mpi') depends_on('mpi')
depends_on('hypre~internal-superlu', when='+hypre') depends_on('hypre~internal-superlu', when='+hypre')

View File

@ -23,7 +23,6 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
############################################################################## ##############################################################################
from spack import * from spack import *
from os import environ
class Zlib(AutotoolsPackage): class Zlib(AutotoolsPackage):
@ -35,17 +34,13 @@ class Zlib(AutotoolsPackage):
version('1.2.10', 'd9794246f853d15ce0fcbf79b9a3cf13') version('1.2.10', 'd9794246f853d15ce0fcbf79b9a3cf13')
# author had this to say about 1.2.9.... # author had this to say about 1.2.9....
# Due to the bug fixes, any installations of 1.2.9 should be immediately # Due to the bug fixes, any installations of 1.2.9 should be immediately
# replaced with 1.2.10. # replaced with 1.2.10.
version('1.2.8', '44d667c142d7cda120332623eab69f40') version('1.2.8', '44d667c142d7cda120332623eab69f40')
variant('pic', default=True, variant('pic', default=True,
description='Produce position-independent code (for shared libs)') description='Produce position-independent code (for shared libs)')
def configure(self, spec, prefix): def setup_environment(self, spack_env, run_env):
if '+pic' in self.spec:
if '+pic' in spec: spack_env.set('CFLAGS', self.compiler.pic_flag)
environ['CFLAGS'] = self.compiler.pic_flag
config_args = ['--prefix', prefix]
configure(*config_args)