From 90bb855ffa2d39d4cd861dd65f51acfa72d11ea4 Mon Sep 17 00:00:00 2001
From: Elizabeth F <rpf2116@columbia.edu>
Date: Fri, 11 Mar 2016 23:30:38 -0500
Subject: A new subclass StagedPackage(Package) is introduced.  This PR should
 not change the behavior for existing packages that subclass from
 spack.Package.

If a package subclasses spack.StagedPackage instead of spack.Package,
the install() phase (run inside a forked process) is now separated
into sub-stages:

    a) spconfig: Generate a script spconfig.py that will configure the
       package (eg by running CMake or ./configure) This is for use if
       the user wishes to build externally from Spack.  Therefore, the
       Spack compiler wrappers are NOT used here.  Currently, that
       means that RPATH support is up to the user.

    b) configure: Configure the project (eg: runs configure, CMake,
       etc).  This will configure it for use within Spack, using the
       Spack wrapper.

    c) build: eg: "make"

    d) install: eg: "install"

If one chooses to use StagedPackage instead of Package, then one must
implement each of the install sub-stages as a separate method.
StagedPackage.install() then calls each of the sub-stages as
appropriate.

StagedPackage can be configured to only run certain sub-stages.  This
is done by setting the optional kwarg install_phases when calling
do_install().  Setting install_phases() ONLY has an effect on
StagedPackage, not on any existing packages.  By default,
install_phases is set to make StagedPackage run the same stages that
are normally run for any package: configure, build, install (and NOT
spconfig).

The ability for Spack to run stages selectively for StagedPackage
instances will enable new functionality.  For example, explicit
CMake/Autotools helpers that allow Spack to help configure a user's
project without fetching, building or installing it.

-------------

One implementation of StagedPackage is provided, CMakePackage.  This
has the following advantage for CMake-based projects over using the
standard Package class:

  a) By separating out the phases, it enables future new functionality
     for packages that use it.

  b) It provides an implementation of intall_spconfig(), which will
     help users configure their CMake-based projects.

CMakePackage expects users to implement configure_args() and
configure_env().  These methods provide the package-specific arguments
and environment needed to properly configure the package.  They are
placed in separated functions because they are used in both the
spconfig and configure stages.

TODO:

1. Generate spconfig.py scripts that are more readable.  This allows
   the users to understand how their project is configured.

2. Provide a practical way for the user to ACCESS the spconfig stage
   without building the project through Spack.

3. The CMAKE_TRANSITIVE_INCLUDE_PATH stuff needs to be reworked; it
   should be considered provisional for now.

4. User of Autotools might wish to make a similar ConfigurePackage
   subclass of StagedPackage.

---------------

One package using CMakePackage is introduced.  See ibmisc/package.py.
---
 lib/spack/spack/package.py                         | 100 ++++++++++++++++++++-
 var/spack/repos/builtin/packages/ibmisc/package.py |  47 ++++++++++
 2 files changed, 145 insertions(+), 2 deletions(-)
 create mode 100644 var/spack/repos/builtin/packages/ibmisc/package.py

diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index 696adaf896..d02a80bcad 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -66,7 +66,7 @@ import spack.fetch_strategy as fs
 from spack.version import *
 from spack.stage import Stage, ResourceStage, StageComposite
 from spack.util.compression import allowed_archive, extension
-from spack.util.executable import ProcessError
+from spack.util.executable import ProcessError, which
 from spack.util.environment import dump_environment
 
 """Allowed URL schemes for spack packages."""
@@ -826,7 +826,8 @@ class Package(object):
 
     def do_install(self,
                    keep_prefix=False,  keep_stage=False, ignore_deps=False,
-                   skip_patch=False, verbose=False, make_jobs=None, fake=False):
+                   skip_patch=False, verbose=False, make_jobs=None, fake=False,
+                   install_phases = {'spconfig', 'configure', 'build', 'install'}):
         """Called by commands to install a package and its dependencies.
 
         Package implementations should override install() to describe
@@ -881,6 +882,10 @@ class Package(object):
             tty.msg("Building %s" % self.name)
 
             self.stage.keep = keep_stage
+            self.install_phases = install_phases
+            self.build_directory = join_path(self.stage.path, 'spack-build')
+            self.source_directory = self.stage.source_path
+
             with self.stage:
                 # Run the pre-install hook in the child process after
                 # the directory is created.
@@ -1291,6 +1296,97 @@ def _hms(seconds):
     if s: parts.append("%.2fs" % s)
     return ' '.join(parts)
 
+class StagedPackage(Package):
+    """A Package subclass where the install() is split up into stages."""
+
+    def install_spconfig(self):
+        """Creates an spconfig.py script to configure the package later if we like."""
+        raise InstallError("Package %s provides no install_spconfig() method!" % self.name)
+
+    def install_configure(self):
+        """Runs the configure process."""   
+        raise InstallError("Package %s provides no install_configure() method!" % self.name)
+
+    def install_build(self):
+        """Runs the build process."""       
+        raise InstallError("Package %s provides no install_build() method!" % self.name)
+
+    def install_install(self):
+        """Runs the install process."""     
+        raise InstallError("Package %s provides no install_install() method!" % self.name)
+
+    def install(self, spec, prefix):
+        if 'spconfig' in self.install_phases:
+            self.install_spconfig()
+
+        if 'configure' in self.install_phases:
+            self.install_configure()
+
+        if 'build' in self.install_phases:
+            self.install_build()
+
+        if 'install' in self.install_phases:
+            self.install_install()
+        else:
+            # Create a dummy file so the build doesn't fail.
+            # That way, the module file will also be created.
+            with open(os.path.join(prefix, 'dummy'), 'w') as fout:
+                pass
+
+
+class CMakePackage(StagedPackage):
+
+    def configure_args(self):
+        """Returns package-specific arguments to be provided to the configure command."""
+        return list()
+
+    def configure_env(self):
+        """Returns package-specific environment under which the configure command should be run."""
+        return dict()
+
+    def cmake_transitive_include_path(self):
+        return ';'.join(
+            os.path.join(dep, 'include')
+            for dep in os.environ['SPACK_DEPENDENCIES'].split(os.pathsep)
+        )
+
+    def install_spconfig(self):
+        cmd = [str(which('cmake'))] + \
+            spack.build_environment.get_std_cmake_args(self) + \
+            ['-DCMAKE_INSTALL_PREFIX=%s' % os.environ['SPACK_PREFIX'],
+            '-DCMAKE_C_COMPILER=%s' % os.environ['SPACK_CC'],
+            '-DCMAKE_CXX_COMPILER=%s' % os.environ['SPACK_CXX'],
+            '-DCMAKE_Fortran_COMPILER=%s' % os.environ['SPACK_FC']] + \
+            self.configure_args()
+
+        env = dict()
+        env['PATH'] = os.environ['PATH']
+        env['CMAKE_TRANSITIVE_INCLUDE_PATH'] = self.cmake_transitive_include_path()
+        env['CMAKE_PREFIX_PATH'] = os.environ['CMAKE_PREFIX_PATH']
+
+        with open('spconfig.py', 'w') as fout:
+            fout.write('import sys\nimport os\nimport subprocess\n')
+            fout.write('env = {}\n'.format(repr(env)))
+            fout.write('cmd = {} + sys.argv[1:]\n'.format(repr(cmd)))
+            fout.write('proc = subprocess.Popen(cmd, env=env)\nproc.wait()\n')
+
+
+    def install_configure(self):
+        cmake = which('cmake')
+        with working_dir(self.build_directory, create=True):
+            os.environ.update(self.configure_env())
+            os.environ['CMAKE_TRANSITIVE_INCLUDE_PATH'] = self.cmake_transitive_include_path()
+            options = self.configure_args() + spack.build_environment.get_std_cmake_args(self)
+            cmake(self.source_directory, *options)
+
+    def install_build(self):
+        with working_dir(self.build_directory, create=False):
+            make()
+
+    def install_install(self):
+        with working_dir(self.build_directory, create=False):
+            make('install')
+
 
 class FetchError(spack.error.SpackError):
     """Raised when something goes wrong during fetch."""
diff --git a/var/spack/repos/builtin/packages/ibmisc/package.py b/var/spack/repos/builtin/packages/ibmisc/package.py
new file mode 100644
index 0000000000..9fadee7239
--- /dev/null
+++ b/var/spack/repos/builtin/packages/ibmisc/package.py
@@ -0,0 +1,47 @@
+from spack import *
+
+class Ibmisc(CMakePackage):
+    """Misc. reusable utilities used by IceBin."""
+
+    homepage = "https://github.com/citibeth/ibmisc"
+    url      = "https://github.com/citibeth/ibmisc/tarball/123"
+
+    version('0.1.0', '12f2a32432a11db48e00217df18e59fa')
+
+    variant('everytrace', default=False, description='Report errors through Everytrace')
+    variant('proj', default=True, description='Compile utilities for PROJ.4 library')
+    variant('blitz', default=True, description='Compile utilities for Blitz library')
+    variant('netcdf', default=True, description='Compile utilities for NetCDF library')
+    variant('boost', default=True, description='Compile utilities for Boost library')
+    variant('udunits2', default=True, description='Compile utilities for UDUNITS2 library')
+    variant('googletest', default=True, description='Compile utilities for Google Test library')
+    variant('python', default=True, description='Compile utilities for use with Python/Cython')
+
+    extends('python')
+
+    depends_on('eigen')
+    depends_on('everytrace', when='+everytrace')
+    depends_on('proj', when='+proj')
+    depends_on('blitz', when='+blitz')
+    depends_on('netcdf-cxx4', when='+netcdf')
+    depends_on('udunits2', when='+udunits2')
+    depends_on('googletest', when='+googletest')
+    depends_on('py-cython', when='+python')
+    depends_on('py-numpy', when='+python')
+    depends_on('boost', when='+boost')
+
+    # Build dependencies
+    depends_on('cmake')
+    depends_on('doxygen')
+
+    def configure_args(self):
+        spec = self.spec
+        return [
+            '-DUSE_EVERYTRACE=%s' % ('YES' if '+everytrace' in spec else 'NO'),
+            '-DUSE_PROJ4=%s' % ('YES' if '+proj' in spec else 'NO'),
+            '-DUSE_BLITZ=%s' % ('YES' if '+blitz' in spec else 'NO'),
+            '-DUSE_NETCDF=%s' % ('YES' if '+netcdf' in spec else 'NO'),
+            '-DUSE_BOOST=%s' % ('YES' if '+boost' in spec else 'NO'),
+            '-DUSE_UDUNITS2=%s' % ('YES' if '+udunits2' in spec else 'NO'),
+            '-DUSE_GTEST=%s' % ('YES' if '+googletest' in spec else 'NO')]
+
-- 
cgit v1.2.3-70-g09d2


From 42361578237e4e96ae497107a47e277a1eeb69e9 Mon Sep 17 00:00:00 2001
From: citibeth <rpf2116@columbia.edu>
Date: Sun, 13 Mar 2016 00:13:00 -0500
Subject: (1) Added "spack spconfig" command. (2) Neatened up the spconfig.py
 auto-generated file.

---
 lib/spack/spack/cmd/spconfig.py |  97 +++++++++++++++++++++++++++++
 lib/spack/spack/package.py      | 133 ++++++++++++++++++++++++++++++----------
 2 files changed, 197 insertions(+), 33 deletions(-)
 create mode 100644 lib/spack/spack/cmd/spconfig.py

diff --git a/lib/spack/spack/cmd/spconfig.py b/lib/spack/spack/cmd/spconfig.py
new file mode 100644
index 0000000000..a89e5f99e7
--- /dev/null
+++ b/lib/spack/spack/cmd/spconfig.py
@@ -0,0 +1,97 @@
+##############################################################################
+# Copyright (c) 2016, Lawrence Livermore National Security, LLC.
+# Produced at the Lawrence Livermore National Laboratory.
+#
+# This file is part of Spack.
+# Written by Elizabeth Fischer
+# 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 General Public License (as published by
+# the Free Software Foundation) version 2.1 dated 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 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 sys
+import os
+import argparse
+
+import llnl.util.tty as tty
+
+import spack
+import spack.cmd
+from spack.cmd.edit import edit_package
+from spack.stage import DIYStage
+
+description = "Create a configuration script and module, but don't build."
+
+def setup_parser(subparser):
+    subparser.add_argument(
+        '-i', '--ignore-dependencies', action='store_true', dest='ignore_deps',
+        help="Do not try to install dependencies of requested packages.")
+    subparser.add_argument(
+        '-q', '--quiet', action='store_true', dest='quiet',
+        help="Do not display verbose build output while installing.")
+    subparser.add_argument(
+        'spec', nargs=argparse.REMAINDER,
+        help="specs to use for install.  Must contain package AND verison.")
+
+
+def spconfig(self, args):
+    if not args.spec:
+        tty.die("spack spconfig requires a package spec argument.")
+
+    specs = spack.cmd.parse_specs(args.spec)
+    if len(specs) > 1:
+        tty.die("spack spconfig only takes one spec.")
+
+    # Take a write lock before checking for existence.
+    with spack.installed_db.write_transaction():
+        spec = specs[0]
+        if not spack.repo.exists(spec.name):
+            tty.warn("No such package: %s" % spec.name)
+            create = tty.get_yes_or_no("Create this package?", default=False)
+            if not create:
+                tty.msg("Exiting without creating.")
+                sys.exit(1)
+            else:
+                tty.msg("Running 'spack edit -f %s'" % spec.name)
+                edit_package(spec.name, spack.repo.first_repo(), None, True)
+                return
+
+        print('spec', spec)
+
+        if not spec.version.concrete:
+            tty.die("spack spconfig spec must have a single, concrete version.")
+
+        spec.concretize()
+        package = spack.repo.get(spec)
+
+        # It's OK if the package is already installed.
+        #if package.installed:
+        #    tty.error("Already installed in %s" % package.prefix)
+        #    tty.msg("Uninstall or try adding a version suffix for this SPCONFIG build.")
+        #    sys.exit(1)
+
+        # Forces the build to run out of the current directory.
+        package.stage = DIYStage(os.getcwd())
+
+        # TODO: make this an argument, not a global.
+        spack.do_checksum = False
+
+        package.do_install(
+            keep_prefix=True,        # Don't remove install directory, even if you think you should
+            ignore_deps=args.ignore_deps,
+            verbose=not args.quiet,
+            keep_stage=True,   # don't remove source dir for SPCONFIG.
+            install_phases = {'spconfig', 'provenance'})
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index d02a80bcad..3d8e098346 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -45,6 +45,9 @@ import multiprocessing
 from urlparse import urlparse, urljoin
 import textwrap
 from StringIO import StringIO
+import shutil
+import sys
+import string
 
 import llnl.util.tty as tty
 from llnl.util.tty.log import log_output
@@ -68,6 +71,7 @@ from spack.stage import Stage, ResourceStage, StageComposite
 from spack.util.compression import allowed_archive, extension
 from spack.util.executable import ProcessError, which
 from spack.util.environment import dump_environment
+from spack import directory_layout
 
 """Allowed URL schemes for spack packages."""
 _ALLOWED_URL_SCHEMES = ["http", "https", "ftp", "file", "git"]
@@ -827,7 +831,7 @@ class Package(object):
     def do_install(self,
                    keep_prefix=False,  keep_stage=False, ignore_deps=False,
                    skip_patch=False, verbose=False, make_jobs=None, fake=False,
-                   install_phases = {'spconfig', 'configure', 'build', 'install'}):
+                   install_phases = {'configure', 'build', 'install', 'provenance'}):
         """Called by commands to install a package and its dependencies.
 
         Package implementations should override install() to describe
@@ -853,7 +857,7 @@ class Package(object):
             return
 
         # Ensure package is not already installed
-        if spack.install_layout.check_installed(self.spec):
+        if 'install' in install_phases and spack.install_layout.check_installed(self.spec):
             tty.msg("%s is already installed in %s" % (self.name, self.prefix))
             return
 
@@ -895,35 +899,46 @@ class Package(object):
                     self.do_fake_install()
                 else:
                     # Do the real install in the source directory.
-                     self.stage.chdir_to_source()
+                    self.stage.chdir_to_source()
+
+                    # Save the build environment in a file before building.
+                    env_path = join_path(os.getcwd(), 'spack-build.env')
+
+                    try:
+                       # Redirect I/O to a build log (and optionally to the terminal)
+                       log_path = join_path(os.getcwd(), 'spack-build.out')
+                       log_file = open(log_path, 'w')
+                       with log_output(log_file, verbose, sys.stdout.isatty(), True):
+                           dump_environment(env_path)
+                           self.install(self.spec, self.prefix)
+
+                    except ProcessError as e:
+                        # Annotate ProcessErrors with the location of the build log.
+                        e.build_log = log_path
+                        raise e
 
-                     # Save the build environment in a file before building.
-                     env_path = join_path(os.getcwd(), 'spack-build.env')
+                    # Ensure that something was actually installed.
+                    if 'install' in self.install_phases:
+                        self._sanity_check_install()
 
-                     try:
-                        # Redirect I/O to a build log (and optionally to the terminal)
-                        log_path = join_path(os.getcwd(), 'spack-build.out')
-                        log_file = open(log_path, 'w')
-                        with log_output(log_file, verbose, sys.stdout.isatty(), True):
-                            dump_environment(env_path)
-                            self.install(self.spec, self.prefix)
 
-                     except ProcessError as e:
-                         # Annotate ProcessErrors with the location of the build log.
-                         e.build_log = log_path
-                         raise e
+                    # Copy provenance into the install directory on success
+                    if 'provenance' in self.install_phases:
 
-                     # Ensure that something was actually installed.
-                     self._sanity_check_install()
+                        log_install_path = spack.install_layout.build_log_path(self.spec)
+                        env_install_path = spack.install_layout.build_env_path(self.spec)
+                        packages_dir = spack.install_layout.build_packages_path(self.spec)
 
-                     # Copy provenance into the install directory on success
-                     log_install_path = spack.install_layout.build_log_path(self.spec)
-                     env_install_path = spack.install_layout.build_env_path(self.spec)
-                     packages_dir = spack.install_layout.build_packages_path(self.spec)
+                        # Remove first if we're overwriting another build
+                        # (can happen with spack spconfig)
+                        try:
+                            shutil.rmtree(packages_dir)   # log_install_path and env_install_path are inside this
+                        except:
+                            pass
 
-                     install(log_path, log_install_path)
-                     install(env_path, env_install_path)
-                     dump_packages(self.spec, packages_dir)
+                        install(log_path, log_install_path)
+                        install(env_path, env_install_path)
+                        dump_packages(self.spec, packages_dir)
 
             # Stop timer.
             self._total_time = time.time() - start_time
@@ -937,16 +952,29 @@ class Package(object):
         try:
             # Create the install prefix and fork the build process.
             spack.install_layout.create_install_directory(self.spec)
+        except directory_layout.InstallDirectoryAlreadyExistsError:
+            if 'install' in install_phases:
+                # Abort install if install directory exists.
+                # But do NOT remove it (you'd be overwriting someon else's stuff)
+                tty.warn("Keeping existing install prefix in place.")
+                raise
+            else:
+                # We're not installing anyway, so don't worry if someone
+                # else has already written in the install directory
+                pass
+
+        try:
             spack.build_environment.fork(self, build_process)
         except:
             # remove the install prefix if anything went wrong during install.
-            if not keep_prefix:
-                self.remove_prefix()
-            else:
+            if keep_prefix:
                 tty.warn("Keeping install prefix in place despite error.",
                          "Spack will think this package is installed. " +
                          "Manually remove this directory to fix:",
                          self.prefix, wrap=True)
+            else:
+                self.remove_prefix()
+
             raise
 
         # note: PARENT of the build process adds the new package to
@@ -1333,6 +1361,12 @@ class StagedPackage(Package):
             with open(os.path.join(prefix, 'dummy'), 'w') as fout:
                 pass
 
+# stackoverflow.com/questions/12791997/how-do-you-do-a-simple-chmod-x-from-within-python
+def make_executable(path):
+    mode = os.stat(path).st_mode
+    mode |= (mode & 0o444) >> 2    # copy R bits to X
+    os.chmod(path, mode)
+
 
 class CMakePackage(StagedPackage):
 
@@ -1364,11 +1398,44 @@ class CMakePackage(StagedPackage):
         env['CMAKE_TRANSITIVE_INCLUDE_PATH'] = self.cmake_transitive_include_path()
         env['CMAKE_PREFIX_PATH'] = os.environ['CMAKE_PREFIX_PATH']
 
-        with open('spconfig.py', 'w') as fout:
-            fout.write('import sys\nimport os\nimport subprocess\n')
-            fout.write('env = {}\n'.format(repr(env)))
-            fout.write('cmd = {} + sys.argv[1:]\n'.format(repr(cmd)))
-            fout.write('proc = subprocess.Popen(cmd, env=env)\nproc.wait()\n')
+        spconfig_fname = 'spconfig.py'
+        with open(spconfig_fname, 'w') as fout:
+            fout.write(\
+r"""#!{}
+#
+
+import sys
+import os
+import subprocess
+
+def cmdlist(str):
+	return list(x.strip().replace("'",'') for x in str.split('\n') if x)
+env = dict()
+""".format(sys.executable))
+
+            env_vars = sorted(list(env.keys()))
+            for name in env_vars:
+                val = env[name]
+                if string.find(name, 'PATH') < 0:
+                    fout.write('env[{}] = {}\n'.format(repr(name),repr(val)))
+                else:
+                    if name == 'CMAKE_TRANSITIVE_INCLUDE_PATH':
+                        sep = ';'
+                    else:
+                        sep = ':'
+
+                    fout.write('env[{}] = "{}".join(cmdlist("""\n'.format(repr(name),sep))
+                    for part in string.split(val, sep):
+                        fout.write('    {}\n'.format(part))
+                    fout.write('"""))\n')
+
+            fout.write('\ncmd = cmdlist("""\n')
+            fout.write('{}\n'.format(cmd[0]))
+            for arg in cmd[1:]:
+                fout.write('    {}\n'.format(arg))
+            fout.write('""") + sys.argv[1:]\n')
+            fout.write('\nproc = subprocess.Popen(cmd, env=env)\nproc.wait()\n')
+        make_executable(spconfig_fname)
 
 
     def install_configure(self):
-- 
cgit v1.2.3-70-g09d2


From c1a8574d8f67d6b4fdce109ecf4dd3a1cbe18488 Mon Sep 17 00:00:00 2001
From: Elizabeth F <rpf2116@columbia.edu>
Date: Sun, 13 Mar 2016 00:29:40 -0500
Subject: Fixed for Python 2.6

---
 lib/spack/spack/package.py                         | 2 +-
 var/spack/repos/builtin/packages/ibmisc/package.py | 9 ++++++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index 3d8e098346..f815628bba 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -831,7 +831,7 @@ class Package(object):
     def do_install(self,
                    keep_prefix=False,  keep_stage=False, ignore_deps=False,
                    skip_patch=False, verbose=False, make_jobs=None, fake=False,
-                   install_phases = {'configure', 'build', 'install', 'provenance'}):
+                   install_phases = set(['configure', 'build', 'install', 'provenance'])):
         """Called by commands to install a package and its dependencies.
 
         Package implementations should override install() to describe
diff --git a/var/spack/repos/builtin/packages/ibmisc/package.py b/var/spack/repos/builtin/packages/ibmisc/package.py
index 9fadee7239..a3bd680655 100644
--- a/var/spack/repos/builtin/packages/ibmisc/package.py
+++ b/var/spack/repos/builtin/packages/ibmisc/package.py
@@ -1,4 +1,5 @@
 from spack import *
+import llnl.util.tty as tty
 
 class Ibmisc(CMakePackage):
     """Misc. reusable utilities used by IceBin."""
@@ -15,7 +16,7 @@ class Ibmisc(CMakePackage):
     variant('boost', default=True, description='Compile utilities for Boost library')
     variant('udunits2', default=True, description='Compile utilities for UDUNITS2 library')
     variant('googletest', default=True, description='Compile utilities for Google Test library')
-    variant('python', default=True, description='Compile utilities for use with Python/Cython')
+    variant('python', default=True, description='Compile utilities fro use with Python/Cython')
 
     extends('python')
 
@@ -26,16 +27,18 @@ class Ibmisc(CMakePackage):
     depends_on('netcdf-cxx4', when='+netcdf')
     depends_on('udunits2', when='+udunits2')
     depends_on('googletest', when='+googletest')
+#    depends_on('python', when='+python')
     depends_on('py-cython', when='+python')
     depends_on('py-numpy', when='+python')
     depends_on('boost', when='+boost')
 
+
+
     # Build dependencies
     depends_on('cmake')
     depends_on('doxygen')
 
-    def configure_args(self):
-        spec = self.spec
+    def config_args(self, spec, prefix):
         return [
             '-DUSE_EVERYTRACE=%s' % ('YES' if '+everytrace' in spec else 'NO'),
             '-DUSE_PROJ4=%s' % ('YES' if '+proj' in spec else 'NO'),
-- 
cgit v1.2.3-70-g09d2


From 003957a689b8d3d6e6da5408d61c45e73e01b575 Mon Sep 17 00:00:00 2001
From: citibeth <rpf2116@columbia.edu>
Date: Sun, 13 Mar 2016 00:33:13 -0500
Subject: Reverted bad change

---
 var/spack/repos/builtin/packages/ibmisc/package.py | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/var/spack/repos/builtin/packages/ibmisc/package.py b/var/spack/repos/builtin/packages/ibmisc/package.py
index a3bd680655..8e6cf429a7 100644
--- a/var/spack/repos/builtin/packages/ibmisc/package.py
+++ b/var/spack/repos/builtin/packages/ibmisc/package.py
@@ -1,5 +1,4 @@
 from spack import *
-import llnl.util.tty as tty
 
 class Ibmisc(CMakePackage):
     """Misc. reusable utilities used by IceBin."""
@@ -16,7 +15,7 @@ class Ibmisc(CMakePackage):
     variant('boost', default=True, description='Compile utilities for Boost library')
     variant('udunits2', default=True, description='Compile utilities for UDUNITS2 library')
     variant('googletest', default=True, description='Compile utilities for Google Test library')
-    variant('python', default=True, description='Compile utilities fro use with Python/Cython')
+    variant('python', default=True, description='Compile utilities for use with Python/Cython')
 
     extends('python')
 
@@ -27,18 +26,16 @@ class Ibmisc(CMakePackage):
     depends_on('netcdf-cxx4', when='+netcdf')
     depends_on('udunits2', when='+udunits2')
     depends_on('googletest', when='+googletest')
-#    depends_on('python', when='+python')
     depends_on('py-cython', when='+python')
     depends_on('py-numpy', when='+python')
     depends_on('boost', when='+boost')
 
-
-
     # Build dependencies
     depends_on('cmake')
     depends_on('doxygen')
 
-    def config_args(self, spec, prefix):
+    def configure_args(self):
+        spec = self.spec
         return [
             '-DUSE_EVERYTRACE=%s' % ('YES' if '+everytrace' in spec else 'NO'),
             '-DUSE_PROJ4=%s' % ('YES' if '+proj' in spec else 'NO'),
@@ -47,4 +44,3 @@ class Ibmisc(CMakePackage):
             '-DUSE_BOOST=%s' % ('YES' if '+boost' in spec else 'NO'),
             '-DUSE_UDUNITS2=%s' % ('YES' if '+udunits2' in spec else 'NO'),
             '-DUSE_GTEST=%s' % ('YES' if '+googletest' in spec else 'NO')]
-
-- 
cgit v1.2.3-70-g09d2


From 9885f1a19ec5c81121e20cd201007c89cc7b1b1f Mon Sep 17 00:00:00 2001
From: citibeth <rpf2116@columbia.edu>
Date: Sun, 13 Mar 2016 00:34:46 -0500
Subject: Fix for Python 2.6

---
 lib/spack/spack/cmd/spconfig.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/spack/spack/cmd/spconfig.py b/lib/spack/spack/cmd/spconfig.py
index a89e5f99e7..6035a61841 100644
--- a/lib/spack/spack/cmd/spconfig.py
+++ b/lib/spack/spack/cmd/spconfig.py
@@ -94,4 +94,4 @@ def spconfig(self, args):
             ignore_deps=args.ignore_deps,
             verbose=not args.quiet,
             keep_stage=True,   # don't remove source dir for SPCONFIG.
-            install_phases = {'spconfig', 'provenance'})
+            install_phases = set(['spconfig', 'provenance']))
-- 
cgit v1.2.3-70-g09d2


From 857f791286a041d527481a35931cb0249624a53a Mon Sep 17 00:00:00 2001
From: citibeth <rpf2116@columbia.edu>
Date: Sun, 13 Mar 2016 00:40:50 -0500
Subject: Add missing import.

---
 lib/spack/spack/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/spack/spack/__init__.py b/lib/spack/spack/__init__.py
index 3051d3f742..920e22d672 100644
--- a/lib/spack/spack/__init__.py
+++ b/lib/spack/spack/__init__.py
@@ -173,7 +173,7 @@ sys_type = None
 #       should live.  This file is overloaded for spack core vs. for packages.
 #
 __all__ = ['Package', 'Version', 'when', 'ver']
-from spack.package import Package, ExtensionConflictError
+from spack.package import Package, CMakePackage, ExtensionConflictError
 from spack.version import Version, ver
 from spack.multimethod import when
 
-- 
cgit v1.2.3-70-g09d2


From 4c9a52044a89ef8133ab2ac1759da9d4caefa3eb Mon Sep 17 00:00:00 2001
From: Elizabeth F <rpf2116@columbia.edu>
Date: Sun, 13 Mar 2016 15:18:24 -0400
Subject: Fixed CMakePackage import

---
 lib/spack/spack/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/spack/spack/__init__.py b/lib/spack/spack/__init__.py
index 920e22d672..c31687cafc 100644
--- a/lib/spack/spack/__init__.py
+++ b/lib/spack/spack/__init__.py
@@ -172,7 +172,7 @@ sys_type = None
 # TODO: it's not clear where all the stuff that needs to be included in packages
 #       should live.  This file is overloaded for spack core vs. for packages.
 #
-__all__ = ['Package', 'Version', 'when', 'ver']
+__all__ = ['Package', 'CMakePackage', 'Version', 'when', 'ver']
 from spack.package import Package, CMakePackage, ExtensionConflictError
 from spack.version import Version, ver
 from spack.multimethod import when
-- 
cgit v1.2.3-70-g09d2


From 030e8dd1ac7c23cfdd9bf7983caec6f8ca41a556 Mon Sep 17 00:00:00 2001
From: Elizabeth F <rpf2116@columbia.edu>
Date: Sun, 13 Mar 2016 18:04:23 -0400
Subject: Removed Python 2.7-style string formatting

---
 lib/spack/spack/package.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index f815628bba..10f0c4e761 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -1401,7 +1401,7 @@ class CMakePackage(StagedPackage):
         spconfig_fname = 'spconfig.py'
         with open(spconfig_fname, 'w') as fout:
             fout.write(\
-r"""#!{}
+r"""#!%s
 #
 
 import sys
@@ -1411,28 +1411,28 @@ import subprocess
 def cmdlist(str):
 	return list(x.strip().replace("'",'') for x in str.split('\n') if x)
 env = dict()
-""".format(sys.executable))
+""" % sys.executable)
 
             env_vars = sorted(list(env.keys()))
             for name in env_vars:
                 val = env[name]
                 if string.find(name, 'PATH') < 0:
-                    fout.write('env[{}] = {}\n'.format(repr(name),repr(val)))
+                    fout.write('env[%s] = %s\n'. % (repr(name),repr(val)))
                 else:
                     if name == 'CMAKE_TRANSITIVE_INCLUDE_PATH':
                         sep = ';'
                     else:
                         sep = ':'
 
-                    fout.write('env[{}] = "{}".join(cmdlist("""\n'.format(repr(name),sep))
+                    fout.write('env[%s] = "%s".join(cmdlist("""\n' % (repr(name),sep))
                     for part in string.split(val, sep):
-                        fout.write('    {}\n'.format(part))
+                        fout.write('    %s\n' % part)
                     fout.write('"""))\n')
 
             fout.write('\ncmd = cmdlist("""\n')
-            fout.write('{}\n'.format(cmd[0]))
+            fout.write('%s\n' % cmd[0])
             for arg in cmd[1:]:
-                fout.write('    {}\n'.format(arg))
+                fout.write('    %s\n' % arg)
             fout.write('""") + sys.argv[1:]\n')
             fout.write('\nproc = subprocess.Popen(cmd, env=env)\nproc.wait()\n')
         make_executable(spconfig_fname)
-- 
cgit v1.2.3-70-g09d2


From 0426796d9f6e064f062f4c3b0d27098dfe685d77 Mon Sep 17 00:00:00 2001
From: Elizabeth F <rpf2116@columbia.edu>
Date: Sun, 13 Mar 2016 18:14:38 -0400
Subject: Fixed typo

---
 lib/spack/spack/package.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index 10f0c4e761..18c4afcf95 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -1417,7 +1417,7 @@ env = dict()
             for name in env_vars:
                 val = env[name]
                 if string.find(name, 'PATH') < 0:
-                    fout.write('env[%s] = %s\n'. % (repr(name),repr(val)))
+                    fout.write('env[%s] = %s\n' % (repr(name),repr(val)))
                 else:
                     if name == 'CMAKE_TRANSITIVE_INCLUDE_PATH':
                         sep = ';'
-- 
cgit v1.2.3-70-g09d2


From 6f26c45143e63ee339f9aabc654684056b60654f Mon Sep 17 00:00:00 2001
From: Elizabeth F <rpf2116@columbia.edu>
Date: Sun, 13 Mar 2016 19:38:19 -0400
Subject: Fixed typo bug.  Made error comment more explicit

---
 lib/spack/spack/cmd/spconfig.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/spack/spack/cmd/spconfig.py b/lib/spack/spack/cmd/spconfig.py
index 6035a61841..70db48e172 100644
--- a/lib/spack/spack/cmd/spconfig.py
+++ b/lib/spack/spack/cmd/spconfig.py
@@ -69,10 +69,8 @@ def spconfig(self, args):
                 edit_package(spec.name, spack.repo.first_repo(), None, True)
                 return
 
-        print('spec', spec)
-
-        if not spec.version.concrete:
-            tty.die("spack spconfig spec must have a single, concrete version.")
+        if not spec.versions.concrete:
+            tty.die("spack spconfig spec must have a single, concrete version.  Did you forget a package version number?")
 
         spec.concretize()
         package = spack.repo.get(spec)
-- 
cgit v1.2.3-70-g09d2


From 8f675b0ee8d546a6b7908a26db189eb6583e1d98 Mon Sep 17 00:00:00 2001
From: Elizabeth F <rpf2116@columbia.edu>
Date: Fri, 25 Mar 2016 17:12:16 -0400
Subject: Made StagedPackage user-visible.

---
 lib/spack/spack/__init__.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/spack/spack/__init__.py b/lib/spack/spack/__init__.py
index 2cb189b4a2..fce7481b5b 100644
--- a/lib/spack/spack/__init__.py
+++ b/lib/spack/spack/__init__.py
@@ -172,8 +172,8 @@ sys_type = None
 # TODO: it's not clear where all the stuff that needs to be included in packages
 #       should live.  This file is overloaded for spack core vs. for packages.
 #
-__all__ = ['Package', 'CMakePackage', 'Version', 'when', 'ver']
-from spack.package import Package, CMakePackage, ExtensionConflictError
+__all__ = ['Package', 'StagedPackage', 'CMakePackage', 'Version', 'when', 'ver']
+from spack.package import Package, StagedPackage, CMakePackage, ExtensionConflictError
 from spack.version import Version, ver
 from spack.multimethod import when
 
-- 
cgit v1.2.3-70-g09d2


From 9889b1a5febc2aedec6401ae701b55961cf0d559 Mon Sep 17 00:00:00 2001
From: Elizabeth F <rpf2116@columbia.edu>
Date: Fri, 25 Mar 2016 17:12:32 -0400
Subject: Added documentation for StagedPackage, etc.

---
 lib/spack/docs/packaging_guide.rst | 101 +++++++++++++++++++++++++++++++++++++
 1 file changed, 101 insertions(+)

diff --git a/lib/spack/docs/packaging_guide.rst b/lib/spack/docs/packaging_guide.rst
index 519c0da232..bc2834c713 100644
--- a/lib/spack/docs/packaging_guide.rst
+++ b/lib/spack/docs/packaging_guide.rst
@@ -2707,3 +2707,104 @@ might write:
    DWARF_PREFIX = $(spack location -i libdwarf)
    CXXFLAGS += -I$DWARF_PREFIX/include
    CXXFLAGS += -L$DWARF_PREFIX/lib
+
+Build System Configuration Support
+----------------------------------
+
+Imagine a developer creating a CMake-based (or Autotools) project in a local
+directory, which depends on libraries A-Z.  Once Spack has installed
+those dependencies, one would like to run ``cmake`` with appropriate
+command line and environment so CMake can find them.  The ``spack
+spconfig`` command does this conveniently, producing a CMake
+configuration that is essentially the same as how Spack *would have*
+configured the project.  This can be demonstrated with a usage
+example:
+
+.. code-block:: bash
+
+  > cd myproject
+  > spack spconfig myproject@local
+  > mkdir build; cd build
+  > ../spconfig.py ..
+  > make
+  > make install
+
+Notes:
+  * Spack must have ``myproject/package.py`` in its repository for
+    this to work.
+  * ``spack spconfig`` produces the executable script ``spconfig.py``
+    in the local directory, and also creates the module file for the
+    package.  ``spconfig.py`` is normally run from the top level of
+    the source tree.
+
+  * The version number given to ``spack spconfig`` is arbitrary (just
+    like ``spack diy``).  ``myproject/package.py`` does not need to
+    have any valid downloadable versions listed (typical when a
+    project is new).
+  * spconfig.py produces a CMake configuration that *does not* use the
+    Spack wrappers.  Any resulting binaries *will not* use RPATH,
+    unless the user has enabled it.  This is recommended for
+    development purposes, not production.
+  * spconfig.py is easily legible, and can serve as a developer
+    reference of what dependencies are being used.
+  * ``make install`` installs the package into the Spack repository,
+    where it may be used by other Spack packages.
+
+CMakePackage
+~~~~~~~~~~~~
+
+In order ot enable ``spack spconfig`` functionality, the author of
+``myproject/package.py`` must subclass from ``CMakePackage`` instead
+of the standard ``Package`` superclass.  Because CMake is
+standardized, the packager does not need to tell Spack how to run
+``cmake; make; make install``.  Instead the packager only needs to
+create (optional) methods ``configure_args()`` and ``configure_env()``, which
+provide the arguments (as a list) and extra environment variables (as
+a dict) to provide to the ``cmake`` command.  Usually, these will
+translate variant flags into CMake definitions.  For example:
+
+.. code-block:: python
+    def configure_args(self):
+        spec = self.spec
+        return [
+            '-DUSE_EVERYTRACE=%s' % ('YES' if '+everytrace' in spec else 'NO'),
+            '-DBUILD_PYTHON=%s' % ('YES' if '+python' in spec else 'NO'),
+            '-DBUILD_GRIDGEN=%s' % ('YES' if '+gridgen' in spec else 'NO'),
+            '-DBUILD_COUPLER=%s' % ('YES' if '+coupler' in spec else 'NO'),
+            '-DUSE_PISM=%s' % ('YES' if '+pism' in spec else 'NO')]
+
+If needed, a packager may also override methods defined in
+``StagedPackage`` (see below).
+
+
+StagedPackage
+~~~~~~~~~~~~~
+
+``CMakePackage`` is implemented by subclassing the ``StagedPackage``
+superclass, which breaks down the standard ``Package.install()``
+method into several sub-stages: ``spconfig``, ``configure``, ``build``
+and ``install``.  Details:
+
+  * Instead of implementing the standard ``install()`` method, package
+    authors implement the methods for the sub-stages
+    ``install_spconfig()``, ``install_configure()``,
+    ``install_build()``, and ``install_install()``.
+  * The ``spack install`` command runs the sub-stages ``configure``,
+    ``build`` and ``install`` in order.  (The ``spconfig`` stage is
+    not run by default; see below).
+  * The ``spack spconfig`` command runs the sub-stages ``spconfig``
+    and a dummy install (to create the module file).
+  * The sub-stage install methods take no arguments (other than
+    ``self``).  The arguments ``spec`` and ``prefix`` to the standard
+    ``install()`` method may be accessed via ``self.spec`` and
+    ``self.prefix``.
+
+GNU Autotools
+~~~~~~~~~~~~~
+
+The ``spconfig`` functionality is currently only available for
+CMake-based packages.  Extending this functionality to GNU
+Autotools-based packages would be easy (and should be done by a
+developer who actively uses Autotools).  Packages that use
+non-standard build systems can gain ``spconfig`` functionality by
+subclassing ``StagedPackage`` directly.
-- 
cgit v1.2.3-70-g09d2


From a1c965d70d7074dcedd88379c636f834f6c88fd2 Mon Sep 17 00:00:00 2001
From: citibeth <rpf2116@columbia.edu>
Date: Sat, 26 Mar 2016 20:21:27 -0400
Subject: Fixed imports to make ``git spconfig`` work after recent merge from
 develop.

---
 lib/spack/spack/package.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index 2d7cb765a0..51ee3d7d8b 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -38,6 +38,7 @@ import re
 import textwrap
 import time
 import glob
+import string
 
 import llnl.util.tty as tty
 import spack
@@ -51,6 +52,8 @@ import spack.mirror
 import spack.repository
 import spack.url
 import spack.util.web
+
+from urlparse import urlparse
 from StringIO import StringIO
 from llnl.util.filesystem import *
 from llnl.util.lang import *
@@ -59,9 +62,10 @@ from llnl.util.tty.log import log_output
 from spack.stage import Stage, ResourceStage, StageComposite
 from spack.util.compression import allowed_archive
 from spack.util.environment import dump_environment
-from spack.util.executable import ProcessError
+from spack.util.executable import ProcessError, Executable, which
 from spack.version import *
-from urlparse import urlparse
+from spack import directory_layout
+
 
 """Allowed URL schemes for spack packages."""
 _ALLOWED_URL_SCHEMES = ["http", "https", "ftp", "file", "git"]
-- 
cgit v1.2.3-70-g09d2


From 4a6b5d52475095a865d1bb98db1dd136a24607b1 Mon Sep 17 00:00:00 2001
From: citibeth <rpf2116@columbia.edu>
Date: Sun, 27 Mar 2016 00:14:10 -0400
Subject: Update to documentation formatting.

---
 lib/spack/docs/packaging_guide.rst | 45 ++++++++++++++++++++------------------
 1 file changed, 24 insertions(+), 21 deletions(-)

diff --git a/lib/spack/docs/packaging_guide.rst b/lib/spack/docs/packaging_guide.rst
index bc2834c713..d8e7cdfa80 100644
--- a/lib/spack/docs/packaging_guide.rst
+++ b/lib/spack/docs/packaging_guide.rst
@@ -1773,7 +1773,7 @@ discover its dependencies.
 
 If you want to see the environment that a package will build with, or
 if you want to run commands in that environment to test them out, you
-can use the :ref:```spack env`` <spack-env>` command, documented
+can use the :ref:`spack env <spack-env>` command, documented
 below.
 
 .. _compiler-wrappers:
@@ -1812,7 +1812,7 @@ An example of this would be the ``libdwarf`` build, which has one
 dependency: ``libelf``.  Every call to ``cc`` in the ``libdwarf``
 build will have ``-I$LIBELF_PREFIX/include``,
 ``-L$LIBELF_PREFIX/lib``, and ``-Wl,-rpath,$LIBELF_PREFIX/lib``
-inserted on the command line.  This is done transparently to the
+‰ command line.  This is done transparently to the
 project's build system, which will just think it's using a system
 where ``libelf`` is readily available.  Because of this, you **do
 not** have to insert extra ``-I``, ``-L``, etc. on the command line.
@@ -2722,12 +2722,12 @@ example:
 
 .. code-block:: bash
 
-  > cd myproject
-  > spack spconfig myproject@local
-  > mkdir build; cd build
-  > ../spconfig.py ..
-  > make
-  > make install
+   cd myproject
+    spack spconfig myproject@local
+    mkdir build; cd build
+    ../spconfig.py ..
+    make
+    make install
 
 Notes:
   * Spack must have ``myproject/package.py`` in its repository for
@@ -2749,6 +2749,7 @@ Notes:
     reference of what dependencies are being used.
   * ``make install`` installs the package into the Spack repository,
     where it may be used by other Spack packages.
+  * CMake-generated makefiles re-run CMake in some circumstances.  Use of ``spconfig.py`` breaks this behavior, requiring the developer to manually re-run ``spconfig.py`` when a ``CMakeLists.txt`` file has changed.
 
 CMakePackage
 ~~~~~~~~~~~~
@@ -2764,6 +2765,7 @@ a dict) to provide to the ``cmake`` command.  Usually, these will
 translate variant flags into CMake definitions.  For example:
 
 .. code-block:: python
+
     def configure_args(self):
         spec = self.spec
         return [
@@ -2785,19 +2787,20 @@ superclass, which breaks down the standard ``Package.install()``
 method into several sub-stages: ``spconfig``, ``configure``, ``build``
 and ``install``.  Details:
 
-  * Instead of implementing the standard ``install()`` method, package
-    authors implement the methods for the sub-stages
-    ``install_spconfig()``, ``install_configure()``,
-    ``install_build()``, and ``install_install()``.
-  * The ``spack install`` command runs the sub-stages ``configure``,
-    ``build`` and ``install`` in order.  (The ``spconfig`` stage is
-    not run by default; see below).
-  * The ``spack spconfig`` command runs the sub-stages ``spconfig``
-    and a dummy install (to create the module file).
-  * The sub-stage install methods take no arguments (other than
-    ``self``).  The arguments ``spec`` and ``prefix`` to the standard
-    ``install()`` method may be accessed via ``self.spec`` and
-    ``self.prefix``.
+* Instead of implementing the standard ``install()`` method, package
+  authors implement the methods for the sub-stages
+  ``install_spconfig()``, ``install_configure()``,
+  ``install_build()``, and ``install_install()``.
+
+* The ``spack install`` command runs the sub-stages ``configure``,
+  ``build`` and ``install`` in order.  (The ``spconfig`` stage is
+  not run by default; see below).
+* The ``spack spconfig`` command runs the sub-stages ``spconfig``
+  and a dummy install (to create the module file).
+* The sub-stage install methods take no arguments (other than
+  ``self``).  The arguments ``spec`` and ``prefix`` to the standard
+  ``install()`` method may be accessed via ``self.spec`` and
+  ``self.prefix``.
 
 GNU Autotools
 ~~~~~~~~~~~~~
-- 
cgit v1.2.3-70-g09d2


From 4d466fe879820e18f18e96809f6825d393792de3 Mon Sep 17 00:00:00 2001
From: Elizabeth F <rpf2116@columbia.edu>
Date: Wed, 27 Apr 2016 20:57:04 -0400
Subject: spack setup: Fix broken module convenience settings.

---
 lib/spack/spack/package.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index 51ee3d7d8b..ceb1a499a5 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -1497,8 +1497,21 @@ def make_executable(path):
     os.chmod(path, mode)
 
 
+
 class CMakePackage(StagedPackage):
 
+    def make_make(self):
+        import multiprocessing
+        # number of jobs spack will to build with.
+        jobs = multiprocessing.cpu_count()
+        if not self.parallel:
+            jobs = 1
+        elif self.make_jobs:
+            jobs = self.make_jobs
+
+        make  = spack.build_environment.MakeExecutable('make', jobs)
+        return make
+
     def configure_args(self):
         """Returns package-specific arguments to be provided to the configure command."""
         return list()
@@ -1576,10 +1589,12 @@ env = dict()
             cmake(self.source_directory, *options)
 
     def install_build(self):
+        make = self.make_make()
         with working_dir(self.build_directory, create=False):
             make()
 
     def install_install(self):
+        make = self.make_make()
         with working_dir(self.build_directory, create=False):
             make('install')
 
-- 
cgit v1.2.3-70-g09d2


From 2243de9e2f6e81aaccdeef8d4ccfebd5caa2be04 Mon Sep 17 00:00:00 2001
From: Elizabeth F <rpf2116@columbia.edu>
Date: Wed, 4 May 2016 19:45:30 -0400
Subject: Make quiet mode default for spack spconfig

---
 lib/spack/spack/cmd/spconfig.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/spack/spack/cmd/spconfig.py b/lib/spack/spack/cmd/spconfig.py
index 70db48e172..fcd9bdd63d 100644
--- a/lib/spack/spack/cmd/spconfig.py
+++ b/lib/spack/spack/cmd/spconfig.py
@@ -40,8 +40,8 @@ def setup_parser(subparser):
         '-i', '--ignore-dependencies', action='store_true', dest='ignore_deps',
         help="Do not try to install dependencies of requested packages.")
     subparser.add_argument(
-        '-q', '--quiet', action='store_true', dest='quiet',
-        help="Do not display verbose build output while installing.")
+        '-v', '--verbose', action='store_true', dest='verbose',
+        help="Display verbose build output while installing.")
     subparser.add_argument(
         'spec', nargs=argparse.REMAINDER,
         help="specs to use for install.  Must contain package AND verison.")
@@ -90,6 +90,6 @@ def spconfig(self, args):
         package.do_install(
             keep_prefix=True,        # Don't remove install directory, even if you think you should
             ignore_deps=args.ignore_deps,
-            verbose=not args.quiet,
+            verbose=args.verbose,
             keep_stage=True,   # don't remove source dir for SPCONFIG.
             install_phases = set(['spconfig', 'provenance']))
-- 
cgit v1.2.3-70-g09d2


From 6a48385111a383b2bb96f225e6eb1174376402dd Mon Sep 17 00:00:00 2001
From: Elizabeth Fischer <elizabeth.fischer@columbia.edu>
Date: Thu, 5 May 2016 17:47:41 -0400
Subject: Keep users environment in the spack setup script (spconfig.py).  This
 is important to avoid breaking things that require module loads to work; for
 example, non-activate Python packages.

---
 lib/spack/spack/package.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index ceb1a499a5..959e618005 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -1552,7 +1552,8 @@ import subprocess
 
 def cmdlist(str):
 	return list(x.strip().replace("'",'') for x in str.split('\n') if x)
-env = dict()
+#env = dict()
+env = dict(os.environ)
 """ % sys.executable)
 
             env_vars = sorted(list(env.keys()))
-- 
cgit v1.2.3-70-g09d2


From efa506b235523c8a9a925c1ecf91690266da4fd4 Mon Sep 17 00:00:00 2001
From: Elizabeth Fischer <elizabeth.fischer@columbia.edu>
Date: Sat, 14 May 2016 17:09:11 -0400
Subject: Preparing spack setup command for merge.  Try this out for a while...

---
 lib/spack/docs/packaging_guide.rst | 123 +++++++++++++++++++++++++++++++------
 lib/spack/spack/cmd/setup.py       |  91 +++++++++++++++++++++++++++
 lib/spack/spack/cmd/spconfig.py    |  95 ----------------------------
 lib/spack/spack/package.py         |  30 ++++-----
 4 files changed, 209 insertions(+), 130 deletions(-)
 create mode 100644 lib/spack/spack/cmd/setup.py
 delete mode 100644 lib/spack/spack/cmd/spconfig.py

diff --git a/lib/spack/docs/packaging_guide.rst b/lib/spack/docs/packaging_guide.rst
index d8e7cdfa80..438d787a12 100644
--- a/lib/spack/docs/packaging_guide.rst
+++ b/lib/spack/docs/packaging_guide.rst
@@ -377,6 +377,8 @@ add a line like this in the package class:
        version('8.2.1', '4136d7b4c04df68b686570afa26988ac')
        ...
 
+Versions should be listed with the newest version first.
+
 Version URLs
 ~~~~~~~~~~~~~~~~~
 
@@ -385,8 +387,21 @@ in the package.  For example, Spack is smart enough to download
 version ``8.2.1.`` of the ``Foo`` package above from
 ``http://example.com/foo-8.2.1.tar.gz``.
 
-If spack *cannot* extrapolate the URL from the ``url`` field, or if
-the package doesn't have a ``url`` field, you can add a URL explicitly
+If spack *cannot* extrapolate the URL from the ``url`` field by
+default, you can write your own URL generation algorithm in place of
+the ``url`` declaration.  For example:
+
+.. code-block:: python
+   :linenos:
+
+   class Foo(Package):
+       def url_for_version(self, version):
+           return 'http://example.com/version_%s/foo-%s.tar.gz' \
+               % (version, version)
+       version('8.2.1', '4136d7b4c04df68b686570afa26988ac')
+       ...
+
+If a URL cannot be derived systematically, you can add an explicit URL
 for a particular version:
 
 .. code-block:: python
@@ -1216,6 +1231,19 @@ Now, the ``py-numpy`` package can be used as an argument to ``spack
 activate``.  When it is activated, all the files in its prefix will be
 symbolically linked into the prefix of the python package.
 
+Many packages produce Python extensions for *some* variants, but not
+others: they should extend ``python`` only if the apropriate
+variant(s) are selected.  This may be accomplished with conditional
+``extends()`` declarations:
+
+.. code-block:: python
+
+   class FooLib(Package):
+       variant('python', default=True, description= \
+           'Build the Python extension Module')
+       extends('python', when='+python')
+       ...
+
 Sometimes, certain files in one package will conflict with those in
 another, which means they cannot both be activated (symlinked) at the
 same time.  In this case, you can tell Spack to ignore those files
@@ -2392,6 +2420,59 @@ File functions
 
 .. _package-lifecycle:
 
+Coding Style Guidelines
+---------------------------
+
+The following guidelines are provided, in the interests of making
+Spack packages work in a consistent manner:
+
+
+Variant Names
+~~~~~~~~~~~~~~
+
+Spack packages with variants similar to already-existing Spack
+packages should use the same name for their variants.  Standard
+variant names are:
+
+======= ======== ========================
+Name    Default   Description
+------- -------- ------------------------
+shared   True     Build shared libraries
+static            Build static libraries
+mpi               Use MPI
+python            Build Python extension
+------- -------- ------------------------
+
+If specified in this table, the corresponding default should be used
+when declaring a variant.
+
+
+Version Lists
+~~~~~~~~~~~~~~
+
+Spack packges should list supported versions with the newest first.
+
+Special Versions
+~~~~~~~~~~~~~~~~~
+
+The following *special* version names may be used when building a package:
+
+* *@system*: Indicates a hook to the OS-installed version of the
+   package.  This is useful, for example, to tell Spack to use the
+   OS-installed version in ``packages.yaml``::
+
+        openssl:
+            paths:
+                openssl@system: /usr
+            buildable: False
+
+   Certain Spack internals look for the *@system* version and do
+   appropriate things in that case.
+
+* *@local*: Indicates the version was built manually from some source
+  tree of unknown provenance (see ``spack setup``).
+
+
 Packaging workflow commands
 ---------------------------------
 
@@ -2715,7 +2796,7 @@ Imagine a developer creating a CMake-based (or Autotools) project in a local
 directory, which depends on libraries A-Z.  Once Spack has installed
 those dependencies, one would like to run ``cmake`` with appropriate
 command line and environment so CMake can find them.  The ``spack
-spconfig`` command does this conveniently, producing a CMake
+setup`` command does this conveniently, producing a CMake
 configuration that is essentially the same as how Spack *would have*
 configured the project.  This can be demonstrated with a usage
 example:
@@ -2723,7 +2804,7 @@ example:
 .. code-block:: bash
 
    cd myproject
-    spack spconfig myproject@local
+    spack setup myproject@local
     mkdir build; cd build
     ../spconfig.py ..
     make
@@ -2732,29 +2813,31 @@ example:
 Notes:
   * Spack must have ``myproject/package.py`` in its repository for
     this to work.
-  * ``spack spconfig`` produces the executable script ``spconfig.py``
-    in the local directory, and also creates the module file for the
-    package.  ``spconfig.py`` is normally run from the top level of
-    the source tree.
-
-  * The version number given to ``spack spconfig`` is arbitrary (just
-    like ``spack diy``).  ``myproject/package.py`` does not need to
+  * ``spack setup`` produces the executable script ``spconfig.py`` in
+    the local directory, and also creates the module file for the
+    package.  ``spconfig.py`` is normally run from the user's
+    out-of-source build directory.
+  * The version number given to ``spack setup`` is arbitrary, just
+    like ``spack diy``.  ``myproject/package.py`` does not need to
     have any valid downloadable versions listed (typical when a
     project is new).
   * spconfig.py produces a CMake configuration that *does not* use the
     Spack wrappers.  Any resulting binaries *will not* use RPATH,
     unless the user has enabled it.  This is recommended for
     development purposes, not production.
-  * spconfig.py is easily legible, and can serve as a developer
+  * ``spconfig.py`` is human readable, and can serve as a developer
     reference of what dependencies are being used.
   * ``make install`` installs the package into the Spack repository,
     where it may be used by other Spack packages.
-  * CMake-generated makefiles re-run CMake in some circumstances.  Use of ``spconfig.py`` breaks this behavior, requiring the developer to manually re-run ``spconfig.py`` when a ``CMakeLists.txt`` file has changed.
+  * CMake-generated makefiles re-run CMake in some circumstances.  Use
+    of ``spconfig.py`` breaks this behavior, requiring the developer
+    to manually re-run ``spconfig.py`` when a ``CMakeLists.txt`` file
+    has changed.
 
 CMakePackage
 ~~~~~~~~~~~~
 
-In order ot enable ``spack spconfig`` functionality, the author of
+In order ot enable ``spack setup`` functionality, the author of
 ``myproject/package.py`` must subclass from ``CMakePackage`` instead
 of the standard ``Package`` superclass.  Because CMake is
 standardized, the packager does not need to tell Spack how to run
@@ -2784,18 +2867,18 @@ StagedPackage
 
 ``CMakePackage`` is implemented by subclassing the ``StagedPackage``
 superclass, which breaks down the standard ``Package.install()``
-method into several sub-stages: ``spconfig``, ``configure``, ``build``
+method into several sub-stages: ``setup``, ``configure``, ``build``
 and ``install``.  Details:
 
 * Instead of implementing the standard ``install()`` method, package
   authors implement the methods for the sub-stages
-  ``install_spconfig()``, ``install_configure()``,
+  ``install_setup()``, ``install_configure()``,
   ``install_build()``, and ``install_install()``.
 
 * The ``spack install`` command runs the sub-stages ``configure``,
-  ``build`` and ``install`` in order.  (The ``spconfig`` stage is
+  ``build`` and ``install`` in order.  (The ``setup`` stage is
   not run by default; see below).
-* The ``spack spconfig`` command runs the sub-stages ``spconfig``
+* The ``spack setup`` command runs the sub-stages ``setup``
   and a dummy install (to create the module file).
 * The sub-stage install methods take no arguments (other than
   ``self``).  The arguments ``spec`` and ``prefix`` to the standard
@@ -2805,9 +2888,9 @@ and ``install``.  Details:
 GNU Autotools
 ~~~~~~~~~~~~~
 
-The ``spconfig`` functionality is currently only available for
+The ``setup`` functionality is currently only available for
 CMake-based packages.  Extending this functionality to GNU
 Autotools-based packages would be easy (and should be done by a
 developer who actively uses Autotools).  Packages that use
-non-standard build systems can gain ``spconfig`` functionality by
+non-standard build systems can gain ``setup`` functionality by
 subclassing ``StagedPackage`` directly.
diff --git a/lib/spack/spack/cmd/setup.py b/lib/spack/spack/cmd/setup.py
new file mode 100644
index 0000000000..02e9bfd281
--- /dev/null
+++ b/lib/spack/spack/cmd/setup.py
@@ -0,0 +1,91 @@
+##############################################################################
+# Copyright (c) 2016, Lawrence Livermore National Security, LLC.
+# Produced at the Lawrence Livermore National Laboratory.
+#
+# This file is part of Spack.
+# Written by Elizabeth Fischer
+# 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 General Public License (as published by
+# the Free Software Foundation) version 2.1 dated 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 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 sys
+import os
+import argparse
+
+import llnl.util.tty as tty
+
+import spack
+import spack.cmd
+from spack.cmd.edit import edit_package
+from spack.stage import DIYStage
+
+description = "Create a configuration script and module, but don't build."
+
+def setup_parser(subparser):
+    subparser.add_argument(
+        '-i', '--ignore-dependencies', action='store_true', dest='ignore_deps',
+        help="Do not try to install dependencies of requested packages.")
+    subparser.add_argument(
+        '-v', '--verbose', action='store_true', dest='verbose',
+        help="Display verbose build output while installing.")
+    subparser.add_argument(
+        'spec', nargs=argparse.REMAINDER,
+        help="specs to use for install.  Must contain package AND verison.")
+
+
+def setup(self, args):
+    if not args.spec:
+        tty.die("spack setup requires a package spec argument.")
+
+    specs = spack.cmd.parse_specs(args.spec)
+    if len(specs) > 1:
+        tty.die("spack setup only takes one spec.")
+
+    # Take a write lock before checking for existence.
+    with spack.installed_db.write_transaction():
+        spec = specs[0]
+        if not spack.repo.exists(spec.name):
+            tty.warn("No such package: %s" % spec.name)
+            create = tty.get_yes_or_no("Create this package?", default=False)
+            if not create:
+                tty.msg("Exiting without creating.")
+                sys.exit(1)
+            else:
+                tty.msg("Running 'spack edit -f %s'" % spec.name)
+                edit_package(spec.name, spack.repo.first_repo(), None, True)
+                return
+
+        if not spec.versions.concrete:
+            tty.die("spack setup spec must have a single, concrete version.  Did you forget a package version number?")
+
+        spec.concretize()
+        package = spack.repo.get(spec)
+
+        # It's OK if the package is already installed.
+
+        # Forces the build to run out of the current directory.
+        package.stage = DIYStage(os.getcwd())
+
+        # TODO: make this an argument, not a global.
+        spack.do_checksum = False
+
+        package.do_install(
+            keep_prefix=True,        # Don't remove install directory, even if you think you should
+            ignore_deps=args.ignore_deps,
+            verbose=args.verbose,
+            keep_stage=True,   # don't remove source dir for SETUP.
+            install_phases = set(['setup', 'provenance']))
diff --git a/lib/spack/spack/cmd/spconfig.py b/lib/spack/spack/cmd/spconfig.py
deleted file mode 100644
index fcd9bdd63d..0000000000
--- a/lib/spack/spack/cmd/spconfig.py
+++ /dev/null
@@ -1,95 +0,0 @@
-##############################################################################
-# Copyright (c) 2016, Lawrence Livermore National Security, LLC.
-# Produced at the Lawrence Livermore National Laboratory.
-#
-# This file is part of Spack.
-# Written by Elizabeth Fischer
-# 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 General Public License (as published by
-# the Free Software Foundation) version 2.1 dated 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 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 sys
-import os
-import argparse
-
-import llnl.util.tty as tty
-
-import spack
-import spack.cmd
-from spack.cmd.edit import edit_package
-from spack.stage import DIYStage
-
-description = "Create a configuration script and module, but don't build."
-
-def setup_parser(subparser):
-    subparser.add_argument(
-        '-i', '--ignore-dependencies', action='store_true', dest='ignore_deps',
-        help="Do not try to install dependencies of requested packages.")
-    subparser.add_argument(
-        '-v', '--verbose', action='store_true', dest='verbose',
-        help="Display verbose build output while installing.")
-    subparser.add_argument(
-        'spec', nargs=argparse.REMAINDER,
-        help="specs to use for install.  Must contain package AND verison.")
-
-
-def spconfig(self, args):
-    if not args.spec:
-        tty.die("spack spconfig requires a package spec argument.")
-
-    specs = spack.cmd.parse_specs(args.spec)
-    if len(specs) > 1:
-        tty.die("spack spconfig only takes one spec.")
-
-    # Take a write lock before checking for existence.
-    with spack.installed_db.write_transaction():
-        spec = specs[0]
-        if not spack.repo.exists(spec.name):
-            tty.warn("No such package: %s" % spec.name)
-            create = tty.get_yes_or_no("Create this package?", default=False)
-            if not create:
-                tty.msg("Exiting without creating.")
-                sys.exit(1)
-            else:
-                tty.msg("Running 'spack edit -f %s'" % spec.name)
-                edit_package(spec.name, spack.repo.first_repo(), None, True)
-                return
-
-        if not spec.versions.concrete:
-            tty.die("spack spconfig spec must have a single, concrete version.  Did you forget a package version number?")
-
-        spec.concretize()
-        package = spack.repo.get(spec)
-
-        # It's OK if the package is already installed.
-        #if package.installed:
-        #    tty.error("Already installed in %s" % package.prefix)
-        #    tty.msg("Uninstall or try adding a version suffix for this SPCONFIG build.")
-        #    sys.exit(1)
-
-        # Forces the build to run out of the current directory.
-        package.stage = DIYStage(os.getcwd())
-
-        # TODO: make this an argument, not a global.
-        spack.do_checksum = False
-
-        package.do_install(
-            keep_prefix=True,        # Don't remove install directory, even if you think you should
-            ignore_deps=args.ignore_deps,
-            verbose=args.verbose,
-            keep_stage=True,   # don't remove source dir for SPCONFIG.
-            install_phases = set(['spconfig', 'provenance']))
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index 959e618005..19198c3b28 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -935,7 +935,7 @@ class Package(object):
                         packages_dir = spack.install_layout.build_packages_path(self.spec)
 
                         # Remove first if we're overwriting another build
-                        # (can happen with spack spconfig)
+                        # (can happen with spack setup)
                         try:
                             shutil.rmtree(packages_dir)   # log_install_path and env_install_path are inside this
                         except:
@@ -1456,9 +1456,9 @@ def _hms(seconds):
 class StagedPackage(Package):
     """A Package subclass where the install() is split up into stages."""
 
-    def install_spconfig(self):
-        """Creates an spconfig.py script to configure the package later if we like."""
-        raise InstallError("Package %s provides no install_spconfig() method!" % self.name)
+    def install_setup(self):
+        """Creates an spack_setup.py script to configure the package later if we like."""
+        raise InstallError("Package %s provides no install_setup() method!" % self.name)
 
     def install_configure(self):
         """Runs the configure process."""   
@@ -1473,8 +1473,8 @@ class StagedPackage(Package):
         raise InstallError("Package %s provides no install_install() method!" % self.name)
 
     def install(self, spec, prefix):
-        if 'spconfig' in self.install_phases:
-            self.install_spconfig()
+        if 'setup' in self.install_phases:
+            self.install_setup()
 
         if 'configure' in self.install_phases:
             self.install_configure()
@@ -1520,13 +1520,13 @@ class CMakePackage(StagedPackage):
         """Returns package-specific environment under which the configure command should be run."""
         return dict()
 
-    def cmake_transitive_include_path(self):
+    def spack_transitive_include_path(self):
         return ';'.join(
             os.path.join(dep, 'include')
             for dep in os.environ['SPACK_DEPENDENCIES'].split(os.pathsep)
         )
 
-    def install_spconfig(self):
+    def install_setup(self):
         cmd = [str(which('cmake'))] + \
             spack.build_environment.get_std_cmake_args(self) + \
             ['-DCMAKE_INSTALL_PREFIX=%s' % os.environ['SPACK_PREFIX'],
@@ -1537,11 +1537,11 @@ class CMakePackage(StagedPackage):
 
         env = dict()
         env['PATH'] = os.environ['PATH']
-        env['CMAKE_TRANSITIVE_INCLUDE_PATH'] = self.cmake_transitive_include_path()
+        env['SPACK_TRANSITIVE_INCLUDE_PATH'] = self.spack_transitive_include_path()
         env['CMAKE_PREFIX_PATH'] = os.environ['CMAKE_PREFIX_PATH']
 
-        spconfig_fname = 'spconfig.py'
-        with open(spconfig_fname, 'w') as fout:
+        setup_fname = 'spconfig.py'
+        with open(setup_fname, 'w') as fout:
             fout.write(\
 r"""#!%s
 #
@@ -1552,7 +1552,6 @@ import subprocess
 
 def cmdlist(str):
 	return list(x.strip().replace("'",'') for x in str.split('\n') if x)
-#env = dict()
 env = dict(os.environ)
 """ % sys.executable)
 
@@ -1562,7 +1561,7 @@ env = dict(os.environ)
                 if string.find(name, 'PATH') < 0:
                     fout.write('env[%s] = %s\n' % (repr(name),repr(val)))
                 else:
-                    if name == 'CMAKE_TRANSITIVE_INCLUDE_PATH':
+                    if name == 'SPACK_TRANSITIVE_INCLUDE_PATH':
                         sep = ';'
                     else:
                         sep = ':'
@@ -1572,20 +1571,21 @@ env = dict(os.environ)
                         fout.write('    %s\n' % part)
                     fout.write('"""))\n')
 
+            fout.write("env['CMAKE_TRANSITIVE_INCLUDE_PATH'] = env['SPACK_TRANSITIVE_INCLUDE_PATH']   # Deprecated\n")
             fout.write('\ncmd = cmdlist("""\n')
             fout.write('%s\n' % cmd[0])
             for arg in cmd[1:]:
                 fout.write('    %s\n' % arg)
             fout.write('""") + sys.argv[1:]\n')
             fout.write('\nproc = subprocess.Popen(cmd, env=env)\nproc.wait()\n')
-        make_executable(spconfig_fname)
+        make_executable(setup_fname)
 
 
     def install_configure(self):
         cmake = which('cmake')
         with working_dir(self.build_directory, create=True):
             os.environ.update(self.configure_env())
-            os.environ['CMAKE_TRANSITIVE_INCLUDE_PATH'] = self.cmake_transitive_include_path()
+            os.environ['SPACK_TRANSITIVE_INCLUDE_PATH'] = self.spack_transitive_include_path()
             options = self.configure_args() + spack.build_environment.get_std_cmake_args(self)
             cmake(self.source_directory, *options)
 
-- 
cgit v1.2.3-70-g09d2


From 7fb45e4bfd64a8d78dcb42dcf7a3feb722ac047e Mon Sep 17 00:00:00 2001
From: Mario Melara <maamelara@gmail.com>
Date: Mon, 27 Jun 2016 13:52:48 -0700
Subject: Update documentation for use on Cray

Updating how to use compilers.yaml on Cray as well as setting up
external packages. Also includes what needs to be set up for usage on
Cray and explains what needs to be done to get Spack properly working.
Also explain the architecture spec and what it does.
---
 lib/spack/docs/basic_usage.rst   | 162 ++++++++++++++++++++++++---------------
 lib/spack/docs/configuration.rst |  60 ++++++++++++---
 2 files changed, 152 insertions(+), 70 deletions(-)

diff --git a/lib/spack/docs/basic_usage.rst b/lib/spack/docs/basic_usage.rst
index ec193e767d..199a7ef386 100644
--- a/lib/spack/docs/basic_usage.rst
+++ b/lib/spack/docs/basic_usage.rst
@@ -114,13 +114,13 @@ that the packages is installed:
 
    $ spack install mpileaks
    ==> Installing mpileaks
-   ==> mpich is already installed in /home/gamblin2/spack/opt/chaos_5_x86_64_ib/gcc@4.4.7/mpich@3.0.4.
-   ==> callpath is already installed in /home/gamblin2/spack/opt/chaos_5_x86_64_ib/gcc@4.4.7/callpath@1.0.2-5dce4318.
-   ==> adept-utils is already installed in /home/gamblin2/spack/opt/chaos_5_x86_64_ib/gcc@4.4.7/adept-utils@1.0-5adef8da.
+   ==> mpich is already installed in /home/gamblin2/spack/opt/linux-x86_64-debian7/gcc@4.4.7/mpich@3.0.4.
+   ==> callpath is already installed in /home/gamblin2/spack/opt/linux-x86_64-debian7/gcc@4.4.7/callpath@1.0.2-5dce4318.
+   ==> adept-utils is already installed in /home/gamblin2/spack/opt/linux-x86_64-debian7/gcc@4.4.7/adept-utils@1.0-5adef8da.
    ==> Trying to fetch from https://github.com/hpc/mpileaks/releases/download/v1.0/mpileaks-1.0.tar.gz
    ######################################################################## 100.0%
-   ==> Staging archive: /home/gamblin2/spack/var/spack/stage/mpileaks@1.0%gcc@4.4.7 arch=chaos_5_x86_64_ib-59f6ad23/mpileaks-1.0.tar.gz
-   ==> Created stage in /home/gamblin2/spack/var/spack/stage/mpileaks@1.0%gcc@4.4.7 arch=chaos_5_x86_64_ib-59f6ad23.
+   ==> Staging archive: /home/gamblin2/spack/var/spack/stage/mpileaks@1.0%gcc@4.4.7 arch=linux-x86_64-debian7-59f6ad23/mpileaks-1.0.tar.gz
+   ==> Created stage in /home/gamblin2/spack/var/spack/stage/mpileaks@1.0%gcc@4.4.7 arch=linux-x86_64-debian7-59f6ad23.
    ==> No patches needed for mpileaks.
    ==> Building mpileaks.
 
@@ -128,7 +128,7 @@ that the packages is installed:
 
    ==> Successfully installed mpileaks.
      Fetch: 2.16s.  Build: 9.82s.  Total: 11.98s.
-   [+] /home/gamblin2/spack/opt/chaos_5_x86_64_ib/gcc@4.4.7/mpileaks@1.0-59f6ad23
+   [+] /home/gamblin2/spack/opt/linux-x86_64-debian7/gcc@4.4.7/mpileaks@1.0-59f6ad23
 
 The last line, with the ``[+]``, indicates where the package is
 installed.
@@ -230,7 +230,7 @@ Running ``spack find`` with no arguments lists installed packages:
 
    $ spack find
    ==> 74 installed packages.
-   -- chaos_5_x86_64_ib / gcc@4.4.7 --------------------------------
+   -- linux-x86_64-debian7 / gcc@4.4.7 --------------------------------
    ImageMagick@6.8.9-10  libdwarf@20130729  py-dateutil@2.4.0
    adept-utils@1.0       libdwarf@20130729  py-ipython@2.3.1
    atk@2.14.0            libelf@0.8.12      py-matplotlib@1.4.2
@@ -256,7 +256,7 @@ Running ``spack find`` with no arguments lists installed packages:
    lcms@2.6              pixman@0.32.6      xz@5.2.0
    libdrm@2.4.33         py-dateutil@2.4.0  zlib@1.2.8
 
-   -- chaos_5_x86_64_ib / gcc@4.9.2 --------------------------------
+   -- linux-x86_64-debian7 / gcc@4.9.2 --------------------------------
    libelf@0.8.10  mpich@3.0.4
 
 Packages are divided into groups according to their architecture and
@@ -279,7 +279,7 @@ in more detail using ``spack find -d``, and by asking only to show
 
    $ spack find --deps libdwarf
    ==> 2 installed packages.
-   -- chaos_5_x86_64_ib / gcc@4.4.7 --------------------------------
+   -- linux-x86_64-debian7 / gcc@4.4.7 --------------------------------
        libdwarf@20130729-d9b90962
            ^libelf@0.8.12
        libdwarf@20130729-b52fac98
@@ -295,7 +295,7 @@ want to know whether two packages' dependencies differ, you can use
 
    $ spack find -l libdwarf
    ==> 2 installed packages.
-   -- chaos_5_x86_64_ib / gcc@4.4.7 --------------------------------
+   -- linux-x86_64-debian7 / gcc@4.4.7 --------------------------------
    libdwarf@20130729-d9b90962  libdwarf@20130729-b52fac98
 
 Now the ``libwarf`` installs have hashes after their names.  These are
@@ -309,14 +309,14 @@ use ``spack find -p``:
 
    $ spack find -p
    ==> 74 installed packages.
-   -- chaos_5_x86_64_ib / gcc@4.4.7 --------------------------------
-       ImageMagick@6.8.9-10  /home/gamblin2/spack/opt/chaos_5_x86_64_ib/gcc@4.4.7/ImageMagick@6.8.9-10-4df950dd
-       adept-utils@1.0       /home/gamblin2/spack/opt/chaos_5_x86_64_ib/gcc@4.4.7/adept-utils@1.0-5adef8da
-       atk@2.14.0            /home/gamblin2/spack/opt/chaos_5_x86_64_ib/gcc@4.4.7/atk@2.14.0-3d09ac09
-       boost@1.55.0          /home/gamblin2/spack/opt/chaos_5_x86_64_ib/gcc@4.4.7/boost@1.55.0
-       bzip2@1.0.6           /home/gamblin2/spack/opt/chaos_5_x86_64_ib/gcc@4.4.7/bzip2@1.0.6
-       cairo@1.14.0          /home/gamblin2/spack/opt/chaos_5_x86_64_ib/gcc@4.4.7/cairo@1.14.0-fcc2ab44
-       callpath@1.0.2        /home/gamblin2/spack/opt/chaos_5_x86_64_ib/gcc@4.4.7/callpath@1.0.2-5dce4318
+   -- linux-x86_64-debian7 / gcc@4.4.7 --------------------------------
+       ImageMagick@6.8.9-10  /home/gamblin2/spack/opt/linux-x86_64-debian7/gcc@4.4.7/ImageMagick@6.8.9-10-4df950dd
+       adept-utils@1.0       /home/gamblin2/spack/opt/linux-x86_64-debian7/gcc@4.4.7/adept-utils@1.0-5adef8da
+       atk@2.14.0            /home/gamblin2/spack/opt/linux-x86_64-debian7/gcc@4.4.7/atk@2.14.0-3d09ac09
+       boost@1.55.0          /home/gamblin2/spack/opt/linux-x86_64-debian7/gcc@4.4.7/boost@1.55.0
+       bzip2@1.0.6           /home/gamblin2/spack/opt/linux-x86_64-debian7/gcc@4.4.7/bzip2@1.0.6
+       cairo@1.14.0          /home/gamblin2/spack/opt/linux-x86_64-debian7/gcc@4.4.7/cairo@1.14.0-fcc2ab44
+       callpath@1.0.2        /home/gamblin2/spack/opt/linux-x86_64-debian7/gcc@4.4.7/callpath@1.0.2-5dce4318
    ...
 
 And, finally, you can restrict your search to a particular package
@@ -325,10 +325,10 @@ by supplying its name:
 .. code-block:: sh
 
    $ spack find -p libelf
-   -- chaos_5_x86_64_ib / gcc@4.4.7 --------------------------------
-       libelf@0.8.11  /home/gamblin2/spack/opt/chaos_5_x86_64_ib/gcc@4.4.7/libelf@0.8.11
-       libelf@0.8.12  /home/gamblin2/spack/opt/chaos_5_x86_64_ib/gcc@4.4.7/libelf@0.8.12
-       libelf@0.8.13  /home/gamblin2/spack/opt/chaos_5_x86_64_ib/gcc@4.4.7/libelf@0.8.13
+   -- linux-x86_64-debian7 / gcc@4.4.7 --------------------------------
+       libelf@0.8.11  /home/gamblin2/spack/opt/linux-x86_64-debian7/gcc@4.4.7/libelf@0.8.11
+       libelf@0.8.12  /home/gamblin2/spack/opt/linux-x86_64-debian7/gcc@4.4.7/libelf@0.8.12
+       libelf@0.8.13  /home/gamblin2/spack/opt/linux-x86_64-debian7/gcc@4.4.7/libelf@0.8.13
 
 ``spack find`` actually does a lot more than this.  You can use
 *specs* to query for specific configurations and builds of each
@@ -338,7 +338,7 @@ package. If you want to find only libelf versions greater than version
 .. code-block:: sh
 
    $ spack find libelf@0.8.12:
-   -- chaos_5_x86_64_ib / gcc@4.4.7 --------------------------------
+   -- linux-x86_64-debian7 / gcc@4.4.7 --------------------------------
        libelf@0.8.12  libelf@0.8.13
 
 Finding just the versions of libdwarf built with a particular version
@@ -348,7 +348,7 @@ of libelf would look like this:
 
    $ spack find -l libdwarf ^libelf@0.8.12
    ==> 1 installed packages.
-   -- chaos_5_x86_64_ib / gcc@4.4.7 --------------------------------
+   -- linux-x86_64-debian7 / gcc@4.4.7 --------------------------------
    libdwarf@20130729-d9b90962
 
 We can also search for packages that have a certain attribute. For example,
@@ -460,19 +460,38 @@ editing your ``~/.spack/compilers.yaml`` file.  You can do this by running
 Each compiler configuration in the file looks like this::
 
     ...
-    chaos_5_x86_64_ib:
-      ...
-      intel@15.0.0:
+    compilers:
+      - compiler:
+          modules = []
+          operating_system: OS
+        paths:
           cc: /usr/local/bin/icc-15.0.024-beta
           cxx: /usr/local/bin/icpc-15.0.024-beta
           f77: /usr/local/bin/ifort-15.0.024-beta
           fc: /usr/local/bin/ifort-15.0.024-beta
-      ...
 
-The chaos_5_x86_64_ib string is an architecture string, and multiple
-compilers can be listed underneath an architecture.  The architecture
-string may be replaced with the string 'all' to signify compilers that
-work on all architectures.
+          spec: intel@15.0.0:
+
+If you're on a Cray system, the modules array will hold the names of the
+compiler module as well as the corresponding PrgEnv. For example, on Edison
+at NERSC the intel compiler looks just like this::
+    ...
+    - compiler:
+        modules:
+          - PrEnv-intel
+          - intel/15.0.109
+    ...
+
+The compiler paths will also look different on a Cray system. Since most 
+compilers are invoked using cc, CC and ftn, the paths for each compiler are
+replaced with their respective Cray compiler wrapper names::
+    ...
+    paths:
+      cc: cc
+      cxx: CC
+      f77: ftn
+      fc: ftn
+    ...
 
 For compilers, like ``clang``, that do not support Fortran, put
 ``None`` for ``f77`` and ``fc``::
@@ -488,10 +507,11 @@ list displayed by ``spack compilers``.
 
 You can also add compiler flags to manually configured compilers. The
 valid flags are ``cflags``, ``cxxflags``, ``fflags``, ``cppflags``,
-``ldflags``, and ``ldlibs``. For example,::
+``ldflags``, and ``ldlibs``. For example::
 
     ...
-    chaos_5_x86_64_ib:
+    compilers:
+      - compiler:
       ...
       intel@15.0.0:
           cc: /usr/local/bin/icc-15.0.024-beta
@@ -546,8 +566,8 @@ More formally, a spec consists of the following pieces:
 boolean variants
 * ``name=<value>`` Optional compiler flag specifiers. Valid flag names are
 ``cflags``, ``cxxflags``, ``fflags``, ``cppflags``, ``ldflags``, and ``ldlibs``.
-* ``arch=<value>`` Optional architecture specifier (``arch=bgq_os``)
-* ``^`` Dependency specs (``^callpath@1.1``)
+* ``target=<value> os=<value>`` Optional architecture specifier 
+(``target=haswell os=CNL10``) * ``^`` Dependency specs (``^callpath@1.1``)
 
 There are two things to notice here.  The first is that specs are
 recursively defined.  That is, each dependency after ``^`` is a spec
@@ -626,7 +646,7 @@ compilers, variants, and architectures just like any other spec.
 Specifiers are associated with the nearest package name to their left.
 For example, above, ``@1.1`` and ``%gcc@4.7.2`` associates with the
 ``callpath`` package, while ``@1.2:1.4``, ``%gcc@4.7.5``, ``+debug``,
-``-qt``, and ``arch=bgq_os`` all associate with the ``mpileaks`` package.
+``-qt``, and ``target=haswell os=CNL10`` all associate with the ``mpileaks`` package.
 
 In the diagram above, ``mpileaks`` depends on ``mpich`` with an
 unspecified version, but packages can depend on other packages with
@@ -758,14 +778,20 @@ in gnu autotools. If all flags are set, the order is
 Architecture specifiers
 ~~~~~~~~~~~~~~~~~~~~~~~
 
-.. Note::
-
-   Architecture specifiers are part of specs but are not yet
-   functional. They will be in Spack version 1.0, due in Q3 2015.
-
 The architecture specifier looks identical to a variant specifier for a
-non-boolean variant. The architecture can be specified only using the
-reserved name ``arch`` (``arch=bgq_os``).
+non-boolean variant. The architecture can be specified by using the reserved
+words ``target`` and/or ``os`` (``target=x86-64 os=debian7``). 
+
+If you are on a Cray system, you can specify which target processor to 
+build with. For example, if you want to build against a compute node processor 
+with the compute node operating system, you would specify 
+``target=haswell os=CNL10``. Spack will then load the appropriate module for 
+the target. Additionally, Spack can also intepret the following values: 
+``be, backend, fe, frontend``. Backend is used for specifying the compute-node 
+processor and operating sytem, and frontend is used for login nodes. 
+If you decide to leave this field empty, Spack will use the 
+default architecture (compute nodes). The architecture spec is displayed as a 
+triplet of platform-target-operating_system. (``arch=linux-x86_64-debian7``)
 
 
 .. _sec-virtual-dependencies:
@@ -985,7 +1011,7 @@ of installed packages.
 
      $ module avail
 
-     ------- /home/gamblin2/spack/share/spack/modules/chaos_5_x86_64_ib --------
+     ------- /home/gamblin2/spack/share/spack/modules/linux-x86_64-debian7 --------
      adept-utils@1.0%gcc@4.4.7-5adef8da   libelf@0.8.13%gcc@4.4.7
      automaded@1.0%gcc@4.4.7-d9691bb0     libelf@0.8.13%intel@15.0.0
      boost@1.55.0%gcc@4.4.7               mpc@1.0.2%gcc@4.4.7-559607f5
@@ -1056,7 +1082,7 @@ Spack.  For example, this will add the ``mpich`` package built with
    $ spack use mpich %gcc@4.4.7
    Prepending: mpich@3.0.4%gcc@4.4.7 (ok)
    $ which mpicc
-   ~/src/spack/opt/chaos_5_x86_64_ib/gcc@4.4.7/mpich@3.0.4/bin/mpicc
+   ~/src/spack/opt/linux-x86_64-debian7/gcc@4.4.7/mpich@3.0.4/bin/mpicc
 
 Or, similarly with modules, you could type:
 
@@ -1089,8 +1115,8 @@ than one installed package matches it), then Spack will warn you:
 
    $ spack load libelf
    ==> Error: Multiple matches for spec libelf.  Choose one:
-   libelf@0.8.13%gcc@4.4.7 arch=chaos_5_x86_64_ib
-   libelf@0.8.13%intel@15.0.0 arch=chaos_5_x86_64_ib
+   libelf@0.8.13%gcc@4.4.7 arch=linux-x86_64-debian7
+   libelf@0.8.13%intel@15.0.0 arch=linux-x86_64-debian7
 
 You can either type the ``spack load`` command again with a fully
 qualified argument, or you can add just enough extra constraints to
@@ -1470,7 +1496,7 @@ an *extension*.  Suppose you have Python installed like so:
 
    $ spack find python
    ==> 1 installed packages.
-   -- chaos_5_x86_64_ib / gcc@4.4.7 --------------------------------
+   -- linux-x86_64-debian7 / gcc@4.4.7 --------------------------------
    python@2.7.8
 
 .. _spack-extensions:
@@ -1483,7 +1509,7 @@ You can find extensions for your Python installation like this:
 .. code-block:: sh
 
    $ spack extensions python
-   ==> python@2.7.8%gcc@4.4.7 arch=chaos_5_x86_64_ib-703c7a96
+   ==> python@2.7.8%gcc@4.4.7 arch=linux-x86_64-debian7-703c7a96
    ==> 36 extensions:
    geos          py-ipython     py-pexpect    py-pyside            py-sip
    py-basemap    py-libxml2     py-pil        py-pytz              py-six
@@ -1495,7 +1521,7 @@ You can find extensions for your Python installation like this:
    py-h5py       py-numpy       py-pyqt       py-shiboken
 
    ==> 12 installed:
-   -- chaos_5_x86_64_ib / gcc@4.4.7 --------------------------------
+   -- linux-x86_64-debian7 / gcc@4.4.7 --------------------------------
    py-dateutil@2.4.0    py-nose@1.3.4       py-pyside@1.2.2
    py-dateutil@2.4.0    py-numpy@1.9.1      py-pytz@2014.10
    py-ipython@2.3.1     py-pygments@2.0.1   py-setuptools@11.3.1
@@ -1511,8 +1537,8 @@ prefixes, and you can see this with ``spack find -p``:
 
    $ spack find -p py-numpy
    ==> 1 installed packages.
-   -- chaos_5_x86_64_ib / gcc@4.4.7 --------------------------------
-       py-numpy@1.9.1  /g/g21/gamblin2/src/spack/opt/chaos_5_x86_64_ib/gcc@4.4.7/py-numpy@1.9.1-66733244
+   -- linux-x86_64-debian7 / gcc@4.4.7 --------------------------------
+       py-numpy@1.9.1  /g/g21/gamblin2/src/spack/opt/linux-x86_64-debian7/gcc@4.4.7/py-numpy@1.9.1-66733244
 
 However, even though this package is installed, you cannot use it
 directly when you run ``python``:
@@ -1573,9 +1599,9 @@ installation:
 .. code-block:: sh
 
    $ spack activate py-numpy
-   ==> Activated extension py-setuptools@11.3.1%gcc@4.4.7 arch=chaos_5_x86_64_ib-3c74eb69 for python@2.7.8%gcc@4.4.7.
-   ==> Activated extension py-nose@1.3.4%gcc@4.4.7 arch=chaos_5_x86_64_ib-5f70f816 for python@2.7.8%gcc@4.4.7.
-   ==> Activated extension py-numpy@1.9.1%gcc@4.4.7 arch=chaos_5_x86_64_ib-66733244 for python@2.7.8%gcc@4.4.7.
+   ==> Activated extension py-setuptools@11.3.1%gcc@4.4.7 arch=linux-x86_64-debian7-3c74eb69 for python@2.7.8%gcc@4.4.7.
+   ==> Activated extension py-nose@1.3.4%gcc@4.4.7 arch=linux-x86_64-debian7-5f70f816 for python@2.7.8%gcc@4.4.7.
+   ==> Activated extension py-numpy@1.9.1%gcc@4.4.7 arch=linux-x86_64-debian7-66733244 for python@2.7.8%gcc@4.4.7.
 
 Several things have happened here.  The user requested that
 ``py-numpy`` be activated in the ``python`` installation it was built
@@ -1590,7 +1616,7 @@ packages listed as activated:
 .. code-block:: sh
 
    $ spack extensions python
-   ==> python@2.7.8%gcc@4.4.7  arch=chaos_5_x86_64_ib-703c7a96
+   ==> python@2.7.8%gcc@4.4.7  arch=linux-x86_64-debian7-703c7a96
    ==> 36 extensions:
    geos          py-ipython     py-pexpect    py-pyside            py-sip
    py-basemap    py-libxml2     py-pil        py-pytz              py-six
@@ -1602,14 +1628,14 @@ packages listed as activated:
    py-h5py       py-numpy       py-pyqt       py-shiboken
 
    ==> 12 installed:
-   -- chaos_5_x86_64_ib / gcc@4.4.7 --------------------------------
+   -- linux-x86_64-debian7 / gcc@4.4.7 --------------------------------
    py-dateutil@2.4.0    py-nose@1.3.4       py-pyside@1.2.2
    py-dateutil@2.4.0    py-numpy@1.9.1      py-pytz@2014.10
    py-ipython@2.3.1     py-pygments@2.0.1   py-setuptools@11.3.1
    py-matplotlib@1.4.2  py-pyparsing@2.0.3  py-six@1.9.0
 
    ==> 3 currently activated:
-   -- chaos_5_x86_64_ib / gcc@4.4.7 --------------------------------
+   -- linux-x86_64-debian7 / gcc@4.4.7 --------------------------------
    py-nose@1.3.4  py-numpy@1.9.1  py-setuptools@11.3.1
 
 
@@ -1670,7 +1696,7 @@ Spack currently needs to be run from a filesystem that supports
 ``flock`` locking semantics.  Nearly all local filesystems and recent
 versions of NFS support this, but parallel filesystems may be mounted
 without ``flock`` support enabled.  You can determine how your
-filesystems are mounted with ``mount -p``.  The output for a Lustre
+ filesystems are mounted with ``mount -p``.  The output for a Lustre
 filesystem might look like this:
 
 .. code-block:: sh
@@ -1691,7 +1717,7 @@ This issue typically manifests with the error below:
    Traceback (most recent call last):
    File "./spack", line 176, in <module>
      main()
-   File "./spack", line 154, in main
+   File "./spack", line 154,' in main
      return_val = command(parser, args)
    File "./spack/lib/spack/spack/cmd/find.py", line 170, in find
      specs = set(spack.installed_db.query(**q_args))
@@ -1709,6 +1735,20 @@ This issue typically manifests with the error below:
 
 A nicer error message is TBD in future versions of Spack.
 
+
+Spack on Cray
+-----------------------------
+
+Spack is able to detect compilers through the module avail command. Once it
+detects the compiler it writes the appropriate PrgEnv and compiler module 
+name to compilers.yaml and sets the paths to each compiler with Cray\'s 
+compiler wrapper names ie (cc, CC, ftn). During build time, Spack will
+load the correct PrgEnv and compiler module and will call either cc, CC
+or ftn. If you want to use default compilers for each PrgEnv and also be able
+to link to cray external modules, you will need to set up a packages.yaml 
+:ref:`Exernal Packages`<sec-external packages>
+
+
 Getting Help
 -----------------------
 
diff --git a/lib/spack/docs/configuration.rst b/lib/spack/docs/configuration.rst
index a6f876b2aa..b2e81e4334 100644
--- a/lib/spack/docs/configuration.rst
+++ b/lib/spack/docs/configuration.rst
@@ -70,20 +70,31 @@ directory. Here's an example of an external configuration:
    packages:
       openmpi:
          paths:
-            openmpi@1.4.3%gcc@4.4.7 arch=chaos_5_x86_64_ib: /opt/openmpi-1.4.3
-            openmpi@1.4.3%gcc@4.4.7 arch=chaos_5_x86_64_ib+debug: /opt/openmpi-1.4.3-debug
-            openmpi@1.6.5%intel@10.1 arch=chaos_5_x86_64_ib: /opt/openmpi-1.6.5-intel
+            openmpi@1.4.3%gcc@4.4.7 arch=linux-x86_64-debian7: /opt/openmpi-1.4.3
+            openmpi@1.4.3%gcc@4.4.7 arch=linux-x86_64-debian7+debug: /opt/openmpi-1.4.3-debug
+            openmpi@1.6.5%intel@10.1 arch=linux-x86_64-debian7: /opt/openmpi-1.6.5-intel
 
 This example lists three installations of OpenMPI, one built with gcc,
 one built with gcc and debug information, and another built with Intel.
 If Spack is asked to build a package that uses one of these MPIs as a
 dependency, it will use the the pre-installed OpenMPI in
-the given directory.
+the given directory. Packages.yaml can also be used to specify modules
+
+Here's an example of an external configuration for cray modules:
+
+.. code-block:: yaml
+  packages:
+      mpich:
+        modules:
+            mpich@7.3.1%gcc@5.2.0 arch=cray_xc-haswell-CNL10: cray-mpich
+            mpich@7.3.1%intel@16.0.0.109 arch=cray_xc-haswell-CNL10: cray-mpich
+
+
 
 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`` or ``modules``
 token under the package name, which lists externals in a
-``spec : /path`` format.  Each spec should be as
+``spec: /path`` or ``spec: module-name`` format.  Each spec should be as
 well-defined as reasonably possible.  If a
 package lacks a spec component, such as missing a compiler or
 package version, then Spack will guess the missing component based
@@ -108,9 +119,9 @@ be:
   packages:
     openmpi:
       paths:
-        openmpi@1.4.3%gcc@4.4.7 arch=chaos_5_x86_64_ib: /opt/openmpi-1.4.3
-        openmpi@1.4.3%gcc@4.4.7 arch=chaos_5_x86_64_ib+debug: /opt/openmpi-1.4.3-debug
-        openmpi@1.6.5%intel@10.1 arch=chaos_5_x86_64_ib: /opt/openmpi-1.6.5-intel
+        openmpi@1.4.3%gcc@4.4.7 arch=linux-x86_64-debian7: /opt/openmpi-1.4.3
+        openmpi@1.4.3%gcc@4.4.7 arch=linux-x86_64-debian7+debug: /opt/openmpi-1.4.3-debug
+        openmpi@1.6.5%intel@10.1 arch=linux-x86_64-debian7: /opt/openmpi-1.6.5-intel
       buildable: False
 
 The addition of the ``buildable`` flag tells Spack that it should never build
@@ -118,6 +129,9 @@ its own version of OpenMPI, and it will instead always rely on a pre-built
 OpenMPI.  Similar to ``paths``, ``buildable`` is specified as a property under
 a package name.
 
+If an external module is specified as not buildable, then Spack will load the
+external module into the build environment which can be used for linking.
+
 The ``buildable`` does not need to be paired with external packages.
 It could also be used alone to forbid packages that may be
 buggy or otherwise undesirable.
@@ -180,7 +194,35 @@ concretization rules.  A provider lists a value that packages may
 ``depend_on`` (e.g, mpi) and a list of rules for fulfilling that
 dependency.
 
+For Cray users, you can specify the default compiler that Spack will
+concretize too. If you want to use the Cray defaults, then set them
+under all: in packages.yaml. You can also specify concretization preferences
+to cray-mpich. Just set the cray-mpich external module as a preferred package,
+set buildable to False and set the preference of mpi to mpich.
+
+Here is an example of a full packages.yaml used at NERSC
 
+.. code-block:: sh
+   packages:
+    mpich:
+        modules:
+            mpich@7.3.1%gcc@5.2.0 arch=cray_xc-CNL10-ivybridge: cray-mpich
+            mpich@7.3.1%intel@16.0.0.109 arch=cray_xc-SuSE11-ivybridge: cray-mpich
+        buildable: False
+    netcdf:
+        modules:
+            netcdf@4.3.3.1%gcc@5.2.0 arch=cray_xc-CNL10-ivybridge: cray-netcdf
+            netcdf@4.3.3.1%intel@16.0.0.109 arch=cray_xc-CNL10-ivybridge: cray-netcdf
+        buildable: False
+    hdf5:
+        paths:
+            hdf5@1.8.14%gcc@5.2.0 arch=cray_xc-CNL10-ivybridge: cray-hdf5
+            hdf5@1.8.14%intel@16.0.0.109 arch=cray_xc-CNL10-ivybridge: cray-hdf5
+        buildable: False
+    all:
+        compiler: [gcc@5.2.0, intel@16.0.0.109]
+        providers:
+            mpi: [mpich, openmpi, intelmpi]ackages:
 
 Profiling
 ------------------
-- 
cgit v1.2.3-70-g09d2


From 26325fe812518f42978cb2471e4c74b095b66e15 Mon Sep 17 00:00:00 2001
From: Mario Melara <maamelara@gmail.com>
Date: Mon, 27 Jun 2016 14:35:56 -0700
Subject: Add missing link to external packages

Adding missing _sec-external_packages to link with external packages
page
---
 lib/spack/docs/configuration.rst | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/spack/docs/configuration.rst b/lib/spack/docs/configuration.rst
index b2e81e4334..22eff77655 100644
--- a/lib/spack/docs/configuration.rst
+++ b/lib/spack/docs/configuration.rst
@@ -53,6 +53,7 @@ in the first directory it finds to which it has write access.  Add
 more elements to the list to indicate where your own site's temporary
 directory is.
 
+.. _sec-external_packages:
 
 External Packages
 ----------------------------
-- 
cgit v1.2.3-70-g09d2


From 0384794912c6dac64a64181d591a55ea31ad7469 Mon Sep 17 00:00:00 2001
From: mwilliammyers <mwilliammyers@gmail.com>
Date: Mon, 27 Jun 2016 16:00:38 -0600
Subject: Fix #1019 - cannot create mirror for git spec

---
 lib/spack/spack/fetch_strategy.py | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py
index 1953d7c1b3..afd293e4ec 100644
--- a/lib/spack/spack/fetch_strategy.py
+++ b/lib/spack/spack/fetch_strategy.py
@@ -307,9 +307,6 @@ class URLFetchStrategy(FetchStrategy):
         if not self.archive_file:
             raise NoArchiveFileError("Cannot call archive() before fetching.")
 
-        if not extension(destination) == extension(self.archive_file):
-            raise ValueError("Cannot archive without matching extensions.")
-
         shutil.move(self.archive_file, destination)
 
     @_needs_stage
-- 
cgit v1.2.3-70-g09d2


From 6327877a6f9d2c30e4d644ec145a6f3f323ead81 Mon Sep 17 00:00:00 2001
From: Elizabeth Fischer <elizabeth.fischer@columbia.edu>
Date: Thu, 30 Jun 2016 09:19:57 -0400
Subject: PEP-8

---
 lib/spack/spack/__init__.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/spack/spack/__init__.py b/lib/spack/spack/__init__.py
index 6f74f8ff10..20c9934704 100644
--- a/lib/spack/spack/__init__.py
+++ b/lib/spack/spack/__init__.py
@@ -176,8 +176,10 @@ sys_type = None
 # TODO: it's not clear where all the stuff that needs to be included in packages
 #       should live.  This file is overloaded for spack core vs. for packages.
 #
-__all__ = ['Package', 'StagedPackage', 'CMakePackage', 'Version', 'when', 'ver']
-from spack.package import Package, StagedPackage, CMakePackage, ExtensionConflictError
+__all__ = ['Package', 'StagedPackage', 'CMakePackage', \
+    'Version', 'when', 'ver']
+from spack.package import Package, ExtensionConflictError
+from spack.package import StagedPackage, CMakePackage
 from spack.version import Version, ver
 from spack.multimethod import when
 
-- 
cgit v1.2.3-70-g09d2


From d3b0cb56b7ed1a545d0a13fbf20ece8bc89f0103 Mon Sep 17 00:00:00 2001
From: Tzanio <tzanio@llnl.gov>
Date: Thu, 30 Jun 2016 15:23:30 -0700
Subject: Updating MFEM package with v3.2 info.

---
 var/spack/repos/builtin/packages/mfem/package.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/var/spack/repos/builtin/packages/mfem/package.py b/var/spack/repos/builtin/packages/mfem/package.py
index 504efb5e35..40e4906f8e 100644
--- a/var/spack/repos/builtin/packages/mfem/package.py
+++ b/var/spack/repos/builtin/packages/mfem/package.py
@@ -31,11 +31,13 @@ class Mfem(Package):
     homepage = 'http://www.mfem.org'
     url      = 'https://github.com/mfem/mfem'
 
-#    version('3.1', git='https://github.com/mfem/mfem.git',
-#            commit='dbae60fe32e071989b52efaaf59d7d0eb2a3b574')
+    version('3.2', '2938c3deed4ec4f7fd5b5f5cfe656845282e86e2dcd477d292390058b7b94340',
+            url='http://goo.gl/Y9T75B', expand=False)
 
     version('3.1', '841ea5cf58de6fae4de0f553b0e01ebaab9cd9c67fa821e8a715666ecf18fc57',
             url='http://goo.gl/xrScXn', expand=False)
+#    version('3.1', git='https://github.com/mfem/mfem.git',
+#            commit='dbae60fe32e071989b52efaaf59d7d0eb2a3b574')
 
     variant('metis', default=False, description='Activate support for metis')
     variant('hypre', default=False, description='Activate support for hypre')
-- 
cgit v1.2.3-70-g09d2


From 137db14b75b63c9714e0eb5189bf074c828e2b30 Mon Sep 17 00:00:00 2001
From: Tzanio Kolev <tzanio@llnl.gov>
Date: Thu, 30 Jun 2016 15:40:02 -0700
Subject: Update package.py

---
 var/spack/repos/builtin/packages/mfem/package.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/var/spack/repos/builtin/packages/mfem/package.py b/var/spack/repos/builtin/packages/mfem/package.py
index 40e4906f8e..1b4456380b 100644
--- a/var/spack/repos/builtin/packages/mfem/package.py
+++ b/var/spack/repos/builtin/packages/mfem/package.py
@@ -32,7 +32,7 @@ class Mfem(Package):
     url      = 'https://github.com/mfem/mfem'
 
     version('3.2', '2938c3deed4ec4f7fd5b5f5cfe656845282e86e2dcd477d292390058b7b94340',
-            url='http://goo.gl/Y9T75B', expand=False)
+            url='http://goo.gl/Y9T75B', expand=False, preferred=True)
 
     version('3.1', '841ea5cf58de6fae4de0f553b0e01ebaab9cd9c67fa821e8a715666ecf18fc57',
             url='http://goo.gl/xrScXn', expand=False)
-- 
cgit v1.2.3-70-g09d2


From d784d561fc334666f6f387abc4c7ac8beb391f8c Mon Sep 17 00:00:00 2001
From: Mario Melara <maamelara@gmail.com>
Date: Thu, 30 Jun 2016 16:59:36 -0700
Subject: Add more documentation fix arch spec

Added more documentation for Spack on Cray. Also fixed the architecture
spec to be linux-debian7-x86_64 since it was reversed in the previous
commit.
---
 lib/spack/docs/basic_usage.rst | 270 ++++++++++++++++++++++++++++-------------
 1 file changed, 185 insertions(+), 85 deletions(-)

diff --git a/lib/spack/docs/basic_usage.rst b/lib/spack/docs/basic_usage.rst
index 199a7ef386..65688dec46 100644
--- a/lib/spack/docs/basic_usage.rst
+++ b/lib/spack/docs/basic_usage.rst
@@ -114,13 +114,13 @@ that the packages is installed:
 
    $ spack install mpileaks
    ==> Installing mpileaks
-   ==> mpich is already installed in /home/gamblin2/spack/opt/linux-x86_64-debian7/gcc@4.4.7/mpich@3.0.4.
-   ==> callpath is already installed in /home/gamblin2/spack/opt/linux-x86_64-debian7/gcc@4.4.7/callpath@1.0.2-5dce4318.
-   ==> adept-utils is already installed in /home/gamblin2/spack/opt/linux-x86_64-debian7/gcc@4.4.7/adept-utils@1.0-5adef8da.
+   ==> mpich is already installed in /home/gamblin2/spack/opt/linux-debian7-x86_64/gcc@4.4.7/mpich@3.0.4.
+   ==> callpath is already installed in /home/gamblin2/spack/opt/linux-debian7-x86_64/gcc@4.4.7/callpath@1.0.2-5dce4318.
+   ==> adept-utils is already installed in /home/gamblin2/spack/opt/linux-debian7-x86_64/gcc@4.4.7/adept-utils@1.0-5adef8da.
    ==> Trying to fetch from https://github.com/hpc/mpileaks/releases/download/v1.0/mpileaks-1.0.tar.gz
    ######################################################################## 100.0%
-   ==> Staging archive: /home/gamblin2/spack/var/spack/stage/mpileaks@1.0%gcc@4.4.7 arch=linux-x86_64-debian7-59f6ad23/mpileaks-1.0.tar.gz
-   ==> Created stage in /home/gamblin2/spack/var/spack/stage/mpileaks@1.0%gcc@4.4.7 arch=linux-x86_64-debian7-59f6ad23.
+   ==> Staging archive: /home/gamblin2/spack/var/spack/stage/mpileaks@1.0%gcc@4.4.7 arch=linux-debian7-x86_64-59f6ad23/mpileaks-1.0.tar.gz
+   ==> Created stage in /home/gamblin2/spack/var/spack/stage/mpileaks@1.0%gcc@4.4.7 arch=linux-debian7-x86_64-59f6ad23.
    ==> No patches needed for mpileaks.
    ==> Building mpileaks.
 
@@ -128,7 +128,7 @@ that the packages is installed:
 
    ==> Successfully installed mpileaks.
      Fetch: 2.16s.  Build: 9.82s.  Total: 11.98s.
-   [+] /home/gamblin2/spack/opt/linux-x86_64-debian7/gcc@4.4.7/mpileaks@1.0-59f6ad23
+   [+] /home/gamblin2/spack/opt/linux-debian7-x86_64/gcc@4.4.7/mpileaks@1.0-59f6ad23
 
 The last line, with the ``[+]``, indicates where the package is
 installed.
@@ -230,7 +230,7 @@ Running ``spack find`` with no arguments lists installed packages:
 
    $ spack find
    ==> 74 installed packages.
-   -- linux-x86_64-debian7 / gcc@4.4.7 --------------------------------
+   -- linux-debian7-x86_64 / gcc@4.4.7 --------------------------------
    ImageMagick@6.8.9-10  libdwarf@20130729  py-dateutil@2.4.0
    adept-utils@1.0       libdwarf@20130729  py-ipython@2.3.1
    atk@2.14.0            libelf@0.8.12      py-matplotlib@1.4.2
@@ -256,7 +256,7 @@ Running ``spack find`` with no arguments lists installed packages:
    lcms@2.6              pixman@0.32.6      xz@5.2.0
    libdrm@2.4.33         py-dateutil@2.4.0  zlib@1.2.8
 
-   -- linux-x86_64-debian7 / gcc@4.9.2 --------------------------------
+   -- linux-debian7-x86_64 / gcc@4.9.2 --------------------------------
    libelf@0.8.10  mpich@3.0.4
 
 Packages are divided into groups according to their architecture and
@@ -279,7 +279,7 @@ in more detail using ``spack find -d``, and by asking only to show
 
    $ spack find --deps libdwarf
    ==> 2 installed packages.
-   -- linux-x86_64-debian7 / gcc@4.4.7 --------------------------------
+   -- linux-debian7-x86_64 / gcc@4.4.7 --------------------------------
        libdwarf@20130729-d9b90962
            ^libelf@0.8.12
        libdwarf@20130729-b52fac98
@@ -295,7 +295,7 @@ want to know whether two packages' dependencies differ, you can use
 
    $ spack find -l libdwarf
    ==> 2 installed packages.
-   -- linux-x86_64-debian7 / gcc@4.4.7 --------------------------------
+   -- linux-debian7-x86_64 / gcc@4.4.7 --------------------------------
    libdwarf@20130729-d9b90962  libdwarf@20130729-b52fac98
 
 Now the ``libwarf`` installs have hashes after their names.  These are
@@ -309,14 +309,14 @@ use ``spack find -p``:
 
    $ spack find -p
    ==> 74 installed packages.
-   -- linux-x86_64-debian7 / gcc@4.4.7 --------------------------------
-       ImageMagick@6.8.9-10  /home/gamblin2/spack/opt/linux-x86_64-debian7/gcc@4.4.7/ImageMagick@6.8.9-10-4df950dd
-       adept-utils@1.0       /home/gamblin2/spack/opt/linux-x86_64-debian7/gcc@4.4.7/adept-utils@1.0-5adef8da
-       atk@2.14.0            /home/gamblin2/spack/opt/linux-x86_64-debian7/gcc@4.4.7/atk@2.14.0-3d09ac09
-       boost@1.55.0          /home/gamblin2/spack/opt/linux-x86_64-debian7/gcc@4.4.7/boost@1.55.0
-       bzip2@1.0.6           /home/gamblin2/spack/opt/linux-x86_64-debian7/gcc@4.4.7/bzip2@1.0.6
-       cairo@1.14.0          /home/gamblin2/spack/opt/linux-x86_64-debian7/gcc@4.4.7/cairo@1.14.0-fcc2ab44
-       callpath@1.0.2        /home/gamblin2/spack/opt/linux-x86_64-debian7/gcc@4.4.7/callpath@1.0.2-5dce4318
+   -- linux-debian7-x86_64 / gcc@4.4.7 --------------------------------
+       ImageMagick@6.8.9-10  /home/gamblin2/spack/opt/linux-debian7-x86_64/gcc@4.4.7/ImageMagick@6.8.9-10-4df950dd
+       adept-utils@1.0       /home/gamblin2/spack/opt/linux-debian7-x86_64/gcc@4.4.7/adept-utils@1.0-5adef8da
+       atk@2.14.0            /home/gamblin2/spack/opt/linux-debian7-x86_64/gcc@4.4.7/atk@2.14.0-3d09ac09
+       boost@1.55.0          /home/gamblin2/spack/opt/linux-debian7-x86_64/gcc@4.4.7/boost@1.55.0
+       bzip2@1.0.6           /home/gamblin2/spack/opt/linux-debian7-x86_64/gcc@4.4.7/bzip2@1.0.6
+       cairo@1.14.0          /home/gamblin2/spack/opt/linux-debian7-x86_64/gcc@4.4.7/cairo@1.14.0-fcc2ab44
+       callpath@1.0.2        /home/gamblin2/spack/opt/linux-debian7-x86_64/gcc@4.4.7/callpath@1.0.2-5dce4318
    ...
 
 And, finally, you can restrict your search to a particular package
@@ -325,10 +325,10 @@ by supplying its name:
 .. code-block:: sh
 
    $ spack find -p libelf
-   -- linux-x86_64-debian7 / gcc@4.4.7 --------------------------------
-       libelf@0.8.11  /home/gamblin2/spack/opt/linux-x86_64-debian7/gcc@4.4.7/libelf@0.8.11
-       libelf@0.8.12  /home/gamblin2/spack/opt/linux-x86_64-debian7/gcc@4.4.7/libelf@0.8.12
-       libelf@0.8.13  /home/gamblin2/spack/opt/linux-x86_64-debian7/gcc@4.4.7/libelf@0.8.13
+   -- linux-debian7-x86_64 / gcc@4.4.7 --------------------------------
+       libelf@0.8.11  /home/gamblin2/spack/opt/linux-debian7-x86_64/gcc@4.4.7/libelf@0.8.11
+       libelf@0.8.12  /home/gamblin2/spack/opt/linux-debian7-x86_64/gcc@4.4.7/libelf@0.8.12
+       libelf@0.8.13  /home/gamblin2/spack/opt/linux-debian7-x86_64/gcc@4.4.7/libelf@0.8.13
 
 ``spack find`` actually does a lot more than this.  You can use
 *specs* to query for specific configurations and builds of each
@@ -338,7 +338,7 @@ package. If you want to find only libelf versions greater than version
 .. code-block:: sh
 
    $ spack find libelf@0.8.12:
-   -- linux-x86_64-debian7 / gcc@4.4.7 --------------------------------
+   -- linux-debian7-x86_64 / gcc@4.4.7 --------------------------------
        libelf@0.8.12  libelf@0.8.13
 
 Finding just the versions of libdwarf built with a particular version
@@ -348,7 +348,7 @@ of libelf would look like this:
 
    $ spack find -l libdwarf ^libelf@0.8.12
    ==> 1 installed packages.
-   -- linux-x86_64-debian7 / gcc@4.4.7 --------------------------------
+   -- linux-debian7-x86_64 / gcc@4.4.7 --------------------------------
    libdwarf@20130729-d9b90962
 
 We can also search for packages that have a certain attribute. For example,
@@ -359,6 +359,7 @@ will find every installed package with a 'debug' compile-time option enabled.
 The full spec syntax is discussed in detail in :ref:`sec-specs`.
 
 
+.. _compiler-config:
 
 Compiler configuration
 -----------------------------------
@@ -445,7 +446,7 @@ If you want to see specifics on a particular compiler, you can run
            fc  = /usr/local/bin/ifort-15.0.090
 
 This shows which C, C++, and Fortran compilers were detected by Spack.
-Notice also that we didn't have to be too specific about the
+Notice also that we didn\'t have to be too specific about the
 version. We just said ``intel@15``, and information about the only
 matching Intel compiler was displayed.
 
@@ -472,27 +473,6 @@ Each compiler configuration in the file looks like this::
 
           spec: intel@15.0.0:
 
-If you're on a Cray system, the modules array will hold the names of the
-compiler module as well as the corresponding PrgEnv. For example, on Edison
-at NERSC the intel compiler looks just like this::
-    ...
-    - compiler:
-        modules:
-          - PrEnv-intel
-          - intel/15.0.109
-    ...
-
-The compiler paths will also look different on a Cray system. Since most 
-compilers are invoked using cc, CC and ftn, the paths for each compiler are
-replaced with their respective Cray compiler wrapper names::
-    ...
-    paths:
-      cc: cc
-      cxx: CC
-      f77: ftn
-      fc: ftn
-    ...
-
 For compilers, like ``clang``, that do not support Fortran, put
 ``None`` for ``f77`` and ``fc``::
 
@@ -538,10 +518,10 @@ Spack, that descriptor is called a *spec*.  Spack uses specs to refer
 to a particular build configuration (or configurations) of a package.
 Specs are more than a package name and a version; you can use them to
 specify the compiler, compiler version, architecture, compile options,
-and dependency options for a build.  In this section, we'll go over
+and dependency options for a build.  In this section, we\'ll go over
 the full syntax of specs.
 
-Here is an example of a much longer spec than we've seen thus far::
+Here is an example of a much longer spec than we\'ve seen thus far::
 
    mpileaks @1.2:1.4 %gcc@4.7.5 +debug -qt arch=bgq_os ^callpath @1.1 %gcc@4.7.2
 
@@ -778,20 +758,18 @@ in gnu autotools. If all flags are set, the order is
 Architecture specifiers
 ~~~~~~~~~~~~~~~~~~~~~~~
 
-The architecture specifier looks identical to a variant specifier for a
-non-boolean variant. The architecture can be specified by using the reserved
-words ``target`` and/or ``os`` (``target=x86-64 os=debian7``). 
+The architecture can be specified by using the reserved
+words ``target`` and/or ``os`` (``target=x86-64 os=debian7``). You can also
+use the triplet form of platform, operating system and processor.
 
-If you are on a Cray system, you can specify which target processor to 
-build with. For example, if you want to build against a compute node processor 
-with the compute node operating system, you would specify 
-``target=haswell os=CNL10``. Spack will then load the appropriate module for 
-the target. Additionally, Spack can also intepret the following values: 
-``be, backend, fe, frontend``. Backend is used for specifying the compute-node 
-processor and operating sytem, and frontend is used for login nodes. 
-If you decide to leave this field empty, Spack will use the 
-default architecture (compute nodes). The architecture spec is displayed as a 
-triplet of platform-target-operating_system. (``arch=linux-x86_64-debian7``)
+.. code-block:: sh
+    
+    spack install libelf arch=cray_xc-CNL10-haswell
+
+Users on non-Cray systems won't have to worry about specifying the architecture.
+Spack will autodetect what kind of operating system is on your machine as well
+as the processor. For more information on how the architecture can be 
+used on Cray machines, check here :ref:`spack-cray`
 
 
 .. _sec-virtual-dependencies:
@@ -1011,7 +989,7 @@ of installed packages.
 
      $ module avail
 
-     ------- /home/gamblin2/spack/share/spack/modules/linux-x86_64-debian7 --------
+     ------- /home/gamblin2/spack/share/spack/modules/linux-debian7-x86_64 --------
      adept-utils@1.0%gcc@4.4.7-5adef8da   libelf@0.8.13%gcc@4.4.7
      automaded@1.0%gcc@4.4.7-d9691bb0     libelf@0.8.13%intel@15.0.0
      boost@1.55.0%gcc@4.4.7               mpc@1.0.2%gcc@4.4.7-559607f5
@@ -1082,7 +1060,7 @@ Spack.  For example, this will add the ``mpich`` package built with
    $ spack use mpich %gcc@4.4.7
    Prepending: mpich@3.0.4%gcc@4.4.7 (ok)
    $ which mpicc
-   ~/src/spack/opt/linux-x86_64-debian7/gcc@4.4.7/mpich@3.0.4/bin/mpicc
+   ~/src/spack/opt/linux-debian7-x86_64/gcc@4.4.7/mpich@3.0.4/bin/mpicc
 
 Or, similarly with modules, you could type:
 
@@ -1115,8 +1093,8 @@ than one installed package matches it), then Spack will warn you:
 
    $ spack load libelf
    ==> Error: Multiple matches for spec libelf.  Choose one:
-   libelf@0.8.13%gcc@4.4.7 arch=linux-x86_64-debian7
-   libelf@0.8.13%intel@15.0.0 arch=linux-x86_64-debian7
+   libelf@0.8.13%gcc@4.4.7 arch=linux-debian7-x86_64
+   libelf@0.8.13%intel@15.0.0 arch=linux-debian7-x86_64
 
 You can either type the ``spack load`` command again with a fully
 qualified argument, or you can add just enough extra constraints to
@@ -1496,7 +1474,7 @@ an *extension*.  Suppose you have Python installed like so:
 
    $ spack find python
    ==> 1 installed packages.
-   -- linux-x86_64-debian7 / gcc@4.4.7 --------------------------------
+   -- linux-debian7-x86_64 / gcc@4.4.7 --------------------------------
    python@2.7.8
 
 .. _spack-extensions:
@@ -1509,7 +1487,7 @@ You can find extensions for your Python installation like this:
 .. code-block:: sh
 
    $ spack extensions python
-   ==> python@2.7.8%gcc@4.4.7 arch=linux-x86_64-debian7-703c7a96
+   ==> python@2.7.8%gcc@4.4.7 arch=linux-debian7-x86_64-703c7a96
    ==> 36 extensions:
    geos          py-ipython     py-pexpect    py-pyside            py-sip
    py-basemap    py-libxml2     py-pil        py-pytz              py-six
@@ -1521,7 +1499,7 @@ You can find extensions for your Python installation like this:
    py-h5py       py-numpy       py-pyqt       py-shiboken
 
    ==> 12 installed:
-   -- linux-x86_64-debian7 / gcc@4.4.7 --------------------------------
+   -- linux-debian7-x86_64 / gcc@4.4.7 --------------------------------
    py-dateutil@2.4.0    py-nose@1.3.4       py-pyside@1.2.2
    py-dateutil@2.4.0    py-numpy@1.9.1      py-pytz@2014.10
    py-ipython@2.3.1     py-pygments@2.0.1   py-setuptools@11.3.1
@@ -1537,8 +1515,8 @@ prefixes, and you can see this with ``spack find -p``:
 
    $ spack find -p py-numpy
    ==> 1 installed packages.
-   -- linux-x86_64-debian7 / gcc@4.4.7 --------------------------------
-       py-numpy@1.9.1  /g/g21/gamblin2/src/spack/opt/linux-x86_64-debian7/gcc@4.4.7/py-numpy@1.9.1-66733244
+   -- linux-debian7-x86_64 / gcc@4.4.7 --------------------------------
+       py-numpy@1.9.1  /g/g21/gamblin2/src/spack/opt/linux-debian7-x86_64/gcc@4.4.7/py-numpy@1.9.1-66733244
 
 However, even though this package is installed, you cannot use it
 directly when you run ``python``:
@@ -1599,9 +1577,9 @@ installation:
 .. code-block:: sh
 
    $ spack activate py-numpy
-   ==> Activated extension py-setuptools@11.3.1%gcc@4.4.7 arch=linux-x86_64-debian7-3c74eb69 for python@2.7.8%gcc@4.4.7.
-   ==> Activated extension py-nose@1.3.4%gcc@4.4.7 arch=linux-x86_64-debian7-5f70f816 for python@2.7.8%gcc@4.4.7.
-   ==> Activated extension py-numpy@1.9.1%gcc@4.4.7 arch=linux-x86_64-debian7-66733244 for python@2.7.8%gcc@4.4.7.
+   ==> Activated extension py-setuptools@11.3.1%gcc@4.4.7 arch=linux-debian7-x86_64-3c74eb69 for python@2.7.8%gcc@4.4.7.
+   ==> Activated extension py-nose@1.3.4%gcc@4.4.7 arch=linux-debian7-x86_64-5f70f816 for python@2.7.8%gcc@4.4.7.
+   ==> Activated extension py-numpy@1.9.1%gcc@4.4.7 arch=linux-debian7-x86_64-66733244 for python@2.7.8%gcc@4.4.7.
 
 Several things have happened here.  The user requested that
 ``py-numpy`` be activated in the ``python`` installation it was built
@@ -1616,7 +1594,7 @@ packages listed as activated:
 .. code-block:: sh
 
    $ spack extensions python
-   ==> python@2.7.8%gcc@4.4.7  arch=linux-x86_64-debian7-703c7a96
+   ==> python@2.7.8%gcc@4.4.7  arch=linux-debian7-x86_64-703c7a96
    ==> 36 extensions:
    geos          py-ipython     py-pexpect    py-pyside            py-sip
    py-basemap    py-libxml2     py-pil        py-pytz              py-six
@@ -1628,14 +1606,14 @@ packages listed as activated:
    py-h5py       py-numpy       py-pyqt       py-shiboken
 
    ==> 12 installed:
-   -- linux-x86_64-debian7 / gcc@4.4.7 --------------------------------
+   -- linux-debian7-x86_64 / gcc@4.4.7 --------------------------------
    py-dateutil@2.4.0    py-nose@1.3.4       py-pyside@1.2.2
    py-dateutil@2.4.0    py-numpy@1.9.1      py-pytz@2014.10
    py-ipython@2.3.1     py-pygments@2.0.1   py-setuptools@11.3.1
    py-matplotlib@1.4.2  py-pyparsing@2.0.3  py-six@1.9.0
 
    ==> 3 currently activated:
-   -- linux-x86_64-debian7 / gcc@4.4.7 --------------------------------
+   -- linux-debian7-x86_64 / gcc@4.4.7 --------------------------------
    py-nose@1.3.4  py-numpy@1.9.1  py-setuptools@11.3.1
 
 
@@ -1664,7 +1642,7 @@ dependencies, you can use ``spack activate -f``:
 .. code-block:: sh
 
    $ spack activate -f py-numpy
-   ==> Activated extension py-numpy@1.9.1%gcc@4.4.7 arch=chaos_5_x86_64_ib-66733244 for python@2.7.8%gcc@4.4.7.
+   ==> Activated extension py-numpy@1.9.1%gcc@4.4.7 arch=linux-debian7-x86_64-66733244 for python@2.7.8%gcc@4.4.7.
 
 .. _spack-deactivate:
 
@@ -1736,18 +1714,140 @@ This issue typically manifests with the error below:
 A nicer error message is TBD in future versions of Spack.
 
 
+.. _spack-cray:
+
 Spack on Cray
 -----------------------------
 
-Spack is able to detect compilers through the module avail command. Once it
-detects the compiler it writes the appropriate PrgEnv and compiler module 
-name to compilers.yaml and sets the paths to each compiler with Cray\'s 
-compiler wrapper names ie (cc, CC, ftn). During build time, Spack will
-load the correct PrgEnv and compiler module and will call either cc, CC
-or ftn. If you want to use default compilers for each PrgEnv and also be able
-to link to cray external modules, you will need to set up a packages.yaml 
-:ref:`Exernal Packages`<sec-external packages>
+Spack differs slightly when used on a Cray system. The architecture spec 
+can differentiate between the front-end and back-end processor and operating system.
+For example, on Edison at NERSC, the back-end target processor 
+is \"Ivy Bridge\", so you can specify to use the back-end this way:
+
+.. code-block:: sh
+    
+    spack install zlib target=ivybridge
+
+You can also use the operating system to build against the back-end:
+
+.. code-block:: sh
+    
+    spack install zlib os=CNL10
+
+Notice that the name includes both the operating system name and the major 
+version number concatenated together.
+
+Alternatively, if you want to build something for the front-end, 
+you can specify the front-end target processor. The processor for a login node 
+on Edison is \"Sandy bridge\" so we specify on the command line like so:
+
+.. code-block:: sh
+    
+    spack install zlib target=sandybridge
+
+And the front-end operating system is:
+
+.. code-block:: sh
+    
+    spack install zlib os=SuSE11
+
+
+
+Cray compiler detection
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Spack can detect compilers using two methods. For the front-end, we treat 
+everything the same. The difference lies in back-end compiler detection. 
+Back-end compiler detection is made via the Tcl module avail command. 
+Once it detects the compiler it writes the appropriate PrgEnv and compiler 
+module name to compilers.yaml and sets the paths to each compiler with Cray\'s 
+compiler wrapper names (i.e. cc, CC, ftn). During build time, Spack will load 
+the correct PrgEnv and compiler module and will call appropriate wrapper. 
+
+The compilers.yaml config file will also differ. There is a
+modules section that is filled with the compiler\'s Programming Environment
+and module name. On other systems, this field is empty []::
+
+    ...
+    - compiler:
+        modules:
+          - PrgEnv-intel
+          - intel/15.0.109
+    ...
+
+As mentioned earlier, the compiler paths will look different on a Cray system. 
+Since most compilers are invoked using cc, CC and ftn, the paths for each 
+compiler are replaced with their respective Cray compiler wrapper names::
+
+    ...
+     paths:
+       cc: cc
+       cxx: CC
+       f77: ftn
+       fc: ftn
+    ...
+
+As opposed to an explicit path to the compiler executable. This allows Spack
+to call the Cray compiler wrappers during build time. 
+
+For more on compiler configuration, check out :ref:`compiler-config`.
+
+Setting defaults and using Cray modules
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+If you want to use default compilers for each PrgEnv and also be able
+to load cray external modules, you will need to set up a packages.yaml.
+
+Here\'s an example of an external configuration for cray modules:
+
+.. code-block:: yaml
+
+  packages:
+      mpi:
+        modules:
+            mpich@7.3.1%gcc@5.2.0 arch=cray_xc-haswell-CNL10: cray-mpich
+            mpich@7.3.1%intel@16.0.0.109 arch=cray_xc-haswell-CNL10: cray-mpich
+
+This tells Spack that for whatever package that depends on mpi, load the
+cray-mpich module into the environment. You can then be able to use whatever
+environment variables, libraries, etc, that are brought into the environment
+via module load. 
+
+You can set the default compiler that Spack can use for each compiler type. 
+If you want to use the Cray defaults, then set them under *all:* in packages.yaml. 
+In the compiler field, set the compiler specs in your order of preference. 
+Whenever you build with that compiler type, Spack will concretize to that version.
+
+Here is an example of a full packages.yaml used at NERSC
+
+.. code-block:: yaml
+
+   packages:
+    mpi:
+        modules:
+            mpich@7.3.1%gcc@5.2.0 arch=cray_xc-CNL10-ivybridge: cray-mpich
+            mpich@7.3.1%intel@16.0.0.109 arch=cray_xc-SuSE11-ivybridge: cray-mpich
+        buildable: False
+    netcdf:
+        modules:
+            netcdf@4.3.3.1%gcc@5.2.0 arch=cray_xc-CNL10-ivybridge: cray-netcdf
+            netcdf@4.3.3.1%intel@16.0.0.109 arch=cray_xc-CNL10-ivybridge: cray-netcdf
+        buildable: False
+    hdf5:
+        modules:
+            hdf5@1.8.14%gcc@5.2.0 arch=cray_xc-CNL10-ivybridge: cray-hdf5
+            hdf5@1.8.14%intel@16.0.0.109 arch=cray_xc-CNL10-ivybridge: cray-hdf5
+        buildable: False
+    all:
+        compiler: [gcc@5.2.0, intel@16.0.0.109]
+
+Here we tell spack that whenever we want to build with gcc use version 5.2.0 or
+if we want to build with intel compilers, use version 16.0.0.109. We add a spec
+for each compiler type for each cray modules. This ensures that for each 
+compiler on our system we can use that external module.
+
 
+For more on external packages check out the section :ref:`sec-external_packages`. 
 
 Getting Help
 -----------------------
-- 
cgit v1.2.3-70-g09d2


From 16a4c49f98237193bf1612342e6bcdc1e6cdaf74 Mon Sep 17 00:00:00 2001
From: Mario Melara <maamelara@gmail.com>
Date: Thu, 30 Jun 2016 17:01:18 -0700
Subject: Remove Cray examples of config files

Removed examples of Cray config files and added them under Spack on
Cray. Any users of Cray can just look at the Spack on Cray section to
get an idea of what's used. If they want more information they can click
links to the sections.
---
 lib/spack/docs/configuration.rst | 40 ----------------------------------------
 1 file changed, 40 deletions(-)

diff --git a/lib/spack/docs/configuration.rst b/lib/spack/docs/configuration.rst
index 22eff77655..f2ffa07264 100644
--- a/lib/spack/docs/configuration.rst
+++ b/lib/spack/docs/configuration.rst
@@ -81,17 +81,6 @@ If Spack is asked to build a package that uses one of these MPIs as a
 dependency, it will use the the pre-installed OpenMPI in
 the given directory. Packages.yaml can also be used to specify modules
 
-Here's an example of an external configuration for cray modules:
-
-.. code-block:: yaml
-  packages:
-      mpich:
-        modules:
-            mpich@7.3.1%gcc@5.2.0 arch=cray_xc-haswell-CNL10: cray-mpich
-            mpich@7.3.1%intel@16.0.0.109 arch=cray_xc-haswell-CNL10: cray-mpich
-
-
-
 Each ``packages.yaml`` begins with a ``packages:`` token, followed
 by a list of package names.  To specify externals, add a ``paths`` or ``modules``
 token under the package name, which lists externals in a
@@ -195,35 +184,6 @@ concretization rules.  A provider lists a value that packages may
 ``depend_on`` (e.g, mpi) and a list of rules for fulfilling that
 dependency.
 
-For Cray users, you can specify the default compiler that Spack will
-concretize too. If you want to use the Cray defaults, then set them
-under all: in packages.yaml. You can also specify concretization preferences
-to cray-mpich. Just set the cray-mpich external module as a preferred package,
-set buildable to False and set the preference of mpi to mpich.
-
-Here is an example of a full packages.yaml used at NERSC
-
-.. code-block:: sh
-   packages:
-    mpich:
-        modules:
-            mpich@7.3.1%gcc@5.2.0 arch=cray_xc-CNL10-ivybridge: cray-mpich
-            mpich@7.3.1%intel@16.0.0.109 arch=cray_xc-SuSE11-ivybridge: cray-mpich
-        buildable: False
-    netcdf:
-        modules:
-            netcdf@4.3.3.1%gcc@5.2.0 arch=cray_xc-CNL10-ivybridge: cray-netcdf
-            netcdf@4.3.3.1%intel@16.0.0.109 arch=cray_xc-CNL10-ivybridge: cray-netcdf
-        buildable: False
-    hdf5:
-        paths:
-            hdf5@1.8.14%gcc@5.2.0 arch=cray_xc-CNL10-ivybridge: cray-hdf5
-            hdf5@1.8.14%intel@16.0.0.109 arch=cray_xc-CNL10-ivybridge: cray-hdf5
-        buildable: False
-    all:
-        compiler: [gcc@5.2.0, intel@16.0.0.109]
-        providers:
-            mpi: [mpich, openmpi, intelmpi]ackages:
 
 Profiling
 ------------------
-- 
cgit v1.2.3-70-g09d2


From 56adb5d9a5262c5d2582d4610b2396e0a8053001 Mon Sep 17 00:00:00 2001
From: Mario Melara <maamelara@gmail.com>
Date: Thu, 30 Jun 2016 17:03:07 -0700
Subject: Change arch spec and fix typo

Changed old arch specs to new arch specs. Changed intallation to
installation
---
 lib/spack/docs/packaging_guide.rst | 40 +++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/lib/spack/docs/packaging_guide.rst b/lib/spack/docs/packaging_guide.rst
index 54b886310a..c09e8524b0 100644
--- a/lib/spack/docs/packaging_guide.rst
+++ b/lib/spack/docs/packaging_guide.rst
@@ -1625,21 +1625,21 @@ the user runs ``spack install`` and the time the ``install()`` method
 is called.  The concretized version of the spec above might look like
 this::
 
-   mpileaks@2.3%gcc@4.7.3 arch=linux-ppc64
-       ^callpath@1.0%gcc@4.7.3+debug arch=linux-ppc64
-           ^dyninst@8.1.2%gcc@4.7.3 arch=linux-ppc64
-               ^libdwarf@20130729%gcc@4.7.3 arch=linux-ppc64
-                   ^libelf@0.8.11%gcc@4.7.3 arch=linux-ppc64
-           ^mpich@3.0.4%gcc@4.7.3 arch=linux-ppc64
+   mpileaks@2.3%gcc@4.7.3 arch=linux-debian7-x86_64
+       ^callpath@1.0%gcc@4.7.3+debug arch=linux-debian7-x86_64
+           ^dyninst@8.1.2%gcc@4.7.3 arch=linux-debian7-x86_64
+               ^libdwarf@20130729%gcc@4.7.3 arch=linux-debian7-x86_64
+                   ^libelf@0.8.11%gcc@4.7.3 arch=linux-debian7-x86_64
+           ^mpich@3.0.4%gcc@4.7.3 arch=linux-debian7-x86_64
 
 .. graphviz::
 
    digraph {
-       "mpileaks@2.3\n%gcc@4.7.3\n arch=linux-ppc64" -> "mpich@3.0.4\n%gcc@4.7.3\n arch=linux-ppc64"
-       "mpileaks@2.3\n%gcc@4.7.3\n arch=linux-ppc64" -> "callpath@1.0\n%gcc@4.7.3+debug\n arch=linux-ppc64" -> "mpich@3.0.4\n%gcc@4.7.3\n arch=linux-ppc64"
-       "callpath@1.0\n%gcc@4.7.3+debug\n arch=linux-ppc64" -> "dyninst@8.1.2\n%gcc@4.7.3\n arch=linux-ppc64"
-       "dyninst@8.1.2\n%gcc@4.7.3\n arch=linux-ppc64" -> "libdwarf@20130729\n%gcc@4.7.3\n arch=linux-ppc64" -> "libelf@0.8.11\n%gcc@4.7.3\n arch=linux-ppc64"
-       "dyninst@8.1.2\n%gcc@4.7.3\n arch=linux-ppc64" -> "libelf@0.8.11\n%gcc@4.7.3\n arch=linux-ppc64"
+       "mpileaks@2.3\n%gcc@4.7.3\n arch=linux-debian7-x86_64" -> "mpich@3.0.4\n%gcc@4.7.3\n arch=linux-debian7-x86_64"
+       "mpileaks@2.3\n%gcc@4.7.3\n arch=linux-debian7-x86_64" -> "callpath@1.0\n%gcc@4.7.3+debug\n arch=linux-debian7-x86_64" -> "mpich@3.0.4\n%gcc@4.7.3\n arch=linux-debian7-x86_64"
+       "callpath@1.0\n%gcc@4.7.3+debug\n arch=linux-debian7-x86_64" -> "dyninst@8.1.2\n%gcc@4.7.3\n arch=linux-debian7-x86_64"
+       "dyninst@8.1.2\n%gcc@4.7.3\n arch=linux-debian7-x86_64" -> "libdwarf@20130729\n%gcc@4.7.3\n arch=linux-debian7-x86_64" -> "libelf@0.8.11\n%gcc@4.7.3\n arch=linux-debian7-x86_64"
+       "dyninst@8.1.2\n%gcc@4.7.3\n arch=linux-debian7-x86_64" -> "libelf@0.8.11\n%gcc@4.7.3\n arch=linux-debian7-x86_64"
    }
 
 Here, all versions, compilers, and platforms are filled in, and there
@@ -1668,9 +1668,9 @@ running ``spack spec``.  For example:
        ^libdwarf
            ^libelf
 
-   dyninst@8.0.1%gcc@4.7.3 arch=linux-ppc64
-       ^libdwarf@20130729%gcc@4.7.3 arch=linux-ppc64
-           ^libelf@0.8.13%gcc@4.7.3 arch=linux-ppc64
+   dyninst@8.0.1%gcc@4.7.3 arch=linux-debian7-x86_64
+       ^libdwarf@20130729%gcc@4.7.3 arch=linux-debian7-x86_64
+           ^libelf@0.8.13%gcc@4.7.3 arch=linux-debian7-x86_64
 
 This is useful when you want to know exactly what Spack will do when
 you ask for a particular spec.
@@ -2175,12 +2175,12 @@ example:
        def install(self, prefix):
            # Do default install
 
-       @when('arch=chaos_5_x86_64_ib')
+       @when('arch=linux-debian7-x86_64')
        def install(self, prefix):
            # This will be executed instead of the default install if
            # the package's sys_type() is chaos_5_x86_64_ib.
 
-       @when('arch=bgqos_0")
+       @when('arch=linux-debian7-x86_64")
        def install(self, prefix):
            # This will be executed if the package's sys_type is bgqos_0
 
@@ -2308,7 +2308,7 @@ build system.
 
 .. _sanity-checks:
 
-Sanity checking an intallation
+Sanity checking an installation
 --------------------------------
 
 By default, Spack assumes that a build has failed if nothing is
@@ -2770,11 +2770,11 @@ build it:
    $ spack stage libelf
    ==> Trying to fetch from http://www.mr511.de/software/libelf-0.8.13.tar.gz
    ######################################################################## 100.0%
-   ==> Staging archive: /Users/gamblin2/src/spack/var/spack/stage/libelf@0.8.13%gcc@4.8.3 arch=linux-ppc64/libelf-0.8.13.tar.gz
-   ==> Created stage in /Users/gamblin2/src/spack/var/spack/stage/libelf@0.8.13%gcc@4.8.3 arch=linux-ppc64.
+   ==> Staging archive: /Users/gamblin2/src/spack/var/spack/stage/libelf@0.8.13%gcc@4.8.3 arch=linux-debian7-x86_64/libelf-0.8.13.tar.gz
+   ==> Created stage in /Users/gamblin2/src/spack/var/spack/stage/libelf@0.8.13%gcc@4.8.3 arch=linux-debian7-x86_64.
    $ spack cd libelf
    $ pwd
-   /Users/gamblin2/src/spack/var/spack/stage/libelf@0.8.13%gcc@4.8.3 arch=linux-ppc64/libelf-0.8.13
+   /Users/gamblin2/src/spack/var/spack/stage/libelf@0.8.13%gcc@4.8.3 arch=linux-debian7-x86_64/libelf-0.8.13
 
 ``spack cd`` here changed he current working directory to the
 directory containing the expanded ``libelf`` source code.  There are a
-- 
cgit v1.2.3-70-g09d2


From 31e9ded768b56d076eb452b56d1b5c94ac341761 Mon Sep 17 00:00:00 2001
From: Glenn Johnson <glenn-johnson@uiowa.edu>
Date: Fri, 1 Jul 2016 20:59:14 -0500
Subject: Remove more variables from build environment

Remove the LIBRARY_PATH and CPATH environment variables before building
a package.
---
 lib/spack/spack/build_environment.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py
index 99c4cae020..7220539886 100644
--- a/lib/spack/spack/build_environment.py
+++ b/lib/spack/spack/build_environment.py
@@ -266,6 +266,8 @@ def set_build_environment_variables(pkg, env):
     # can affect how some packages find libraries.  We want to make
     # sure that builds never pull in unintended external dependencies.
     env.unset('LD_LIBRARY_PATH')
+    env.unset('LIBRARY_PATH')
+    env.unset('CPATH')
     env.unset('LD_RUN_PATH')
     env.unset('DYLD_LIBRARY_PATH')
 
-- 
cgit v1.2.3-70-g09d2


From 729f23b43282d971365d66402fe0df67c4bd37a2 Mon Sep 17 00:00:00 2001
From: Glenn Johnson <glenn-johnson@uiowa.edu>
Date: Fri, 1 Jul 2016 22:13:40 -0500
Subject: Use Executable to set script

Use `Executable("./install.sh")` to set `install_script`. This allows it
to work when the current directory is not on the PATH.
---
 var/spack/repos/builtin/packages/intel/package.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/var/spack/repos/builtin/packages/intel/package.py b/var/spack/repos/builtin/packages/intel/package.py
index ec3192380a..56d9fabddf 100644
--- a/var/spack/repos/builtin/packages/intel/package.py
+++ b/var/spack/repos/builtin/packages/intel/package.py
@@ -73,7 +73,7 @@ CONTINUE_WITH_OPTIONAL_ERROR=yes
 COMPONENTS=%s
 """ % (self.intel_prefix, self.global_license_file, self.intel_components))
 
-        install_script = which("install.sh")
+        install_script = Executable("./install.sh")
         install_script('--silent', silent_config_filename)
 
 
-- 
cgit v1.2.3-70-g09d2


From 3e8391458c88c4a0ccb630769700d20133657437 Mon Sep 17 00:00:00 2001
From: alalazo <massimiliano.culpo@googlemail.com>
Date: Mon, 4 Jul 2016 09:58:15 +0200
Subject: openssl : changed tag for system reserved versions fixes #1150

---
 var/spack/repos/builtin/packages/openssl/package.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/var/spack/repos/builtin/packages/openssl/package.py b/var/spack/repos/builtin/packages/openssl/package.py
index 377bffe723..b0b03503d7 100644
--- a/var/spack/repos/builtin/packages/openssl/package.py
+++ b/var/spack/repos/builtin/packages/openssl/package.py
@@ -57,11 +57,11 @@ class Openssl(Package):
         # Same idea, but just to avoid issuing the same message multiple times
         warnings_given_to_user = getattr(Openssl, '_warnings_given', {})
         if openssl_url is None:
-            if self.spec.satisfies('@external'):
-                # The version @external is reserved to system openssl. In that case return a fake url and exit
-                openssl_url = '@external (reserved version for system openssl)'
+            if self.spec.satisfies('@system'):
+                # The version @system is reserved to system openssl. In that case return a fake url and exit
+                openssl_url = '@system (reserved version for system openssl)'
                 if not warnings_given_to_user.get(version, False):
-                    tty.msg('Using openssl@external : the version @external is reserved for system openssl')
+                    tty.msg('Using openssl@system : the version @system is reserved for system openssl')
                     warnings_given_to_user[version] = True
             else:
                 openssl_url = self.check_for_outdated_release(version, warnings_given_to_user)  # Store the computed URL
-- 
cgit v1.2.3-70-g09d2


From 861f174f66b908aac2ac2d0245de8ef874cea00f Mon Sep 17 00:00:00 2001
From: alalazo <massimiliano.culpo@googlemail.com>
Date: Mon, 4 Jul 2016 10:03:46 +0200
Subject: qa : fixed flake8 issues

---
 .../repos/builtin/packages/openssl/package.py      | 36 ++++++++++++----------
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/var/spack/repos/builtin/packages/openssl/package.py b/var/spack/repos/builtin/packages/openssl/package.py
index b0b03503d7..a0747f229d 100644
--- a/var/spack/repos/builtin/packages/openssl/package.py
+++ b/var/spack/repos/builtin/packages/openssl/package.py
@@ -35,7 +35,7 @@ class Openssl(Package):
        Transport Layer Security (TLS v1) protocols as well as a
        full-strength general purpose cryptography library."""
     homepage = "http://www.openssl.org"
-    url      = "https://www.openssl.org/source/openssl-1.0.1h.tar.gz"
+    url = "https://www.openssl.org/source/openssl-1.0.1h.tar.gz"
 
     version('1.0.1h', '8d6d684a9430d5cc98a62a5d8fbda8cf')
     version('1.0.1r', '1abd905e079542ccae948af37e393d28')
@@ -50,21 +50,24 @@ class Openssl(Package):
     parallel = False
 
     def url_for_version(self, version):
-        # This URL is computed pinging the place where the latest version is stored. To avoid slowdown
-        # due to repeated pinging, we store the URL in a private class attribute to do the job only once per version
+        # This URL is computed pinging the place where the latest version is
+        # stored. To avoid slowdown due to repeated pinging, we store the URL
+        # in a private class attribute to do the job only once per version
         openssl_urls = getattr(Openssl, '_openssl_url', {})
         openssl_url = openssl_urls.get(version, None)
         # Same idea, but just to avoid issuing the same message multiple times
         warnings_given_to_user = getattr(Openssl, '_warnings_given', {})
         if openssl_url is None:
             if self.spec.satisfies('@system'):
-                # The version @system is reserved to system openssl. In that case return a fake url and exit
+                # The version @system is reserved to system openssl. In that
+                # case return a fake url and exit
                 openssl_url = '@system (reserved version for system openssl)'
                 if not warnings_given_to_user.get(version, False):
-                    tty.msg('Using openssl@system : the version @system is reserved for system openssl')
+                    tty.msg('Using openssl@system : the version @system is reserved for system openssl')  # NOQA: ignore=E501
                     warnings_given_to_user[version] = True
             else:
-                openssl_url = self.check_for_outdated_release(version, warnings_given_to_user)  # Store the computed URL
+                openssl_url = self.check_for_outdated_release(
+                    version, warnings_given_to_user)  # Store the computed URL
             openssl_urls[version] = openssl_url
             # Store the updated dictionary of URLS
             Openssl._openssl_url = openssl_urls
@@ -75,22 +78,23 @@ class Openssl(Package):
 
     def check_for_outdated_release(self, version, warnings_given_to_user):
         latest = 'ftp://ftp.openssl.org/source/openssl-{version}.tar.gz'
-        older = 'http://www.openssl.org/source/old/{version_number}/openssl-{version_full}.tar.gz'
-        # Try to use the url where the latest tarballs are stored. If the url does not exist (404), then
-        # return the url for older format
+        older = 'http://www.openssl.org/source/old/{version_number}/openssl-{version_full}.tar.gz'  # NOQA: ignore=E501
+        # Try to use the url where the latest tarballs are stored.
+        # If the url does not exist (404), then return the url for
+        # older format
         version_number = '.'.join([str(x) for x in version[:-1]])
         try:
             openssl_url = latest.format(version=version)
             urllib.urlopen(openssl_url)
         except IOError:
-            openssl_url = older.format(version_number=version_number, version_full=version)
-            # Checks if we already warned the user for this particular version of OpenSSL.
-            # If not we display a warning message and mark this version
+            openssl_url = older.format(version_number=version_number, version_full=version)  # NOQA:ignore=E501
+            # Checks if we already warned the user for this particular
+            # version of OpenSSL. If not we display a warning message
+            # and mark this version
             if not warnings_given_to_user.get(version, False):
-                tty.warn(
-                    'This installation depends on an old version of OpenSSL, which may have known security issues. ')
-                tty.warn('Consider updating to the latest version of this package.')
-                tty.warn('More details at {homepage}'.format(homepage=Openssl.homepage))
+                tty.warn('This installation depends on an old version of OpenSSL, which may have known security issues. ')    # NOQA: ignore=E501
+                tty.warn('Consider updating to the latest version of this package.')  # NOQA: ignore=E501
+                tty.warn('More details at {homepage}'.format(homepage=Openssl.homepage))   # NOQA: ignore=E501
                 warnings_given_to_user[version] = True
 
         return openssl_url
-- 
cgit v1.2.3-70-g09d2


From 85982017b605f2c21bbe01149a92e512b8be27f7 Mon Sep 17 00:00:00 2001
From: Nicolas <nrichart@users.noreply.github.com>
Date: Mon, 4 Jul 2016 18:19:09 +0200
Subject: Revert "Corrected the shared libraries and tests in mumps package"

---
 .../builtin/packages/mumps/mumps-shared.patch      | 119 ---------------
 var/spack/repos/builtin/packages/mumps/package.py  | 168 +++++++++------------
 2 files changed, 73 insertions(+), 214 deletions(-)
 delete mode 100644 var/spack/repos/builtin/packages/mumps/mumps-shared.patch

diff --git a/var/spack/repos/builtin/packages/mumps/mumps-shared.patch b/var/spack/repos/builtin/packages/mumps/mumps-shared.patch
deleted file mode 100644
index 592f48037c..0000000000
--- a/var/spack/repos/builtin/packages/mumps/mumps-shared.patch
+++ /dev/null
@@ -1,119 +0,0 @@
-diff -Naur MUMPS_5.0.1/libseq/Makefile MUMPS_5.0.1.new/libseq/Makefile
---- MUMPS_5.0.1/libseq/Makefile	2015-07-23 19:08:32.000000000 +0200
-+++ MUMPS_5.0.1.new/libseq/Makefile	2016-06-07 10:41:16.585179151 +0200
-@@ -8,11 +8,15 @@
- 
- include ../Makefile.inc
- 
--libmpiseq: libmpiseq$(PLAT)$(LIBEXT)
-+libmpiseq: libmpiseq$(PLAT)$(LIBEXT) libmpiseq$(PLAT)$(SHLIBEXT)
- 
- libmpiseq$(PLAT)$(LIBEXT): mpi.o mpic.o elapse.o
- 	$(AR)$@ mpi.o mpic.o elapse.o
- 	$(RANLIB) $@
-+
-+libmpiseq$(PLAT)$(SHLIBEXT): mpi.o mpic.o elapse.o
-+	$(FC) $(LDFLAGS) $^ -o libmpiseq$(PLAT)$(SHLIBEXT)
-+
- .f.o:
- 	$(FC) $(OPTF)              -c $*.f $(OUTF)$*.o
- .c.o:
-diff -Naur MUMPS_5.0.1/Makefile MUMPS_5.0.1.new/Makefile
---- MUMPS_5.0.1/Makefile	2015-07-23 19:08:29.000000000 +0200
-+++ MUMPS_5.0.1.new/Makefile	2016-06-07 10:50:21.863281217 +0200
-@@ -51,7 +51,7 @@
- dexamples:	d
- 	(cd examples ; $(MAKE) d)
- 
--requiredobj: Makefile.inc $(LIBSEQNEEDED) $(libdir)/libpord$(PLAT)$(LIBEXT)
-+requiredobj: Makefile.inc $(LIBSEQNEEDED) $(libdir)/libpord$(PLAT)$(LIBEXT) $(libdir)/libpord$(PLAT)$(SHLIBEXT)
- 
- # dummy MPI library (sequential version)
- 
-@@ -62,16 +62,25 @@
- $(libdir)/libpord$(PLAT)$(LIBEXT):
- 	if [ "$(LPORDDIR)" != "" ] ; then \
- 	  cd $(LPORDDIR); \
--	  $(MAKE) CC="$(CC)" CFLAGS="$(OPTC)" AR="$(AR)" RANLIB="$(RANLIB)" OUTC="$(OUTC)" LIBEXT=$(LIBEXT); \
-+	  $(MAKE) CC="$(CC)" CFLAGS="$(OPTC)" AR="$(AR)" RANLIB="$(RANLIB)" LDFLAGS="$(LDFLAGS)" OUTC="$(OUTC)" LIBEXT=$(LIBEXT) PLAT=$(PLAT) SHLIBEXT=$(SHLIBEXT); \
- 	fi;
- 	if [ "$(LPORDDIR)" != "" ] ; then \
- 	  cp $(LPORDDIR)/libpord$(LIBEXT) $@; \
- 	fi;
- 
-+$(libdir)/libpord$(PLAT)$(SHLIBEXT):
-+	if [ "$(LPORDDIR)" != "" ] ; then \
-+	  cd $(LPORDDIR); \
-+	  $(MAKE) CC="$(CC)" CFLAGS="$(OPTC)" AR="$(AR)" RANLIB="$(RANLIB)" LDFLAGS="$(LDFLAGS)" OUTC="$(OUTC)" LIBEXT=$(LIBEXT) PLAT=$(PLAT) SHLIBEXT=$(SHLIBEXT) libpord$(PLAT)$(SHLIBEXT); \
-+	fi;
-+	if [ "$(LPORDDIR)" != "" ] ; then \
-+	  cp $(LPORDDIR)/libpord$(PLAT)$(SHLIBEXT) $@; \
-+	fi;
-+
- clean:
- 	(cd src; $(MAKE) clean)
- 	(cd examples; $(MAKE) clean)
--	(cd $(libdir); $(RM) *$(PLAT)$(LIBEXT))
-+	(cd $(libdir); $(RM) *$(PLAT)$(LIBEXT) *$(PLAT)$(SHLIBEXT))
- 	(cd libseq; $(MAKE) clean)
- 	if [ "$(LPORDDIR)" != "" ] ; then \
- 	  cd $(LPORDDIR); $(MAKE) realclean; \
-diff -Naur MUMPS_5.0.1/PORD/lib/Makefile MUMPS_5.0.1.new/PORD/lib/Makefile
---- MUMPS_5.0.1/PORD/lib/Makefile	2015-07-23 19:08:29.000000000 +0200
-+++ MUMPS_5.0.1.new/PORD/lib/Makefile	2016-06-07 10:49:48.889000958 +0200
-@@ -13,7 +13,7 @@
- 
- OBJS = graph.o gbipart.o gbisect.o ddcreate.o ddbisect.o nestdiss.o \
-        multisector.o gelim.o bucket.o tree.o \
--       symbfac.o interface.o sort.o minpriority.o 
-+       symbfac.o interface.o sort.o minpriority.o
- 
- # Note: numfac.c read.c mapping.c triangular.c matrix.c kernel.c
- # were not direcly used by MUMPS and have been removed from the
-@@ -24,12 +24,15 @@
- .c.o:
- 	$(CC) $(COPTIONS) -c $*.c $(OUTC)$*.o
- 
--libpord$(LIBEXT):$(OBJS)
-+libpord$(PLAT)$(LIBEXT):$(OBJS)
- 	$(AR)$@ $(OBJS)
- 	$(RANLIB) $@
- 
-+libpord$(PLAT)$(SHLIBEXT): $(OBJS)
-+	$(CC) $(LDFLAGS) $(OBJS) -o libpord$(PLAT)$(SHLIBEXT)
-+
- clean:
- 	rm -f *.o
- 
- realclean:
--	rm -f *.o libpord.a
-+	rm -f *.o libpord$(PLAT)$(SHLIBEXT) libpord$(PLAT)$(LIBEXT)
-diff -Naur MUMPS_5.0.1/src/Makefile MUMPS_5.0.1.new/src/Makefile
---- MUMPS_5.0.1/src/Makefile	2015-07-23 19:08:29.000000000 +0200
-+++ MUMPS_5.0.1.new/src/Makefile	2016-06-07 10:40:52.534703722 +0200
-@@ -24,7 +24,10 @@
- include $(topdir)/Makefile.inc
- 
- mumps_lib:    $(libdir)/libmumps_common$(PLAT)$(LIBEXT) \
--              $(libdir)/lib$(ARITH)mumps$(PLAT)$(LIBEXT)
-+              $(libdir)/libmumps_common$(PLAT)$(SHLIBEXT) \
-+              $(libdir)/lib$(ARITH)mumps$(PLAT)$(LIBEXT) \
-+              $(libdir)/lib$(ARITH)mumps$(PLAT)$(SHLIBEXT)
-+
- 
- OBJS_COMMON_MOD = \
-         ana_omp_m.o\
-@@ -162,6 +165,13 @@
- 	$(AR)$@ $?
- 	$(RANLIB) $@
- 
-+$(libdir)/libmumps_common$(PLAT)$(SHLIBEXT):	$(OBJS_COMMON_MOD) $(OBJS_COMMON_OTHER)
-+	$(FC) $(LDFLAGS) $^ -L$(libdir) $(LORDERINGS) $(LIBS) $(LIBBLAS) $(LIBOTHERS) -o $(libdir)/libmumps_common$(PLAT)$(SHLIBEXT)
-+
-+
-+$(libdir)/lib$(ARITH)mumps$(PLAT)$(SHLIBEXT):    $(OBJS_MOD) $(OBJS_OTHER)
-+	$(FC) $(LDFLAGS) $^ -L$(libdir) -lmumps_common$(PLAT) $(LORDERINGS) $(LIBS) $(LIBBLAS) $(LIBOTHERS) -o $(libdir)/lib$(ARITH)mumps$(PLAT)$(SHLIBEXT)
-+
- # Dependencies between modules:
- $(ARITH)mumps_load.o:		$(ARITH)mumps_comm_buffer.o \
- 				$(ARITH)mumps_struc_def.o \
diff --git a/var/spack/repos/builtin/packages/mumps/package.py b/var/spack/repos/builtin/packages/mumps/package.py
index 8a90ef72d0..92c45c9b95 100644
--- a/var/spack/repos/builtin/packages/mumps/package.py
+++ b/var/spack/repos/builtin/packages/mumps/package.py
@@ -23,10 +23,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 ##############################################################################
 from spack import *
-import os
-import sys
-import subprocess
-
+import os, sys, glob
 
 class Mumps(Package):
     """MUMPS: a MUltifrontal Massively Parallel sparse direct Solver"""
@@ -47,6 +44,7 @@ class Mumps(Package):
     variant('idx64', default=False, description='Use int64_t/integer*8 as default index type')
     variant('shared', default=True, description='Build shared libraries')
 
+
     depends_on('scotch + esmumps', when='~ptscotch+scotch')
     depends_on('scotch + esmumps + mpi', when='+ptscotch')
     depends_on('metis@5:', when='+metis')
@@ -56,64 +54,49 @@ class Mumps(Package):
     depends_on('scalapack', when='+mpi')
     depends_on('mpi', when='+mpi')
 
-    patch('mumps-shared.patch', when='+shared')
-
     # this function is not a patch function because in case scalapack
     # is needed it uses self.spec['scalapack'].fc_link set by the
     # setup_dependent_environment in scalapck. This happen after patch
     # end before install
     # def patch(self):
     def write_makefile_inc(self):
-        if (('+parmetis' in self.spec or
-             '+ptscotch' in self.spec)) and '+mpi' not in self.spec:
-            raise RuntimeError('You cannot use the variants parmetis or ptscotch without mpi')  # NOQA: E501
+        if ('+parmetis' in self.spec or '+ptscotch' in self.spec) and '+mpi' not in self.spec:
+            raise RuntimeError('You cannot use the variants parmetis or ptscotch without mpi')
 
-        makefile_conf = [
-            "LIBBLAS = -L%s -lblas" % self.spec['blas'].prefix.lib
-        ]
+        makefile_conf = ["LIBBLAS = -L%s -lblas" % self.spec['blas'].prefix.lib]
 
         orderings = ['-Dpord']
 
         if '+ptscotch' in self.spec or '+scotch' in self.spec:
             join_lib = ' -l%s' % ('pt' if '+ptscotch' in self.spec else '')
-            makefile_conf.extend([
-                "ISCOTCH = -I%s" % self.spec['scotch'].prefix.include,
-                "LSCOTCH = -L%s %s%s" % (self.spec['scotch'].prefix.lib,
-                                         join_lib,
-                                         join_lib.join(['esmumps',
-                                                        'scotch',
-                                                        'scotcherr']))
-            ])
+            makefile_conf.extend(
+                ["ISCOTCH = -I%s" % self.spec['scotch'].prefix.include,
+                 "LSCOTCH = -L%s %s%s" % (self.spec['scotch'].prefix.lib,
+                                          join_lib,
+                                          join_lib.join(['esmumps', 'scotch', 'scotcherr']))])
             orderings.append('-Dscotch')
             if '+ptscotch' in self.spec:
                 orderings.append('-Dptscotch')
 
         if '+parmetis' in self.spec and '+metis' in self.spec:
-            makefile_conf.extend([
-                "IMETIS = -I%s" % self.spec['parmetis'].prefix.include,
-                "LMETIS = -L%s -l%s -L%s -l%s" % (
-                    self.spec['parmetis'].prefix.lib, 'parmetis',
-                    self.spec['metis'].prefix.lib, 'metis')
-            ])
+            libname = 'parmetis' if '+parmetis' in self.spec else 'metis'
+            makefile_conf.extend(
+                ["IMETIS = -I%s" % self.spec['parmetis'].prefix.include,
+                 "LMETIS = -L%s -l%s -L%s -l%s" % (self.spec['parmetis'].prefix.lib, 'parmetis',self.spec['metis'].prefix.lib, 'metis')])
 
             orderings.append('-Dparmetis')
         elif '+metis' in self.spec:
-            makefile_conf.extend([
-                "IMETIS = -I%s" % self.spec['metis'].prefix.include,
-                "LMETIS = -L%s -l%s" % (self.spec['metis'].prefix.lib,
-                                        'metis')
-            ])
+            makefile_conf.extend(
+                ["IMETIS = -I%s" % self.spec['metis'].prefix.include,
+                 "LMETIS = -L%s -l%s" % (self.spec['metis'].prefix.lib, 'metis')])
 
             orderings.append('-Dmetis')
 
         makefile_conf.append("ORDERINGSF = %s" % (' '.join(orderings)))
 
-        # when building shared libs need -fPIC, otherwise /usr/bin/ld:
-        # graph.o: relocation R_X86_64_32 against `.rodata.str1.1' can
-        # not be used when making a shared object; recompile with
-        # -fPIC
+        # when building shared libs need -fPIC, otherwise
+        # /usr/bin/ld: graph.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
         fpic = '-fPIC' if '+shared' in self.spec else ''
-
         # TODO: test this part, it needs a full blas, scalapack and
         # partitionning environment with 64bit integers
         if '+idx64' in self.spec:
@@ -121,7 +104,7 @@ class Mumps(Package):
                 # the fortran compilation flags most probably are
                 # working only for intel and gnu compilers this is
                 # perhaps something the compiler should provide
-                ['OPTF    = %s -O  -DALLOW_NON_INIT %s' % (fpic, '-fdefault-integer-8' if self.compiler.name == "gcc" else '-i8'),  # NOQA: E501
+                ['OPTF    = %s -O  -DALLOW_NON_INIT %s' % (fpic,'-fdefault-integer-8' if self.compiler.name == "gcc" else '-i8'),
                  'OPTL    = %s -O ' % fpic,
                  'OPTC    = %s -O -DINTSIZE64' % fpic])
         else:
@@ -130,47 +113,49 @@ class Mumps(Package):
                  'OPTL    = %s -O ' % fpic,
                  'OPTC    = %s -O ' % fpic])
 
+
         if '+mpi' in self.spec:
             makefile_conf.extend(
-                ["CC = %s" % self.spec['mpi'].mpicc,
-                 "FC = %s" % self.spec['mpi'].mpifc,
+                ["CC = %s" % join_path(self.spec['mpi'].prefix.bin, 'mpicc'),
+                 "FC = %s" % join_path(self.spec['mpi'].prefix.bin, 'mpif90'),
+                 "FL = %s" % join_path(self.spec['mpi'].prefix.bin, 'mpif90'),
                  "SCALAP = %s" % self.spec['scalapack'].fc_link,
                  "MUMPS_TYPE = par"])
         else:
             makefile_conf.extend(
                 ["CC = cc",
                  "FC = fc",
+                 "FL = fc",
                  "MUMPS_TYPE = seq"])
 
         # TODO: change the value to the correct one according to the
         # compiler possible values are -DAdd_, -DAdd__ and/or -DUPPER
-        makefile_conf.extend([
-            'CDEFS   = -DAdd_',
-            'FL = $(FC)',
-        ])
+        makefile_conf.append("CDEFS   = -DAdd_")
 
         if '+shared' in self.spec:
-            makefile_conf.append('SHLIBEXT = .%s' % dso_suffix)
             if sys.platform == 'darwin':
-                makefile_conf.append(
-                    'LDFLAGS = -dynamiclib -Wl,-install_name -Wl,{0}/$(notdir $@) {1}{0} -undefined dynamic_lookup'.format(prefix.lib, self.compiler.fc_rpath_arg)  # NOQA: E501
-                )
+                # Building dylibs with mpif90 causes segfaults on 10.8 and 10.10. Use gfortran. (Homebrew)
+                makefile_conf.extend([
+                    'LIBEXT=.dylib',
+                    'AR=%s -dynamiclib -Wl,-install_name -Wl,%s/$(notdir $@) -undefined dynamic_lookup -o ' % (os.environ['FC'],prefix.lib),
+                    'RANLIB=echo'
+                ])
             else:
-                makefile_conf.append(
-                    'LDFLAGS = -shared {0}{1}'.format(
-                        self.compiler.fc_rpath_arg,
-                        prefix.lib)
-                )
-
-        makefile_conf.extend([
-            'LIBEXT  = .a',
-            'AR = ar vr ',
-            'RANLIB = ranlib'
-        ])
-
-        makefile_inc_template = \
-            join_path(os.path.dirname(self.module.__file__),
-                      'Makefile.inc')
+                makefile_conf.extend([
+                    'LIBEXT=.so',
+                    'AR=$(FL) -shared -Wl,-soname -Wl,%s/$(notdir $@) -o' % prefix.lib,
+                    'RANLIB=echo'
+                ])
+        else:
+            makefile_conf.extend([
+                'LIBEXT  = .a',
+                'AR = ar vr',
+                'RANLIB = ranlib'
+            ])
+
+
+        makefile_inc_template = join_path(os.path.dirname(self.module.__file__),
+                                          'Makefile.inc')
         with open(makefile_inc_template, "r") as fh:
             makefile_conf.extend(fh.read().split('\n'))
 
@@ -179,53 +164,46 @@ class Mumps(Package):
                 makefile_inc = '\n'.join(makefile_conf)
                 fh.write(makefile_inc)
 
+
+
     def install(self, spec, prefix):
         make_libs = []
 
         # the choice to compile ?examples is to have kind of a sanity
         # check on the libraries generated.
         if '+float' in spec:
-            make_libs.append('s')
+            make_libs.append('sexamples')
             if '+complex' in spec:
-                make_libs.append('c')
+                make_libs.append('cexamples')
 
         if '+double' in spec:
-            make_libs.append('d')
+            make_libs.append('dexamples')
             if '+complex' in spec:
-                make_libs.append('z')
+                make_libs.append('zexamples')
 
         self.write_makefile_inc()
 
-        make('mumps_lib', parallel=False)
-        make(*make_libs)
+        # Build fails in parallel
+        make(*make_libs, parallel=False)
 
         install_tree('lib', prefix.lib)
         install_tree('include', prefix.include)
 
-        if '~mpi' in spec:
-            install('libseq/libmpiseq.a', prefix.lib)
-            if '+shared' in spec:
-                install('libseq/libmpiseq.{0}'.format(dso_suffix), prefix.lib)
-            install('libseq/mpi.h', prefix.include)
-            install('libseq/mpif.h', prefix.include)
-
-        # FIXME: extend the tests to mpirun -np 2 (or alike) when
-        # build with MPI
-        # FIXME: use something like numdiff to compare blessed output
-        # with the current
-        # TODO: test the installed mumps and not the one in stage
-        if '~mpi' in spec:
-            for t in make_libs:
-                make('{0}examples'.format(t))
-
-            with working_dir('examples'):
-                for t in make_libs:
-                    input_file = 'input_simpletest_{0}'.format(
-                        'real' if t in ['s', 'd'] else 'cmplx')
-                    with open(input_file) as input:
-                        test = './{0}simpletest'.format(t)
-                        ret = subprocess.call(test,
-                                              stdin=input)
-                        if ret is not 0:
-                            raise RuntimeError(
-                                'The test {0} did not pass'.format(test))
+        if '~mpi' in spec:            
+            lib_dsuffix = '.dylib' if sys.platform == 'darwin' else '.so'
+            lib_suffix = lib_dsuffix if '+shared' in spec else '.a'
+            install('libseq/libmpiseq%s' % lib_suffix, prefix.lib)
+            for f in glob.glob(join_path('libseq','*.h')):
+                install(f, prefix.include)
+
+        # FIXME: extend the tests to mpirun -np 2 (or alike) when build with MPI
+        # FIXME: use something like numdiff to compare blessed output with the current
+        with working_dir('examples'):
+            if '+float' in spec:
+                os.system('./ssimpletest < input_simpletest_real')
+                if '+complex' in spec:
+                    os.system('./csimpletest < input_simpletest_real')
+            if '+double' in spec:
+                os.system('./dsimpletest < input_simpletest_real')
+                if '+complex' in spec:
+                    os.system('./zsimpletest < input_simpletest_cmplx')
-- 
cgit v1.2.3-70-g09d2


From 53bbbfbe21e795d3400f89e677ebc4edf33b07d4 Mon Sep 17 00:00:00 2001
From: "Robert D. French" <robert@robertdfrench.me>
Date: Mon, 4 Jul 2016 13:18:42 -0400
Subject: Require libffi, zlib; Make Openssl, readline optional

---
 var/spack/repos/builtin/packages/ruby/package.py | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/var/spack/repos/builtin/packages/ruby/package.py b/var/spack/repos/builtin/packages/ruby/package.py
index dd71913fc9..8dc314c171 100644
--- a/var/spack/repos/builtin/packages/ruby/package.py
+++ b/var/spack/repos/builtin/packages/ruby/package.py
@@ -35,9 +35,20 @@ class Ruby(Package):
     extendable = True
 
     version('2.2.0', 'cd03b28fd0b555970f5c4fd481700852')
+    depends_on('libffi')
+    depends_on('zlib')
+    variant('openssl', default=False, description="Enable OpenSSL support")
+    depends_on('openssl', when='+openssl')
+    variant('readline', default=False, description="Enable Readline support")
+    depends_on('readline', when='+readline')
 
     def install(self, spec, prefix):
-        configure("--prefix=%s" % prefix)
+        options = ["--prefix=%s" % prefix]
+        if '+openssl' in spec:
+            options.append("--with-openssl-dir=%s" % spec['openssl'].prefix)
+        if '+readline' in spec:
+            options.append("--with-readline-dir=%s" % spec['readline'].prefix)
+        configure(*options)
         make()
         make("install")
 
-- 
cgit v1.2.3-70-g09d2


From 519b760222d953b9c79793e7803526846a814607 Mon Sep 17 00:00:00 2001
From: Glenn Johnson <glenn-johnson@uiowa.edu>
Date: Mon, 4 Jul 2016 17:30:05 -0500
Subject: New package - RStan

This PR creates the RStan package and its dependencies.
---
 var/spack/repos/builtin/packages/r-bh/package.py   | 54 ++++++++++++++++++++
 .../repos/builtin/packages/r-colorspace/package.py | 44 +++++++++++++++++
 .../repos/builtin/packages/r-dichromat/package.py  | 42 ++++++++++++++++
 .../repos/builtin/packages/r-ggplot2/package.py    | 54 ++++++++++++++++++++
 .../repos/builtin/packages/r-gridextra/package.py  | 44 +++++++++++++++++
 .../repos/builtin/packages/r-gtable/package.py     | 41 ++++++++++++++++
 .../repos/builtin/packages/r-inline/package.py     | 42 ++++++++++++++++
 .../repos/builtin/packages/r-labeling/package.py   | 41 ++++++++++++++++
 .../repos/builtin/packages/r-lattice/package.py    | 44 +++++++++++++++++
 .../repos/builtin/packages/r-magrittr/package.py   | 45 +++++++++++++++++
 var/spack/repos/builtin/packages/r-mass/package.py | 42 ++++++++++++++++
 .../repos/builtin/packages/r-matrix/package.py     | 44 +++++++++++++++++
 .../repos/builtin/packages/r-munsell/package.py    | 47 ++++++++++++++++++
 var/spack/repos/builtin/packages/r-plyr/package.py | 48 ++++++++++++++++++
 .../builtin/packages/r-rcolorbrewer/package.py     | 42 ++++++++++++++++
 var/spack/repos/builtin/packages/r-rcpp/package.py | 49 +++++++++++++++++++
 .../repos/builtin/packages/r-rcppeigen/package.py  | 56 +++++++++++++++++++++
 .../repos/builtin/packages/r-reshape2/package.py   | 46 +++++++++++++++++
 .../repos/builtin/packages/r-rstan/package.py      | 57 ++++++++++++++++++++++
 .../repos/builtin/packages/r-scales/package.py     | 49 +++++++++++++++++++
 .../builtin/packages/r-stanheaders/package.py      | 55 +++++++++++++++++++++
 .../repos/builtin/packages/r-stringi/package.py    | 51 +++++++++++++++++++
 .../repos/builtin/packages/r-stringr/package.py    | 48 ++++++++++++++++++
 23 files changed, 1085 insertions(+)
 create mode 100644 var/spack/repos/builtin/packages/r-bh/package.py
 create mode 100644 var/spack/repos/builtin/packages/r-colorspace/package.py
 create mode 100644 var/spack/repos/builtin/packages/r-dichromat/package.py
 create mode 100644 var/spack/repos/builtin/packages/r-ggplot2/package.py
 create mode 100644 var/spack/repos/builtin/packages/r-gridextra/package.py
 create mode 100644 var/spack/repos/builtin/packages/r-gtable/package.py
 create mode 100644 var/spack/repos/builtin/packages/r-inline/package.py
 create mode 100644 var/spack/repos/builtin/packages/r-labeling/package.py
 create mode 100644 var/spack/repos/builtin/packages/r-lattice/package.py
 create mode 100644 var/spack/repos/builtin/packages/r-magrittr/package.py
 create mode 100644 var/spack/repos/builtin/packages/r-mass/package.py
 create mode 100644 var/spack/repos/builtin/packages/r-matrix/package.py
 create mode 100644 var/spack/repos/builtin/packages/r-munsell/package.py
 create mode 100644 var/spack/repos/builtin/packages/r-plyr/package.py
 create mode 100644 var/spack/repos/builtin/packages/r-rcolorbrewer/package.py
 create mode 100644 var/spack/repos/builtin/packages/r-rcpp/package.py
 create mode 100644 var/spack/repos/builtin/packages/r-rcppeigen/package.py
 create mode 100644 var/spack/repos/builtin/packages/r-reshape2/package.py
 create mode 100644 var/spack/repos/builtin/packages/r-rstan/package.py
 create mode 100644 var/spack/repos/builtin/packages/r-scales/package.py
 create mode 100644 var/spack/repos/builtin/packages/r-stanheaders/package.py
 create mode 100644 var/spack/repos/builtin/packages/r-stringi/package.py
 create mode 100644 var/spack/repos/builtin/packages/r-stringr/package.py

diff --git a/var/spack/repos/builtin/packages/r-bh/package.py b/var/spack/repos/builtin/packages/r-bh/package.py
new file mode 100644
index 0000000000..a0f30b779f
--- /dev/null
+++ b/var/spack/repos/builtin/packages/r-bh/package.py
@@ -0,0 +1,54 @@
+##############################################################################
+# 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 RBh(Package):
+    """Boost provides free peer-reviewed portable C++ source libraries. A large
+    part of Boost is provided as C++ template code which is resolved entirely
+    at compile-time without linking. This package aims to provide the most
+    useful subset of Boost libraries for template use among CRAN package. By
+    placing these libraries in this package, we offer a more efficient
+    distribution system for CRAN as replication of this code in the sources of
+    other packages is avoided. As of release 1.60.0-2, the following Boost
+    libraries are included: 'algorithm' 'any' 'bimap' 'bind' 'circular_buffer'
+    'concept' 'config' 'container' 'date'_'time' 'detail' 'dynamic_bitset'
+    'exception' 'filesystem' 'flyweight' 'foreach' 'functional' 'fusion'
+    'geometry' 'graph' 'heap' 'icl' 'integer' 'interprocess' 'intrusive' 'io'
+    'iostreams' 'iterator' 'math' 'move' 'mpl' 'multiprcecision' 'numeric'
+    'pending' 'phoenix' 'preprocessor' 'random' 'range' 'smart_ptr' 'spirit'
+    'tuple' 'type_trains' 'typeof' 'unordered' 'utility' 'uuid'."""
+
+    homepage = "https://cran.r-project.org/web/packages/BH/index.html"
+    url      = "https://cran.r-project.org/src/contrib/BH_1.60.0-2.tar.gz"
+    list_url = "https://cran.r-project.org/src/contrib/Archive/BH"
+
+    version('1.60.0-2', 'b50fdc85285da05add4e9da664a2d551')
+
+    extends('R')
+
+    def install(self, spec, prefix):
+        R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir),
+          self.stage.source_path)
diff --git a/var/spack/repos/builtin/packages/r-colorspace/package.py b/var/spack/repos/builtin/packages/r-colorspace/package.py
new file mode 100644
index 0000000000..a7622cad95
--- /dev/null
+++ b/var/spack/repos/builtin/packages/r-colorspace/package.py
@@ -0,0 +1,44 @@
+##############################################################################
+# 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 RColorspace(Package):
+    """Carries out mapping between assorted color spaces including RGB, HSV,
+    HLS, CIEXYZ, CIELUV, HCL (polar CIELUV), CIELAB and polar CIELAB.
+    Qualitative, sequential, and diverging color palettes based on HCL colors
+    are provided."""
+
+    homepage = "https://cran.r-project.org/web/packages/colorspace/index.html"
+    url      = "https://cran.r-project.org/src/contrib/colorspace_1.2-6.tar.gz"
+    list_url = "https://cran.r-project.org/src/contrib/Archive/colorspace"
+
+    version('1.2-6', 'a30191e9caf66f77ff4e99c062e9dce1')
+
+    extends('R')
+
+    def install(self, spec, prefix):
+        R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir),
+          self.stage.source_path)
diff --git a/var/spack/repos/builtin/packages/r-dichromat/package.py b/var/spack/repos/builtin/packages/r-dichromat/package.py
new file mode 100644
index 0000000000..663e5295af
--- /dev/null
+++ b/var/spack/repos/builtin/packages/r-dichromat/package.py
@@ -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
+##############################################################################
+from spack import *
+
+
+class RDichromat(Package):
+    """Collapse red-green or green-blue distinctions to simulate the effects of
+    different types of color-blindness."""
+
+    homepage = "https://cran.r-project.org/web/packages/dichromat/index.html"
+    url      = "https://cran.r-project.org/src/contrib/dichromat_2.0-0.tar.gz"
+    list_url = "https://cran.r-project.org/src/contrib/Archive/dichromat"
+
+    version('2.0-0', '84e194ac95a69763d740947a7ee346a6')
+
+    extends('R')
+
+    def install(self, spec, prefix):
+        R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir),
+          self.stage.source_path)
diff --git a/var/spack/repos/builtin/packages/r-ggplot2/package.py b/var/spack/repos/builtin/packages/r-ggplot2/package.py
new file mode 100644
index 0000000000..2d1f53af26
--- /dev/null
+++ b/var/spack/repos/builtin/packages/r-ggplot2/package.py
@@ -0,0 +1,54 @@
+##############################################################################
+# 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 RGgplot2(Package):
+    """An implementation of the grammar of graphics in R. It combines the
+    advantages of both base and lattice graphics: conditioning and shared axes
+    are handled automatically, and you can still build up a plot step by step
+    from multiple data sources. It also implements a sophisticated
+    multidimensional conditioning system and a consistent interface to map data
+    to aesthetic attributes. See http://ggplot2.org for more information,
+    documentation and examples."""
+
+    homepage = "http://ggplot2.org/"
+    url      = "https://cran.r-project.org/src/contrib/ggplot2_2.1.0.tar.gz"
+    list_url = "https://cran.r-project.org/src/contrib/Archive/ggplot2"
+
+    version('2.1.0', '771928cfb97c649c720423deb3ec7fd3')
+
+    extends('R')
+
+    depends_on('r-digest')
+    depends_on('r-gtable')
+    depends_on('r-mass')
+    depends_on('r-plyr')
+    depends_on('r-reshape2')
+    depends_on('r-scales')
+
+    def install(self, spec, prefix):
+        R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir),
+          self.stage.source_path)
diff --git a/var/spack/repos/builtin/packages/r-gridextra/package.py b/var/spack/repos/builtin/packages/r-gridextra/package.py
new file mode 100644
index 0000000000..d215d10678
--- /dev/null
+++ b/var/spack/repos/builtin/packages/r-gridextra/package.py
@@ -0,0 +1,44 @@
+##############################################################################
+# 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 RGridextra(Package):
+    """Provides a number of user-level functions to work with "grid" graphics,
+    notably to arrange multiple grid-based plots on a page, and draw tables."""
+
+    homepage = "https://github.com/baptiste/gridextra"
+    url      = "https://cran.r-project.org/src/contrib/gridExtra_2.2.1.tar.gz"
+    list_url = "https://cran.r-project.org/src/contrib/Archive/gridExtra"
+
+    version('2.2.1', '7076c2122d387c7ef3add69a1c4fc1b2')
+
+    extends('R')
+
+    depends_on('r-gtable')
+
+    def install(self, spec, prefix):
+        R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir),
+          self.stage.source_path)
diff --git a/var/spack/repos/builtin/packages/r-gtable/package.py b/var/spack/repos/builtin/packages/r-gtable/package.py
new file mode 100644
index 0000000000..74dee0b3d5
--- /dev/null
+++ b/var/spack/repos/builtin/packages/r-gtable/package.py
@@ -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 RGtable(Package):
+    """Tools to make it easier to work with "tables" of 'grobs'."""
+
+    homepage = "https://cran.r-project.org/web/packages/gtable/index.html"
+    url      = "https://cran.r-project.org/src/contrib/gtable_0.2.0.tar.gz"
+    list_url = "https://cran.r-project.org/src/contrib/Archive/gtable"
+
+    version('0.2.0', '124090ae40b2dd3170ae11180e0d4cab')
+
+    extends('R')
+
+    def install(self, spec, prefix):
+        R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir),
+          self.stage.source_path)
diff --git a/var/spack/repos/builtin/packages/r-inline/package.py b/var/spack/repos/builtin/packages/r-inline/package.py
new file mode 100644
index 0000000000..c972fe0ff0
--- /dev/null
+++ b/var/spack/repos/builtin/packages/r-inline/package.py
@@ -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
+##############################################################################
+from spack import *
+
+
+class RInline(Package):
+    """Functionality to dynamically define R functions and S4 methods with
+    inlined C, C++ or Fortran code supporting .C and .Call calling conventions."""
+
+    homepage = "https://cran.r-project.org/web/packages/inline/index.html"
+    url      = "https://cran.r-project.org/src/contrib/inline_0.3.14.tar.gz"
+    list_url = "https://cran.r-project.org/src/contrib/Archive/inline"
+
+    version('0.3.14', '9fe304a6ebf0e3889c4c6a7ad1c50bca')
+
+    extends('R')
+
+    def install(self, spec, prefix):
+        R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir),
+          self.stage.source_path)
diff --git a/var/spack/repos/builtin/packages/r-labeling/package.py b/var/spack/repos/builtin/packages/r-labeling/package.py
new file mode 100644
index 0000000000..02e5da9d85
--- /dev/null
+++ b/var/spack/repos/builtin/packages/r-labeling/package.py
@@ -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 RLabeling(Package):
+    """Provides a range of axis labeling algorithms."""
+
+    homepage = "https://cran.r-project.org/web/packages/labeling/index.html"
+    url      = "https://cran.r-project.org/src/contrib/labeling_0.3.tar.gz"
+    list_url = "https://cran.r-project.org/src/contrib/Archive/labeling"
+
+    version('0.3', 'ccd7082ec0b211aba8a89d85176bb534')
+
+    extends('R')
+
+    def install(self, spec, prefix):
+        R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir),
+          self.stage.source_path)
diff --git a/var/spack/repos/builtin/packages/r-lattice/package.py b/var/spack/repos/builtin/packages/r-lattice/package.py
new file mode 100644
index 0000000000..ba29feefc4
--- /dev/null
+++ b/var/spack/repos/builtin/packages/r-lattice/package.py
@@ -0,0 +1,44 @@
+##############################################################################
+# 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 RLattice(Package):
+    """A powerful and elegant high-level data visualization system inspired by
+    Trellis graphics, with an emphasis on multivariate data. Lattice is
+    sufficient for typical graphics needs, and is also flexible enough to
+    handle most nonstandard requirements. See ?Lattice for an introduction."""
+
+    homepage = "http://lattice.r-forge.r-project.org/"
+    url      = "https://cran.r-project.org/src/contrib/lattice_0.20-33.tar.gz"
+    list_url = "https://cran.r-project.org/src/contrib/Archive/lattice"
+
+    version('0.20-33', 'd487c94db1bfe00a27270f4c71baf53e')
+
+    extends('R')
+
+    def install(self, spec, prefix):
+        R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir),
+          self.stage.source_path)
diff --git a/var/spack/repos/builtin/packages/r-magrittr/package.py b/var/spack/repos/builtin/packages/r-magrittr/package.py
new file mode 100644
index 0000000000..11476c3d1e
--- /dev/null
+++ b/var/spack/repos/builtin/packages/r-magrittr/package.py
@@ -0,0 +1,45 @@
+##############################################################################
+# 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 RMagrittr(Package):
+    """Provides a mechanism for chaining commands with a new forward-pipe
+    operator, %>%. This operator will forward a value, or the result of an
+    expression, into the next function call/expression. There is flexible
+    support for the type of right-hand side expressions. For more information,
+    see package vignette."""
+
+    homepage = "https://cran.r-project.org/web/packages/magrittr/index.html"
+    url      = "https://cran.r-project.org/src/contrib/magrittr_1.5.tar.gz"
+    list_url = "https://cran.r-project.org/src/contrib/Archive/magrittr"
+
+    version('1.5', 'e74ab7329f2b9833f0c3c1216f86d65a')
+
+    extends('R')
+
+    def install(self, spec, prefix):
+        R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir),
+          self.stage.source_path)
diff --git a/var/spack/repos/builtin/packages/r-mass/package.py b/var/spack/repos/builtin/packages/r-mass/package.py
new file mode 100644
index 0000000000..1ab01d2256
--- /dev/null
+++ b/var/spack/repos/builtin/packages/r-mass/package.py
@@ -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
+##############################################################################
+from spack import *
+
+
+class RMass(Package):
+    """Functions and datasets to support Venables and Ripley, "Modern Applied
+    Statistics with S" (4th edition, 2002)."""
+
+    homepage = "http://www.stats.ox.ac.uk/pub/MASS4/"
+    url      = "https://cran.r-project.org/src/contrib/MASS_7.3-45.tar.gz"
+    list_url = "https://cran.r-project.org/src/contrib/Archive/MASS"
+
+    version('7.3-45', 'aba3d12fab30f1793bee168a1efea88b')
+
+    extends('R')
+
+    def install(self, spec, prefix):
+        R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir),
+          self.stage.source_path)
diff --git a/var/spack/repos/builtin/packages/r-matrix/package.py b/var/spack/repos/builtin/packages/r-matrix/package.py
new file mode 100644
index 0000000000..fbd8a7b4df
--- /dev/null
+++ b/var/spack/repos/builtin/packages/r-matrix/package.py
@@ -0,0 +1,44 @@
+##############################################################################
+# 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 RMatrix(Package):
+    """Classes and methods for dense and sparse matrices and operations on them
+    using 'LAPACK' and 'SuiteSparse'."""
+
+    homepage = "http://matrix.r-forge.r-project.org/"
+    url      = "https://cran.r-project.org/src/contrib/Matrix_1.2-6.tar.gz"
+    list_url = "https://cran.r-project.org/src/contrib/Archive/Matrix"
+
+    version('1.2-6', 'f545307fb1284861e9266c4e9712c55e')
+
+    extends('R')
+
+    depends_on('r-lattice')
+
+    def install(self, spec, prefix):
+        R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir),
+          self.stage.source_path)
diff --git a/var/spack/repos/builtin/packages/r-munsell/package.py b/var/spack/repos/builtin/packages/r-munsell/package.py
new file mode 100644
index 0000000000..3216c95e00
--- /dev/null
+++ b/var/spack/repos/builtin/packages/r-munsell/package.py
@@ -0,0 +1,47 @@
+##############################################################################
+# 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 RMunsell(Package):
+    """Provides easy access to, and manipulation of, the Munsell colours.
+    Provides a mapping between Munsell's original notation (e.g. "5R 5/10") and
+    hexadecimal strings suitable for use directly in R graphics. Also provides
+    utilities to explore slices through the Munsell colour tree, to transform
+    Munsell colours and display colour palettes."""
+
+    homepage = "https://cran.r-project.org/web/packages/munsell/index.html"
+    url      = "https://cran.r-project.org/src/contrib/munsell_0.4.3.tar.gz"
+    list_url = "https://cran.r-project.org/src/contrib/Archive/munsell"
+
+    version('0.4.3', 'ebd205323dc37c948f499ee08be9c476')
+
+    extends('R')
+
+    depends_on('r-colorspace')
+
+    def install(self, spec, prefix):
+        R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir),
+          self.stage.source_path)
diff --git a/var/spack/repos/builtin/packages/r-plyr/package.py b/var/spack/repos/builtin/packages/r-plyr/package.py
new file mode 100644
index 0000000000..e071050f4a
--- /dev/null
+++ b/var/spack/repos/builtin/packages/r-plyr/package.py
@@ -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 RPlyr(Package):
+    """A set of tools that solves a common set of problems: you need to break a
+    big problem down into manageable pieces, operate on each piece and then put
+    all the pieces back together. For example, you might want to fit a model to
+    each spatial location or time point in your study, summarise data by panels
+    or collapse high-dimensional arrays to simpler summary statistics. The
+    development of 'plyr' has been generously supported by 'Becton Dickinson'."""
+
+    homepage = "http://had.co.nz/plyr"
+    url      = "https://cran.r-project.org/src/contrib/plyr_1.8.4.tar.gz"
+    list_url = "https://cran.r-project.org/src/contrib/Archive/plyr"
+
+    version('1.8.4', 'ef455cf7fc06e34837692156b7b2587b')
+
+    extends('R')
+
+    depends_on('r-rcpp')
+
+    def install(self, spec, prefix):
+        R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir),
+          self.stage.source_path)
diff --git a/var/spack/repos/builtin/packages/r-rcolorbrewer/package.py b/var/spack/repos/builtin/packages/r-rcolorbrewer/package.py
new file mode 100644
index 0000000000..b81ec2561c
--- /dev/null
+++ b/var/spack/repos/builtin/packages/r-rcolorbrewer/package.py
@@ -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
+##############################################################################
+from spack import *
+
+
+class RRcolorbrewer(Package):
+    """Provides color schemes for maps (and other graphics) designed by Cynthia
+    Brewer as described at http://colorbrewer2.org"""
+
+    homepage = "http://colorbrewer2.org"
+    url      = "https://cran.r-project.org/src/contrib/RColorBrewer_1.1-2.tar.gz"
+    list_url = "https://cran.r-project.org/src/contrib/Archive/RColorBrewer"
+
+    version('1.1-2', '66054d83eade4dff8a43ad4732691182')
+
+    extends('R')
+
+    def install(self, spec, prefix):
+        R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir),
+          self.stage.source_path)
diff --git a/var/spack/repos/builtin/packages/r-rcpp/package.py b/var/spack/repos/builtin/packages/r-rcpp/package.py
new file mode 100644
index 0000000000..2428f4af3b
--- /dev/null
+++ b/var/spack/repos/builtin/packages/r-rcpp/package.py
@@ -0,0 +1,49 @@
+##############################################################################
+# 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 RRcpp(Package):
+    """The 'Rcpp' package provides R functions as well as C++ classes which
+    offer a seamless integration of R and C++. Many R data types and objects
+    can be mapped back and forth to C++ equivalents which facilitates both
+    writing of new code as well as easier integration of third-party libraries.
+    Documentation about 'Rcpp' is provided by several vignettes included in
+    this package, via the 'Rcpp Gallery' site at <http://gallery.rcpp.org>, the
+    paper by Eddelbuettel and Francois (2011, JSS), and the book by
+    Eddelbuettel (2013, Springer); see 'citation("Rcpp")' for details on these
+    last two."""
+
+    homepage = "http://dirk.eddelbuettel.com/code/rcpp.html"
+    url      = "https://cran.r-project.org/src/contrib/Rcpp_0.12.5.tar.gz"
+    list_url = "https://cran.r-project.org/src/contrib/Archive/Rcpp"
+
+    version('0.12.5', 'f03ec05b4e391cc46e7ce330e82ff5e2')
+
+    extends('R')
+
+    def install(self, spec, prefix):
+        R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir),
+          self.stage.source_path)
diff --git a/var/spack/repos/builtin/packages/r-rcppeigen/package.py b/var/spack/repos/builtin/packages/r-rcppeigen/package.py
new file mode 100644
index 0000000000..3175628a73
--- /dev/null
+++ b/var/spack/repos/builtin/packages/r-rcppeigen/package.py
@@ -0,0 +1,56 @@
+##############################################################################
+# 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 RRcppeigen(Package):
+    """R and 'Eigen' integration using 'Rcpp'. 'Eigen' is a C++ template
+    library for linear algebra: matrices, vectors, numerical solvers and
+    related algorithms. It supports dense and sparse matrices on integer,
+    floating point and complex numbers, decompositions of such matrices, and
+    solutions of linear systems. Its performance on many algorithms is
+    comparable with some of the best implementations based on 'Lapack' and
+    level-3 'BLAS'. The 'RcppEigen' package includes the header files from the
+    'Eigen' C++ template library (currently version 3.2.8). Thus users do not
+    need to install 'Eigen' itself in order to use 'RcppEigen'. Since version
+    3.1.1, 'Eigen' is licensed under the Mozilla Public License (version 2);
+    earlier version were licensed under the GNU LGPL version 3 or later.
+    'RcppEigen' (the 'Rcpp' bindings/bridge to 'Eigen') is licensed under the
+    GNU GPL version 2 or later, as is the rest of 'Rcpp'."""
+
+    homepage = "http://eigen.tuxfamily.org/"
+    url      = "https://cran.r-project.org/src/contrib/RcppEigen_0.3.2.8.1.tar.gz"
+    list_url = "https://cran.r-project.org/src/contrib/Archive/RcppEigen"
+
+    version('0.3.2.8.1', '4146e06e4fdf7f4d08db7839069d479f')
+
+    extends('R')
+
+    depends_on('r-matrix')
+    depends_on('r-rcpp')
+
+    def install(self, spec, prefix):
+        R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir),
+          self.stage.source_path)
diff --git a/var/spack/repos/builtin/packages/r-reshape2/package.py b/var/spack/repos/builtin/packages/r-reshape2/package.py
new file mode 100644
index 0000000000..a96a314008
--- /dev/null
+++ b/var/spack/repos/builtin/packages/r-reshape2/package.py
@@ -0,0 +1,46 @@
+##############################################################################
+# 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 RReshape2(Package):
+    """Flexibly restructure and aggregate data using just two functions: melt
+    and dcast (or acast)."""
+
+    homepage = "https://github.com/hadley/reshape"
+    url      = "https://cran.r-project.org/src/contrib/reshape2_1.4.1.tar.gz"
+    list_url = "https://cran.r-project.org/src/contrib/Archive/reshape2"
+
+    version('1.4.1', '41e9dffdf5c6fa830321ac9c8ebffe00')
+
+    extends('R')
+
+    depends_on('r-plyr')
+    depends_on('r-stringr')
+    depends_on('r-rcpp')
+
+    def install(self, spec, prefix):
+        R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir),
+          self.stage.source_path)
diff --git a/var/spack/repos/builtin/packages/r-rstan/package.py b/var/spack/repos/builtin/packages/r-rstan/package.py
new file mode 100644
index 0000000000..00fd5116d9
--- /dev/null
+++ b/var/spack/repos/builtin/packages/r-rstan/package.py
@@ -0,0 +1,57 @@
+##############################################################################
+# 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 RRstan(Package):
+    """User-facing R functions are provided to parse, compile, test, estimate,
+    and analyze Stan models by accessing the header-only Stan library provided
+    by the 'StanHeaders' package. The Stan project develops a probabilistic
+    programming language that implements full Bayesian statistical inference
+    via Markov Chain Monte Carlo, rough Bayesian inference via variational
+    approximation, and (optionally penalized) maximum likelihood estimation via
+    optimization. In all three cases, automatic differentiation is used to
+    quickly and accurately evaluate gradients without burdening the user with
+    the need to derive the partial derivatives."""
+
+    homepage = "http://mc-stan.org/"
+    url      = "https://cran.r-project.org/src/contrib/rstan_2.10.1.tar.gz"
+    list_url = "https://cran.r-project.org/src/contrib/Archive/rstan"
+
+    version('2.10.1', 'f5d212f6f8551bdb91fe713d05d4052a')
+
+    extends('R')
+
+    depends_on('r-ggplot2')
+    depends_on('r-stanheaders')
+    depends_on('r-inline')
+    depends_on('r-gridextra')
+    depends_on('r-rcpp')
+    depends_on('r-rcppeigen')
+    depends_on('r-bh')
+
+    def install(self, spec, prefix):
+        R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir),
+          self.stage.source_path)
diff --git a/var/spack/repos/builtin/packages/r-scales/package.py b/var/spack/repos/builtin/packages/r-scales/package.py
new file mode 100644
index 0000000000..046a05d48e
--- /dev/null
+++ b/var/spack/repos/builtin/packages/r-scales/package.py
@@ -0,0 +1,49 @@
+##############################################################################
+# 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 RScales(Package):
+    """Graphical scales map data to aesthetics, and provide methods for
+    automatically determining breaks and labels for axes and legends."""
+
+    homepage = "https://github.com/hadley/scales"
+    url      = "https://cran.r-project.org/src/contrib/scales_0.4.0.tar.gz"
+    list_url = "https://cran.r-project.org/src/contrib/Archive/scales"
+
+    version('0.4.0', '7b5602d9c55595901192248bca25c099')
+
+    extends('R')
+
+    depends_on('r-rcolorbrewer')
+    depends_on('r-dichromat')
+    depends_on('r-plyr')
+    depends_on('r-munsell')
+    depends_on('r-labeling')
+    depends_on('r-rcpp')
+
+    def install(self, spec, prefix):
+        R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir),
+          self.stage.source_path)
diff --git a/var/spack/repos/builtin/packages/r-stanheaders/package.py b/var/spack/repos/builtin/packages/r-stanheaders/package.py
new file mode 100644
index 0000000000..c77b5aa8b6
--- /dev/null
+++ b/var/spack/repos/builtin/packages/r-stanheaders/package.py
@@ -0,0 +1,55 @@
+##############################################################################
+# 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 RStanheaders(Package):
+    """The C++ header files of the Stan project are provided by this package,
+    but it contains no R code, vignettes, or function documentation. There is a
+    shared object containing part of the CVODES library, but it is not
+    accessible from R. StanHeaders is only useful for developers who want to
+    utilize the LinkingTo directive of their package's DESCRIPTION file to
+    build on the Stan library without incurring unnecessary dependencies. The
+    Stan project develops a probabilistic programming language that implements
+    full or approximate Bayesian statistical inference via Markov Chain Monte
+    Carlo or variational methods and implements (optionally penalized) maximum
+    likelihood estimation via optimization. The Stan library includes an
+    advanced automatic differentiation scheme, templated statistical and linear
+    algebra functions that can handle the automatically differentiable scalar
+    types (and doubles, ints, etc.), and a parser for the Stan language. The
+    'rstan' package provides user-facing R functions to parse, compile, test,
+    estimate, and analyze Stan models."""
+
+    homepage = "http://mc-stan.org/"
+    url      = "https://cran.r-project.org/src/contrib/StanHeaders_2.10.0-2.tar.gz"
+    list_url = "https://cran.r-project.org/src/contrib/Archive/StanHeaders"
+
+    version('2.10.0-2', '9d09b1e9278f08768f7a988ad9082d57')
+
+    extends('R')
+
+    def install(self, spec, prefix):
+        R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir),
+          self.stage.source_path)
diff --git a/var/spack/repos/builtin/packages/r-stringi/package.py b/var/spack/repos/builtin/packages/r-stringi/package.py
new file mode 100644
index 0000000000..22774dedec
--- /dev/null
+++ b/var/spack/repos/builtin/packages/r-stringi/package.py
@@ -0,0 +1,51 @@
+##############################################################################
+# 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 RStringi(Package):
+    """Allows for fast, correct, consistent, portable, as well as convenient
+    character string/text processing in every locale and any native encoding.
+    Owing to the use of the ICU library, the package provides R users with
+    platform-independent functions known to Java, Perl, Python, PHP, and Ruby
+    programmers. Among available features there are: pattern searching (e.g.,
+    with ICU Java-like regular expressions or the Unicode Collation Algorithm),
+    random string generation, case mapping, string transliteration,
+    concatenation, Unicode normalization, date-time formatting and parsing,
+    etc."""
+
+    homepage = "http://www.gagolewski.com/software/stringi/"
+    url      = "https://cran.r-project.org/src/contrib/stringi_1.1.1.tar.gz"
+    list_url = "https://cran.r-project.org/src/contrib/Archive/stringi"
+
+    version('1.1.1', '32b919ee3fa8474530c4942962a6d8d9')
+
+    extends('R')
+
+    depends_on('icu')
+
+    def install(self, spec, prefix):
+        R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir),
+          self.stage.source_path)
diff --git a/var/spack/repos/builtin/packages/r-stringr/package.py b/var/spack/repos/builtin/packages/r-stringr/package.py
new file mode 100644
index 0000000000..01fd969522
--- /dev/null
+++ b/var/spack/repos/builtin/packages/r-stringr/package.py
@@ -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 RStringr(Package):
+    """A consistent, simple and easy to use set of wrappers around the
+    fantastic 'stringi' package. All function and argument names (and
+    positions) are consistent, all functions deal with "NA"'s and zero length
+    vectors in the same way, and the output from one function is easy to feed
+    into the input of another."""
+
+    homepage = "https://cran.r-project.org/web/packages/stringr/index.html"
+    url      = "https://cran.r-project.org/src/contrib/stringr_1.0.0.tar.gz"
+    list_url = "https://cran.r-project.org/src/contrib/Archive/stringr"
+
+    version('1.0.0', '5ca977c90351f78b1b888b379114a7b4')
+
+    extends('R')
+
+    depends_on('r-stringi')
+    depends_on('r-magrittr')
+
+    def install(self, spec, prefix):
+        R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir),
+          self.stage.source_path)
-- 
cgit v1.2.3-70-g09d2


From d5abcc5c88a1aef31cba571a03966efded19c4ae Mon Sep 17 00:00:00 2001
From: Glenn Johnson <glenn-johnson@uiowa.edu>
Date: Mon, 4 Jul 2016 17:55:10 -0500
Subject: Fix flake errors

---
 var/spack/repos/builtin/packages/r-inline/package.py | 3 ++-
 var/spack/repos/builtin/packages/r-plyr/package.py   | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/var/spack/repos/builtin/packages/r-inline/package.py b/var/spack/repos/builtin/packages/r-inline/package.py
index c972fe0ff0..35eb8ca76f 100644
--- a/var/spack/repos/builtin/packages/r-inline/package.py
+++ b/var/spack/repos/builtin/packages/r-inline/package.py
@@ -27,7 +27,8 @@ from spack import *
 
 class RInline(Package):
     """Functionality to dynamically define R functions and S4 methods with
-    inlined C, C++ or Fortran code supporting .C and .Call calling conventions."""
+    inlined C, C++ or Fortran code supporting .C and .Call calling
+    conventions."""
 
     homepage = "https://cran.r-project.org/web/packages/inline/index.html"
     url      = "https://cran.r-project.org/src/contrib/inline_0.3.14.tar.gz"
diff --git a/var/spack/repos/builtin/packages/r-plyr/package.py b/var/spack/repos/builtin/packages/r-plyr/package.py
index e071050f4a..192e7e8b18 100644
--- a/var/spack/repos/builtin/packages/r-plyr/package.py
+++ b/var/spack/repos/builtin/packages/r-plyr/package.py
@@ -31,7 +31,8 @@ class RPlyr(Package):
     all the pieces back together. For example, you might want to fit a model to
     each spatial location or time point in your study, summarise data by panels
     or collapse high-dimensional arrays to simpler summary statistics. The
-    development of 'plyr' has been generously supported by 'Becton Dickinson'."""
+    development of 'plyr' has been generously supported by 'Becton
+    Dickinson'."""
 
     homepage = "http://had.co.nz/plyr"
     url      = "https://cran.r-project.org/src/contrib/plyr_1.8.4.tar.gz"
-- 
cgit v1.2.3-70-g09d2


From 690937f9533765f6b5c2b815d9c4798f15456918 Mon Sep 17 00:00:00 2001
From: Todd Gamblin <tgamblin@llnl.gov>
Date: Mon, 4 Jul 2016 22:58:01 -0700
Subject: Add `--dirty` option to `spack install`.

- Allow install to be run without cleaning the environment.
---
 lib/spack/spack/build_environment.py | 35 +++++++++++++++++++++--------------
 lib/spack/spack/cmd/install.py       |  4 ++++
 lib/spack/spack/package.py           | 12 +++++++-----
 3 files changed, 32 insertions(+), 19 deletions(-)

diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py
index 7220539886..ce0b91b718 100644
--- a/lib/spack/spack/build_environment.py
+++ b/lib/spack/spack/build_environment.py
@@ -224,9 +224,12 @@ def set_compiler_environment_variables(pkg, env):
     return env
 
 
-def set_build_environment_variables(pkg, env):
+def set_build_environment_variables(pkg, env, dirty=False):
     """
-    This ensures a clean install environment when we build packages
+    This ensures a clean install environment when we build packages.
+
+    Arguments:
+    dirty -- skip unsetting the user's environment settings.
     """
     # Add spack build environment path with compiler wrappers first in
     # the path. We add both spack.env_path, which includes default
@@ -262,14 +265,17 @@ def set_build_environment_variables(pkg, env):
     # Install root prefix
     env.set(SPACK_INSTALL, spack.install_path)
 
-    # Remove these vars from the environment during build because they
-    # can affect how some packages find libraries.  We want to make
-    # sure that builds never pull in unintended external dependencies.
-    env.unset('LD_LIBRARY_PATH')
-    env.unset('LIBRARY_PATH')
-    env.unset('CPATH')
-    env.unset('LD_RUN_PATH')
-    env.unset('DYLD_LIBRARY_PATH')
+    # Stuff in here sanitizes the build environemnt to eliminate
+    # anything the user has set that may interfere.
+    if not dirty:
+        # Remove these vars from the environment during build because they
+        # can affect how some packages find libraries.  We want to make
+        # sure that builds never pull in unintended external dependencies.
+        env.unset('LD_LIBRARY_PATH')
+        env.unset('LIBRARY_PATH')
+        env.unset('CPATH')
+        env.unset('LD_RUN_PATH')
+        env.unset('DYLD_LIBRARY_PATH')
 
     # Add bin directories from dependencies to the PATH for the build.
     bin_dirs = reversed(
@@ -407,7 +413,7 @@ def load_external_modules(pkg):
             load_module(dep.external_module)
 
 
-def setup_package(pkg):
+def setup_package(pkg, dirty=False):
     """Execute all environment setup routines."""
     spack_env = EnvironmentModifications()
     run_env = EnvironmentModifications()
@@ -430,7 +436,7 @@ def setup_package(pkg):
         s.package.spec = s
 
     set_compiler_environment_variables(pkg, spack_env)
-    set_build_environment_variables(pkg, spack_env)
+    set_build_environment_variables(pkg, spack_env, dirty)
     load_external_modules(pkg)
     # traverse in postorder so package can use vars from its dependencies
     spec = pkg.spec
@@ -459,7 +465,7 @@ def setup_package(pkg):
     spack_env.apply_modifications()
 
 
-def fork(pkg, function):
+def fork(pkg, function, dirty=False):
     """Fork a child process to do part of a spack build.
 
     Arguments:
@@ -467,6 +473,7 @@ def fork(pkg, function):
     pkg -- pkg whose environemnt we should set up the
            forked process for.
     function -- arg-less function to run in the child process.
+    dirty -- If True, do NOT clean the environment before building.
 
     Usage:
        def child_fun():
@@ -490,7 +497,7 @@ def fork(pkg, function):
 
     if pid == 0:
         # Give the child process the package's build environment.
-        setup_package(pkg)
+        setup_package(pkg, dirty=dirty)
 
         try:
             # call the forked function.
diff --git a/lib/spack/spack/cmd/install.py b/lib/spack/spack/cmd/install.py
index 9d3175786b..3133e080d7 100644
--- a/lib/spack/spack/cmd/install.py
+++ b/lib/spack/spack/cmd/install.py
@@ -53,6 +53,9 @@ def setup_parser(subparser):
     subparser.add_argument(
         '--fake', action='store_true', dest='fake',
         help="Fake install.  Just remove the prefix and touch a fake file in it.")
+    subparser.add_argument(
+        '--dirty', action='store_true', dest='dirty',
+        help="Install a package *without* cleaning the environment.")
     subparser.add_argument(
         'packages', nargs=argparse.REMAINDER, help="specs of packages to install")
 
@@ -79,4 +82,5 @@ def install(parser, args):
                 make_jobs=args.jobs,
                 verbose=args.verbose,
                 fake=args.fake,
+                dirty=args.dirty,
                 explicit=True)
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index 53c521b776..84bd99df54 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -755,7 +755,7 @@ class Package(object):
             self.stage.check()
 
         self.stage.cache_local()
-        
+
 
     def do_stage(self, mirror_only=False):
         """Unpacks the fetched tarball, then changes into the expanded tarball
@@ -883,6 +883,7 @@ class Package(object):
                    make_jobs=None,
                    fake=False,
                    explicit=False,
+                   dirty=False,
                    install_phases = install_phases):
         """Called by commands to install a package and its dependencies.
 
@@ -899,6 +900,7 @@ class Package(object):
         fake        -- Don't really build -- install fake stub files instead.
         skip_patch  -- Skip patch stage of build if True.
         verbose     -- Display verbose build output (by default, suppresses it)
+        dirty       -- Don't clean the build environment before installing.
         make_jobs   -- Number of make jobs to use for install. Default is ncpus
         """
         if not self.spec.concrete:
@@ -1037,7 +1039,7 @@ class Package(object):
                 pass
 
         try:
-            spack.build_environment.fork(self, build_process)
+            spack.build_environment.fork(self, build_process, dirty=dirty)
         except:
             # remove the install prefix if anything went wrong during install.
             if not keep_prefix:
@@ -1527,15 +1529,15 @@ class StagedPackage(Package):
         raise InstallError("Package %s provides no install_setup() method!" % self.name)
 
     def install_configure(self):
-        """Runs the configure process."""   
+        """Runs the configure process."""
         raise InstallError("Package %s provides no install_configure() method!" % self.name)
 
     def install_build(self):
-        """Runs the build process."""       
+        """Runs the build process."""
         raise InstallError("Package %s provides no install_build() method!" % self.name)
 
     def install_install(self):
-        """Runs the install process."""     
+        """Runs the install process."""
         raise InstallError("Package %s provides no install_install() method!" % self.name)
 
     def install(self, spec, prefix):
-- 
cgit v1.2.3-70-g09d2


From d687e332ad41cd7c84bf0007f8c331e56470da18 Mon Sep 17 00:00:00 2001
From: Todd Gamblin <tgamblin@llnl.gov>
Date: Mon, 4 Jul 2016 22:59:02 -0700
Subject: Fix compile bugs for gcc on Mac OS X with macports.

- add macports to things that are cleaned out of the environment.
- linker incompatibilities cause issues with packages like OpenSSL.
- also clean up NOQA stuff in OpenSSL
---
 lib/spack/spack/build_environment.py               |  9 ++++++
 .../repos/builtin/packages/openssl/package.py      | 36 ++++++++++++++--------
 2 files changed, 32 insertions(+), 13 deletions(-)

diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py
index ce0b91b718..fe5186a7d7 100644
--- a/lib/spack/spack/build_environment.py
+++ b/lib/spack/spack/build_environment.py
@@ -277,6 +277,15 @@ def set_build_environment_variables(pkg, env, dirty=False):
         env.unset('LD_RUN_PATH')
         env.unset('DYLD_LIBRARY_PATH')
 
+        # Remove any macports installs from the PATH.  The macports ld can
+        # cause conflicts with the built-in linker on el capitan.  Solves
+        # assembler issues, e.g.:
+        #    suffix or operands invalid for `movq'"
+        path = get_path('PATH')
+        for p in path:
+            if '/macports/' in p:
+                env.remove_path('PATH', p)
+
     # Add bin directories from dependencies to the PATH for the build.
     bin_dirs = reversed(
         filter(os.path.isdir, ['%s/bin' % prefix for prefix in dep_prefixes]))
diff --git a/var/spack/repos/builtin/packages/openssl/package.py b/var/spack/repos/builtin/packages/openssl/package.py
index a0747f229d..e7c105d5f5 100644
--- a/var/spack/repos/builtin/packages/openssl/package.py
+++ b/var/spack/repos/builtin/packages/openssl/package.py
@@ -63,7 +63,8 @@ class Openssl(Package):
                 # case return a fake url and exit
                 openssl_url = '@system (reserved version for system openssl)'
                 if not warnings_given_to_user.get(version, False):
-                    tty.msg('Using openssl@system : the version @system is reserved for system openssl')  # NOQA: ignore=E501
+                    tty.msg('Using openssl@system: '
+                            'the version @system is reserved for system openssl')
                     warnings_given_to_user[version] = True
             else:
                 openssl_url = self.check_for_outdated_release(
@@ -87,37 +88,46 @@ class Openssl(Package):
             openssl_url = latest.format(version=version)
             urllib.urlopen(openssl_url)
         except IOError:
-            openssl_url = older.format(version_number=version_number, version_full=version)  # NOQA:ignore=E501
+            openssl_url = older.format(
+                version_number=version_number, version_full=version)
             # Checks if we already warned the user for this particular
             # version of OpenSSL. If not we display a warning message
             # and mark this version
             if not warnings_given_to_user.get(version, False):
-                tty.warn('This installation depends on an old version of OpenSSL, which may have known security issues. ')    # NOQA: ignore=E501
-                tty.warn('Consider updating to the latest version of this package.')  # NOQA: ignore=E501
-                tty.warn('More details at {homepage}'.format(homepage=Openssl.homepage))   # NOQA: ignore=E501
+                tty.warn(
+                    'This installation depends on an old version of OpenSSL, '
+                    'which may have known security issues. ')
+                tty.warn(
+                    'Consider updating to the latest version of this package.')
+                tty.warn('More details at {homepage}'.format(
+                    homepage=Openssl.homepage))
                 warnings_given_to_user[version] = True
 
         return openssl_url
 
+
     def install(self, spec, prefix):
         # OpenSSL uses a variable APPS in its Makefile. If it happens to be set
         # in the environment, then this will override what is set in the
         # Makefile, leading to build errors.
         env.pop('APPS', None)
-        if spec.satisfies("target=x86_64") or spec.satisfies("target=ppc64"):
+
+        if spec.satisfies('target=x86_64') or spec.satisfies('target=ppc64'):
             # This needs to be done for all 64-bit architectures (except Linux,
             # where it happens automatically?)
             env['KERNEL_BITS'] = '64'
-        config = Executable("./config")
-        config("--prefix=%s" % prefix,
-               "--openssldir=%s" % join_path(prefix, 'etc', 'openssl'),
-               "zlib",
-               "no-krb5",
-               "shared")
+
+        options = ['zlib', 'no-krb5', 'shared']
+
+        config = Executable('./config')
+        config('--prefix=%s' % prefix,
+               '--openssldir=%s' % join_path(prefix, 'etc', 'openssl'),
+               *options)
+
         # Remove non-standard compiler options if present. These options are
         # present e.g. on Darwin. They are non-standard, i.e. most compilers
         # (e.g. gcc) will not accept them.
         filter_file(r'-arch x86_64', '', 'Makefile')
 
         make()
-        make("install")
+        make('install')
-- 
cgit v1.2.3-70-g09d2


From 79b3ef0362beba8dba260bdb023518f8c77c62bd Mon Sep 17 00:00:00 2001
From: Erik Schnetter <schnetter@gmail.com>
Date: Tue, 5 Jul 2016 10:58:11 -0400
Subject: Don't enforce `hdf5~mpi`

---
 var/spack/repos/builtin/packages/py-h5py/package.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/var/spack/repos/builtin/packages/py-h5py/package.py b/var/spack/repos/builtin/packages/py-h5py/package.py
index 0180b658f5..67461babe7 100644
--- a/var/spack/repos/builtin/packages/py-h5py/package.py
+++ b/var/spack/repos/builtin/packages/py-h5py/package.py
@@ -43,8 +43,8 @@ class PyH5py(Package):
     # Build dependencies
     depends_on('py-cython@0.19:')
     depends_on('pkg-config')
-    depends_on('hdf5@1.8.4:+mpi', when='+mpi')
-    depends_on('hdf5@1.8.4:~mpi', when='~mpi')
+    depends_on('hdf5@1.8.4:')
+    depends_on('hdf5+mpi', when='+mpi')
     depends_on('mpi', when='+mpi')
 
     # Build and runtime dependencies
-- 
cgit v1.2.3-70-g09d2


From 1f64f08cb33b2b0160e7b1666f1c0d129919aecb Mon Sep 17 00:00:00 2001
From: William Killian <william.killian@gmail.com>
Date: Tue, 5 Jul 2016 13:31:40 -0700
Subject: (bugfix) fixed typo of spec --> raw_spec

---
 lib/spack/spack/cmd/module.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/spack/spack/cmd/module.py b/lib/spack/spack/cmd/module.py
index 3cefb512c2..70da689b67 100644
--- a/lib/spack/spack/cmd/module.py
+++ b/lib/spack/spack/cmd/module.py
@@ -108,7 +108,7 @@ def module_find(mtype, flags, spec_array):
             tty.die("No installed packages match spec %s" % raw_spec)
 
         if len(specs) > 1:
-            tty.error("Multiple matches for spec %s.  Choose one:" % spec)
+            tty.error("Multiple matches for spec %s.  Choose one:" % raw_spec)
             for s in specs:
                 sys.stderr.write(s.tree(color=True))
             sys.exit(1)
-- 
cgit v1.2.3-70-g09d2


From 976b2b4d250c88f9668c7e4cf4f6c7bdb8324a2c Mon Sep 17 00:00:00 2001
From: Greg Lee <lee218@llnl.gov>
Date: Tue, 5 Jul 2016 13:45:22 -0700
Subject: added suitesparse version 4.5.3

---
 var/spack/repos/builtin/packages/suite-sparse/package.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/var/spack/repos/builtin/packages/suite-sparse/package.py b/var/spack/repos/builtin/packages/suite-sparse/package.py
index dd0dfa3e23..4135c7dd72 100644
--- a/var/spack/repos/builtin/packages/suite-sparse/package.py
+++ b/var/spack/repos/builtin/packages/suite-sparse/package.py
@@ -33,6 +33,7 @@ class SuiteSparse(Package):
     url = 'http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-4.5.1.tar.gz'
 
     version('4.5.1', 'f0ea9aad8d2d1ffec66a5b6bfeff5319')
+    version('4.5.3', '8ec57324585df3c6483ad7f556afccbd')
 
     # FIXME: (see below)
     # variant('tbb', default=True, description='Build with Intel TBB')
@@ -41,6 +42,7 @@ class SuiteSparse(Package):
     depends_on('lapack')
 
     depends_on('metis@5.1.0', when='@4.5.1')
+    depends_on('metis@5.1.0', when='@4.5.3')
     # FIXME:
     # in @4.5.1. TBB support in SPQR seems to be broken as TBB-related linkng flags
     # does not seem to be used, which leads to linking errors on Linux.
@@ -79,9 +81,10 @@ class SuiteSparse(Package):
 
         # BLAS arguments require path to libraries
         # FIXME : (blas / lapack always provide libblas and liblapack as aliases)
-        make_args.extend([
-            'BLAS=-lblas',
-            'LAPACK=-llapack'
-        ])
+        if '@4.5.1' in spec:
+            make_args.extend([
+                'BLAS=-lblas',
+                'LAPACK=-llapack'
+            ])
 
         make('install', *make_args)
-- 
cgit v1.2.3-70-g09d2


From 4c063c60556d714fd7fe4792b6aa137fd7d3f45e Mon Sep 17 00:00:00 2001
From: Greg Lee <lee218@llnl.gov>
Date: Tue, 5 Jul 2016 13:48:32 -0700
Subject: kludge to get suite-sparse-4.5.1 to link with -lstdc++

---
 var/spack/repos/builtin/packages/suite-sparse/package.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/var/spack/repos/builtin/packages/suite-sparse/package.py b/var/spack/repos/builtin/packages/suite-sparse/package.py
index 4135c7dd72..bc25fa8c6c 100644
--- a/var/spack/repos/builtin/packages/suite-sparse/package.py
+++ b/var/spack/repos/builtin/packages/suite-sparse/package.py
@@ -82,8 +82,10 @@ class SuiteSparse(Package):
         # BLAS arguments require path to libraries
         # FIXME : (blas / lapack always provide libblas and liblapack as aliases)
         if '@4.5.1' in spec:
+            # adding -lstdc++ is clearly an ugly way to do this, but it follows suit
+            # with the TCOV path of SparseSuite 4.5.1's Suitesparse_config.mk 
             make_args.extend([
-                'BLAS=-lblas',
+                'BLAS=-lblas -lstdc++',
                 'LAPACK=-llapack'
             ])
 
-- 
cgit v1.2.3-70-g09d2


From f5f7abd71f04b08a454c0a83dd87d2f806dcc23a Mon Sep 17 00:00:00 2001
From: Denis Davydov <davydden@gmail.com>
Date: Wed, 6 Jul 2016 10:56:16 +0200
Subject: arpack-ng: add 3.4.0 with cmake build

---
 .../builtin/packages/arpack-ng/make_install.patch  | 24 ++++++++++++++
 .../repos/builtin/packages/arpack-ng/package.py    | 38 +++++++++++++++++++---
 .../builtin/packages/arpack-ng/parpack_cmake.patch | 17 ++++++++++
 3 files changed, 75 insertions(+), 4 deletions(-)
 create mode 100644 var/spack/repos/builtin/packages/arpack-ng/make_install.patch
 create mode 100644 var/spack/repos/builtin/packages/arpack-ng/parpack_cmake.patch

diff --git a/var/spack/repos/builtin/packages/arpack-ng/make_install.patch b/var/spack/repos/builtin/packages/arpack-ng/make_install.patch
new file mode 100644
index 0000000000..ad5cffcc19
--- /dev/null
+++ b/var/spack/repos/builtin/packages/arpack-ng/make_install.patch
@@ -0,0 +1,24 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 607d221..50426c3 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -389,3 +389,19 @@ target_link_libraries(bug_1323 arpack ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES})
+ add_test(bug_1323 Tests/bug_1323)
+
+ add_dependencies(check dnsimp_test bug_1315_single bug_1315_double bug_1323)
++
++############################
++# install
++############################
++# 'make install' to the correct location
++install(TARGETS arpack
++    ARCHIVE  DESTINATION lib
++    LIBRARY  DESTINATION lib
++    RUNTIME  DESTINATION bin)
++
++if (MPI)
++  install(TARGETS parpack
++      ARCHIVE  DESTINATION lib
++      LIBRARY  DESTINATION lib
++      RUNTIME  DESTINATION bin)
++endif ()
diff --git a/var/spack/repos/builtin/packages/arpack-ng/package.py b/var/spack/repos/builtin/packages/arpack-ng/package.py
index fcd5171a7d..c7501b5a6d 100644
--- a/var/spack/repos/builtin/packages/arpack-ng/package.py
+++ b/var/spack/repos/builtin/packages/arpack-ng/package.py
@@ -54,6 +54,7 @@ class ArpackNg(Package):
     homepage = 'https://github.com/opencollab/arpack-ng'
     url = 'https://github.com/opencollab/arpack-ng/archive/3.3.0.tar.gz'
 
+    version('3.4.0', 'ae9ca13f2143a7ea280cb0e2fd4bfae4')
     version('3.3.0', 'ed3648a23f0a868a43ef44c97a21bad5')
 
     variant('shared', default=True, description='Enables the build of shared libraries')
@@ -61,16 +62,45 @@ class ArpackNg(Package):
 
     # The function pdlamch10 does not set the return variable. This is fixed upstream
     # see https://github.com/opencollab/arpack-ng/issues/34
-    patch('pdlamch10.patch', when='@3.3:')
+    patch('pdlamch10.patch', when='@3.3.0')
+
+    patch('make_install.patch', when='@3.4.0')
+    patch('parpack_cmake.patch', when='@3.4.0')
 
     depends_on('blas')
     depends_on('lapack')
-    depends_on('automake')
-    depends_on('autoconf')
-    depends_on('libtool@2.4.2:')
+    depends_on('automake', when='@3.3.0')
+    depends_on('autoconf', when='@3.3.0')
+    depends_on('libtool@2.4.2:', when='@3.3.0')
+    depends_on('cmake@2.8.6:', when='@3.4.0:')
 
     depends_on('mpi', when='+mpi')
 
+    @when('@3.4.0:')
+    def install(self, spec, prefix):
+
+        options = ['-DEXAMPLES=ON']
+        options.extend(std_cmake_args)
+
+        # Arpack do directly find_package(BLAS REQUIRED) and
+        # find_package(LAPACK REQUIRED).
+
+        if '+mpi' in spec:
+            options.append('-DMPI=ON')
+
+        # TODO: -DINTERFACE64=ON
+
+        if '+shared' in spec:
+            options.append('-DBUILD_SHARED_LIBS=ON')
+
+        cmake('.', *options)
+        make()
+        # TODO: make test does not work
+        # make('test')
+
+        make('install')
+
+    @when('@3.3.0')
     def install(self, spec, prefix):
         # Apparently autotools are not bootstrapped
         # TODO: switch to use the CMake build in the next version
diff --git a/var/spack/repos/builtin/packages/arpack-ng/parpack_cmake.patch b/var/spack/repos/builtin/packages/arpack-ng/parpack_cmake.patch
new file mode 100644
index 0000000000..0ba8600046
--- /dev/null
+++ b/var/spack/repos/builtin/packages/arpack-ng/parpack_cmake.patch
@@ -0,0 +1,17 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 607d221..345b7fc 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -113,11 +113,12 @@ set_target_properties(arpack PROPERTIES OUTPUT_NAME arpack${LIBSUFFIX})
+
+ if (MPI)
+ #    add_library(parpack SHARED
+-    add_library(parpack
++    add_library(parpack
+                         ${parpacksrc_STAT_SRCS}
+                         ${parpackutil_STAT_SRCS})
+
+     target_link_libraries(parpack ${MPI_Fortran_LIBRARIES})
++    target_link_libraries(parpack arpack)
+     set_target_properties(parpack PROPERTIES OUTPUT_NAME parpack${LIBSUFFIX})
+ endif ()
-- 
cgit v1.2.3-70-g09d2


From a47b3ba01bc3f93795c0702c3858784a64d3bd91 Mon Sep 17 00:00:00 2001
From: Denis Davydov <davydden@gmail.com>
Date: Wed, 6 Jul 2016 13:23:51 +0200
Subject: arpack-ng: use spec['mpi'].mpif77

---
 var/spack/repos/builtin/packages/arpack-ng/package.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/var/spack/repos/builtin/packages/arpack-ng/package.py b/var/spack/repos/builtin/packages/arpack-ng/package.py
index c7501b5a6d..5adc8c0b8c 100644
--- a/var/spack/repos/builtin/packages/arpack-ng/package.py
+++ b/var/spack/repos/builtin/packages/arpack-ng/package.py
@@ -113,7 +113,7 @@ class ArpackNg(Package):
         if '+mpi' in spec:
             options.extend([
                 '--enable-mpi',
-                'F77=mpif77' #FIXME: avoid hardcoding MPI wrapper names
+                'F77=%s' % spec['mpi'].mpif77
             ])
 
         if '~shared' in spec:
-- 
cgit v1.2.3-70-g09d2


From 63e45c586c93da209590c31e7185084af87fa316 Mon Sep 17 00:00:00 2001
From: Denis Davydov <davydden@gmail.com>
Date: Wed, 6 Jul 2016 13:27:02 +0200
Subject: arpack-ng: flake8 fixes and minor update of incode comments

---
 .../repos/builtin/packages/arpack-ng/package.py    | 31 ++++++++++++----------
 1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/var/spack/repos/builtin/packages/arpack-ng/package.py b/var/spack/repos/builtin/packages/arpack-ng/package.py
index 5adc8c0b8c..97f6ca3218 100644
--- a/var/spack/repos/builtin/packages/arpack-ng/package.py
+++ b/var/spack/repos/builtin/packages/arpack-ng/package.py
@@ -27,7 +27,8 @@ from spack import *
 
 class ArpackNg(Package):
     """
-    ARPACK-NG is a collection of Fortran77 subroutines designed to solve large scale eigenvalue problems.
+    ARPACK-NG is a collection of Fortran77 subroutines designed to solve large
+    scale eigenvalue problems.
 
     Important Features:
 
@@ -38,16 +39,17 @@ class ArpackNg(Package):
       Generalized Problems.
     * Routines for Banded Matrices - Standard or Generalized Problems.
     * Routines for The Singular Value Decomposition.
-    * Example driver routines that may be used as templates to implement numerous
-      Shift-Invert strategies for all problem types, data types and precision.
+    * Example driver routines that may be used as templates to implement
+      numerous Shift-Invert strategies for all problem types, data types and
+      precision.
 
-    This project is a joint project between Debian, Octave and Scilab in order to
-    provide a common and maintained version of arpack.
+    This project is a joint project between Debian, Octave and Scilab in order
+    to provide a common and maintained version of arpack.
 
-    Indeed, no single release has been published by Rice university for the last
-    few years and since many software (Octave, Scilab, R, Matlab...) forked it and
-    implemented their own modifications, arpack-ng aims to tackle this by providing
-    a common repository and maintained versions.
+    Indeed, no single release has been published by Rice university for the
+    last few years and since many software (Octave, Scilab, R, Matlab...)
+    forked it and implemented their own modifications, arpack-ng aims to tackle
+    this by providing a common repository and maintained versions.
 
     arpack-ng is replacing arpack almost everywhere.
     """
@@ -60,7 +62,8 @@ class ArpackNg(Package):
     variant('shared', default=True, description='Enables the build of shared libraries')
     variant('mpi', default=False, description='Activates MPI support')
 
-    # The function pdlamch10 does not set the return variable. This is fixed upstream
+    # The function pdlamch10 does not set the return variable.
+    # This is fixed upstream
     # see https://github.com/opencollab/arpack-ng/issues/34
     patch('pdlamch10.patch', when='@3.3.0')
 
@@ -82,8 +85,10 @@ class ArpackNg(Package):
         options = ['-DEXAMPLES=ON']
         options.extend(std_cmake_args)
 
-        # Arpack do directly find_package(BLAS REQUIRED) and
-        # find_package(LAPACK REQUIRED).
+        # TODO:
+        # Arpack calls directly find_package(BLAS REQUIRED) and
+        # find_package(LAPACK REQUIRED). Make sure correct Blas/Lapack are
+        # picked up.
 
         if '+mpi' in spec:
             options.append('-DMPI=ON')
@@ -103,8 +108,6 @@ class ArpackNg(Package):
     @when('@3.3.0')
     def install(self, spec, prefix):
         # Apparently autotools are not bootstrapped
-        # TODO: switch to use the CMake build in the next version
-        # rather than bootstrapping.
         which('libtoolize')()
         bootstrap = Executable('./bootstrap')
 
-- 
cgit v1.2.3-70-g09d2


From c8fc56686cbab2f7f9d2dd76740604d2daeb9783 Mon Sep 17 00:00:00 2001
From: Denis Davydov <davydden@gmail.com>
Date: Wed, 6 Jul 2016 13:42:59 +0200
Subject: arpack-ng: fix corrupted parpack_cmake.patch

---
 var/spack/repos/builtin/packages/arpack-ng/parpack_cmake.patch | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/var/spack/repos/builtin/packages/arpack-ng/parpack_cmake.patch b/var/spack/repos/builtin/packages/arpack-ng/parpack_cmake.patch
index 0ba8600046..9b11bea6ac 100644
--- a/var/spack/repos/builtin/packages/arpack-ng/parpack_cmake.patch
+++ b/var/spack/repos/builtin/packages/arpack-ng/parpack_cmake.patch
@@ -3,15 +3,16 @@ index 607d221..345b7fc 100644
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
 @@ -113,11 +113,12 @@ set_target_properties(arpack PROPERTIES OUTPUT_NAME arpack${LIBSUFFIX})
-
+ 
  if (MPI)
  #    add_library(parpack SHARED
--    add_library(parpack
+-    add_library(parpack 
 +    add_library(parpack
                          ${parpacksrc_STAT_SRCS}
                          ${parpackutil_STAT_SRCS})
-
+ 
      target_link_libraries(parpack ${MPI_Fortran_LIBRARIES})
 +    target_link_libraries(parpack arpack)
      set_target_properties(parpack PROPERTIES OUTPUT_NAME parpack${LIBSUFFIX})
  endif ()
+ 
-- 
cgit v1.2.3-70-g09d2


From 32e086f44adb88bfe11fe73a9c4b69a1dff862cf Mon Sep 17 00:00:00 2001
From: alalazo <massimiliano.culpo@googlemail.com>
Date: Wed, 6 Jul 2016 15:24:10 +0200
Subject: version : modified __repr__ to return a string representation of the
 object + unit tests

---
 lib/spack/spack/test/versions.py | 8 ++++++++
 lib/spack/spack/version.py       | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/spack/spack/test/versions.py b/lib/spack/spack/test/versions.py
index 4624f901c8..5f7d57b4e4 100644
--- a/lib/spack/spack/test/versions.py
+++ b/lib/spack/spack/test/versions.py
@@ -389,3 +389,11 @@ class VersionsTest(unittest.TestCase):
             self.assertEqual(v.dotted, '1.2.3')
             self.assertEqual(v.dashed, '1-2-3')
             self.assertEqual(v.underscored, '1_2_3')
+
+    def test_repr_and_str(self):
+        a = Version('1.2.3')
+        self.assertEqual(repr(a), 'Version(\'1.2.3\')')
+        b = eval(repr(a))
+        self.assertEqual(a, b)
+        self.assertEqual(str(a), '1.2.3')
+        self.assertEqual(str(a), str(b))
diff --git a/lib/spack/spack/version.py b/lib/spack/spack/version.py
index 858d581472..6f95e8a2f3 100644
--- a/lib/spack/spack/version.py
+++ b/lib/spack/spack/version.py
@@ -197,7 +197,7 @@ class Version(object):
         return tuple(self.version[idx])
 
     def __repr__(self):
-        return self.string
+        return 'Version(' + repr(self.string) + ')'
 
     def __str__(self):
         return self.string
-- 
cgit v1.2.3-70-g09d2


From 780a57367dd41f77d45f3e229c0a018c7695821f Mon Sep 17 00:00:00 2001
From: alalazo <massimiliano.culpo@googlemail.com>
Date: Wed, 6 Jul 2016 17:00:48 +0200
Subject: version : modified __getitem__ to return either an item or a Version
 instance + unit tests

---
 bin/spack                        |  2 +-
 lib/spack/spack/test/versions.py | 40 ++++++++++++++++++++++++++++++++++------
 lib/spack/spack/version.py       | 17 ++++++++++++++++-
 3 files changed, 51 insertions(+), 8 deletions(-)

diff --git a/bin/spack b/bin/spack
index e9307d1485..9b1276a866 100755
--- a/bin/spack
+++ b/bin/spack
@@ -77,7 +77,7 @@ import llnl.util.tty as tty
 from llnl.util.tty.color import *
 import spack
 from spack.error import SpackError
-import argparse
+from external import argparse
 
 # Command parsing
 parser = argparse.ArgumentParser(
diff --git a/lib/spack/spack/test/versions.py b/lib/spack/spack/test/versions.py
index 5f7d57b4e4..c051895ca3 100644
--- a/lib/spack/spack/test/versions.py
+++ b/lib/spack/spack/test/versions.py
@@ -391,9 +391,37 @@ class VersionsTest(unittest.TestCase):
             self.assertEqual(v.underscored, '1_2_3')
 
     def test_repr_and_str(self):
-        a = Version('1.2.3')
-        self.assertEqual(repr(a), 'Version(\'1.2.3\')')
-        b = eval(repr(a))
-        self.assertEqual(a, b)
-        self.assertEqual(str(a), '1.2.3')
-        self.assertEqual(str(a), str(b))
+
+        def check_repr_and_str(vrs):
+            a = Version(vrs)
+            self.assertEqual(repr(a), 'Version(\'' + vrs + '\')')
+            b = eval(repr(a))
+            self.assertEqual(a, b)
+            self.assertEqual(str(a), vrs)
+            self.assertEqual(str(a), str(b))
+
+        check_repr_and_str('1.2.3')
+        check_repr_and_str('R2016a')
+        check_repr_and_str('R2016a.2-3_4')
+
+    def test_get_item(self):
+        a = Version('0.1_2-3')
+        self.assertTrue(isinstance(a[1], int))
+        # Test slicing
+        b = a[0:2]
+        self.assertTrue(isinstance(b, Version))
+        self.assertEqual(b, Version('0.1'))
+        self.assertEqual(repr(b), 'Version(\'0.1\')')
+        self.assertEqual(str(b), '0.1')
+        b = a[0:3]
+        self.assertTrue(isinstance(b, Version))
+        self.assertEqual(b, Version('0.1_2'))
+        self.assertEqual(repr(b), 'Version(\'0.1_2\')')
+        self.assertEqual(str(b), '0.1_2')
+        b = a[1:]
+        self.assertTrue(isinstance(b, Version))
+        self.assertEqual(b, Version('1_2-3'))
+        self.assertEqual(repr(b), 'Version(\'1_2-3\')')
+        self.assertEqual(str(b), '1_2-3')
+        # Raise TypeError on tuples
+        self.assertRaises(TypeError, b.__getitem__, 1, 2)
\ No newline at end of file
diff --git a/lib/spack/spack/version.py b/lib/spack/spack/version.py
index 6f95e8a2f3..7e5878383d 100644
--- a/lib/spack/spack/version.py
+++ b/lib/spack/spack/version.py
@@ -44,6 +44,7 @@ be called on any of the types::
   concrete
 """
 import re
+import numbers
 from bisect import bisect_left
 from functools import wraps
 
@@ -194,7 +195,21 @@ class Version(object):
         return iter(self.version)
 
     def __getitem__(self, idx):
-        return tuple(self.version[idx])
+        cls = type(self)
+        if isinstance(idx, numbers.Integral):
+            return self.version[idx]
+        elif isinstance(idx, slice):
+            # Currently len(self.separators) == len(self.version) - 1
+            extendend_separators = self.separators + ('',)
+            string_arg = []
+            for token, separator in zip(self.version, extendend_separators)[idx]:
+                string_arg.append(str(token))
+                string_arg.append(str(separator))
+            string_arg.pop()  # We don't need the last separator
+            string_arg = ''.join(string_arg)
+            return cls(string_arg)
+        message = '{cls.__name__} indices must be integers'
+        raise TypeError(message.format(cls=cls))
 
     def __repr__(self):
         return 'Version(' + repr(self.string) + ')'
-- 
cgit v1.2.3-70-g09d2


From 9b926a480f84c62cf4ed23c26b950dd7c89fb1ad Mon Sep 17 00:00:00 2001
From: alalazo <massimiliano.culpo@googlemail.com>
Date: Wed, 6 Jul 2016 17:03:32 +0200
Subject: qa : flake8 issues

---
 bin/spack                        | 2 +-
 lib/spack/spack/test/versions.py | 2 +-
 lib/spack/spack/version.py       | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/bin/spack b/bin/spack
index 9b1276a866..e9307d1485 100755
--- a/bin/spack
+++ b/bin/spack
@@ -77,7 +77,7 @@ import llnl.util.tty as tty
 from llnl.util.tty.color import *
 import spack
 from spack.error import SpackError
-from external import argparse
+import argparse
 
 # Command parsing
 parser = argparse.ArgumentParser(
diff --git a/lib/spack/spack/test/versions.py b/lib/spack/spack/test/versions.py
index c051895ca3..a3a328fb14 100644
--- a/lib/spack/spack/test/versions.py
+++ b/lib/spack/spack/test/versions.py
@@ -424,4 +424,4 @@ class VersionsTest(unittest.TestCase):
         self.assertEqual(repr(b), 'Version(\'1_2-3\')')
         self.assertEqual(str(b), '1_2-3')
         # Raise TypeError on tuples
-        self.assertRaises(TypeError, b.__getitem__, 1, 2)
\ No newline at end of file
+        self.assertRaises(TypeError, b.__getitem__, 1, 2)
diff --git a/lib/spack/spack/version.py b/lib/spack/spack/version.py
index 7e5878383d..6839643941 100644
--- a/lib/spack/spack/version.py
+++ b/lib/spack/spack/version.py
@@ -202,9 +202,9 @@ class Version(object):
             # Currently len(self.separators) == len(self.version) - 1
             extendend_separators = self.separators + ('',)
             string_arg = []
-            for token, separator in zip(self.version, extendend_separators)[idx]:
+            for token, sep in zip(self.version, extendend_separators)[idx]:
                 string_arg.append(str(token))
-                string_arg.append(str(separator))
+                string_arg.append(str(sep))
             string_arg.pop()  # We don't need the last separator
             string_arg = ''.join(string_arg)
             return cls(string_arg)
-- 
cgit v1.2.3-70-g09d2


From 3d755a148b1940218a3c990b1d8342ea88ae8012 Mon Sep 17 00:00:00 2001
From: Denis Davydov <davydden@gmail.com>
Date: Wed, 6 Jul 2016 18:29:56 +0200
Subject: arpack-ng: fix binaries for macOS

---
 var/spack/repos/builtin/packages/arpack-ng/package.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/var/spack/repos/builtin/packages/arpack-ng/package.py b/var/spack/repos/builtin/packages/arpack-ng/package.py
index 97f6ca3218..d9021f8043 100644
--- a/var/spack/repos/builtin/packages/arpack-ng/package.py
+++ b/var/spack/repos/builtin/packages/arpack-ng/package.py
@@ -84,6 +84,7 @@ class ArpackNg(Package):
 
         options = ['-DEXAMPLES=ON']
         options.extend(std_cmake_args)
+        options.append('-DCMAKE_INSTALL_NAME_DIR:PATH=%s/lib' % prefix)
 
         # TODO:
         # Arpack calls directly find_package(BLAS REQUIRED) and
-- 
cgit v1.2.3-70-g09d2


From 61fe89bda0d5690a4851cde5baa7d55f6a43a6bd Mon Sep 17 00:00:00 2001
From: Paul Hopkins <paul.hopkins@ligo.org>
Date: Wed, 6 Jul 2016 18:29:54 +0100
Subject: Add ucs4 unicode variant to Python package

---
 var/spack/repos/builtin/packages/python/package.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/var/spack/repos/builtin/packages/python/package.py b/var/spack/repos/builtin/packages/python/package.py
index 8033c52b91..d019133585 100644
--- a/var/spack/repos/builtin/packages/python/package.py
+++ b/var/spack/repos/builtin/packages/python/package.py
@@ -47,6 +47,8 @@ class Python(Package):
 
     extendable = True
 
+    variant('ucs4', default=False, description='Enable UCS4 unicode strings')
+
     depends_on("openssl")
     depends_on("bzip2")
     depends_on("readline")
@@ -82,6 +84,9 @@ class Python(Package):
             "LDFLAGS=-L{0}".format(ldflags)
         ]
 
+        if '+ucs4' in spec:
+            config_args.append('--enable-unicode=ucs4')
+
         if spec.satisfies('@3:'):
             config_args.append('--without-ensurepip')
 
-- 
cgit v1.2.3-70-g09d2


From 57eaea2e8c23a2533fa5235e97f1e3ca3f517dab Mon Sep 17 00:00:00 2001
From: Denis Davydov <davydden@gmail.com>
Date: Wed, 6 Jul 2016 20:34:05 +0200
Subject: oce: add 0.17.2; fix running tests

---
 var/spack/repos/builtin/packages/oce/package.py | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/var/spack/repos/builtin/packages/oce/package.py b/var/spack/repos/builtin/packages/oce/package.py
index 0f0fcfb733..b93f1317ef 100644
--- a/var/spack/repos/builtin/packages/oce/package.py
+++ b/var/spack/repos/builtin/packages/oce/package.py
@@ -33,6 +33,7 @@ class Oce(Package):
     homepage = "https://github.com/tpaviot/oce"
     url      = "https://github.com/tpaviot/oce/archive/OCE-0.17.tar.gz"
 
+    version('0.17.2', 'bf2226be4cd192606af677cf178088e5')
     version('0.17.1', '36c67b87093c675698b483454258af91')
     version('0.17'  , 'f1a89395c4b0d199bea3db62b85f818d')
     version('0.16.1', '4d591b240c9293e879f50d86a0cb2bb3')
@@ -77,15 +78,8 @@ class Oce(Package):
                 '-DOCE_OSX_USE_COCOA:BOOL=ON',
             ])
 
-        cmake('.', *options)
+        options.append('-DCMAKE_INSTALL_NAME_DIR:PATH=%s/lib' % prefix)
 
+        cmake('.', *options)
         make("install/strip")
-
-        # OCE tests build is brocken at least on Darwin.
-        # Unit tests are linked against libTKernel.10.dylib isntead of /full/path/libTKernel.10.dylib
-        # see https://github.com/tpaviot/oce/issues/612
-        # make("test")
-
-        # The shared libraries are not installed correctly on Darwin; correct this
-        if (sys.platform == 'darwin'):
-            fix_darwin_install_name(prefix.lib)
+        make("test")
-- 
cgit v1.2.3-70-g09d2


From 4e27d91351f1f2f29adec9d1be44e25cbb79bb9f Mon Sep 17 00:00:00 2001
From: Greg Lee <lee218@llnl.gov>
Date: Tue, 5 Jul 2016 14:28:24 -0700
Subject: flake 8 fixes

---
 .../repos/builtin/packages/suite-sparse/package.py | 31 +++++++++++-----------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/var/spack/repos/builtin/packages/suite-sparse/package.py b/var/spack/repos/builtin/packages/suite-sparse/package.py
index bc25fa8c6c..1dc64f385f 100644
--- a/var/spack/repos/builtin/packages/suite-sparse/package.py
+++ b/var/spack/repos/builtin/packages/suite-sparse/package.py
@@ -44,32 +44,33 @@ class SuiteSparse(Package):
     depends_on('metis@5.1.0', when='@4.5.1')
     depends_on('metis@5.1.0', when='@4.5.3')
     # FIXME:
-    # in @4.5.1. TBB support in SPQR seems to be broken as TBB-related linkng flags
-    # does not seem to be used, which leads to linking errors on Linux.
+    # in @4.5.1. TBB support in SPQR seems to be broken as TBB-related linkng
+    # flags does not seem to be used, which leads to linking errors on Linux.
     # Try re-enabling in future versions.
     # depends_on('tbb', when='+tbb')
 
     def install(self, spec, prefix):
-        # The build system of SuiteSparse is quite old-fashioned
-        # It's basically a plain Makefile which include an header (SuiteSparse_config/SuiteSparse_config.mk)
-        # with a lot of convoluted logic in it.
-        # Any kind of customization will need to go through filtering of that file
+        # The build system of SuiteSparse is quite old-fashioned.
+        # It's basically a plain Makefile which include an header
+        # (SuiteSparse_config/SuiteSparse_config.mk)with a lot of convoluted
+        # logic in it. Any kind of customization will need to go through
+        # filtering of that file
 
         make_args = ['INSTALL=%s' % prefix]
 
         # inject Spack compiler wrappers
         make_args.extend([
-             'AUTOCC=no',
-             'CC=cc',
-             'CXX=c++',
-             'F77=f77',
+            'AUTOCC=no',
+            'CC=cc',
+            'CXX=c++',
+            'F77=f77',
         ])
 
         # use Spack's metis in CHOLMOD/Partition module,
         # otherwise internal Metis will be compiled
         make_args.extend([
-             'MY_METIS_LIB=-L%s -lmetis' % spec['metis'].prefix.lib,
-             'MY_METIS_INC=%s' % spec['metis'].prefix.include,
+            'MY_METIS_LIB=-L%s -lmetis' % spec['metis'].prefix.lib,
+            'MY_METIS_INC=%s' % spec['metis'].prefix.include,
         ])
 
         # Intel TBB in SuiteSparseQR
@@ -80,10 +81,10 @@ class SuiteSparse(Package):
             ])
 
         # BLAS arguments require path to libraries
-        # FIXME : (blas / lapack always provide libblas and liblapack as aliases)
+        # FIXME: (blas/lapack always provide libblas and liblapack as aliases)
         if '@4.5.1' in spec:
-            # adding -lstdc++ is clearly an ugly way to do this, but it follows suit
-            # with the TCOV path of SparseSuite 4.5.1's Suitesparse_config.mk 
+            # adding -lstdc++ is clearly an ugly way to do this, but it follows
+            # with the TCOV path of SparseSuite 4.5.1's Suitesparse_config.mk
             make_args.extend([
                 'BLAS=-lblas -lstdc++',
                 'LAPACK=-llapack'
-- 
cgit v1.2.3-70-g09d2


From 3df0f1902d84223dba02692d80439ee928f28285 Mon Sep 17 00:00:00 2001
From: Greg Lee <lee218@llnl.gov>
Date: Wed, 6 Jul 2016 12:15:20 -0700
Subject: clean up suitesparse deps

---
 var/spack/repos/builtin/packages/suite-sparse/package.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/var/spack/repos/builtin/packages/suite-sparse/package.py b/var/spack/repos/builtin/packages/suite-sparse/package.py
index 1dc64f385f..2cc89b843f 100644
--- a/var/spack/repos/builtin/packages/suite-sparse/package.py
+++ b/var/spack/repos/builtin/packages/suite-sparse/package.py
@@ -41,8 +41,7 @@ class SuiteSparse(Package):
     depends_on('blas')
     depends_on('lapack')
 
-    depends_on('metis@5.1.0', when='@4.5.1')
-    depends_on('metis@5.1.0', when='@4.5.3')
+    depends_on('metis@5.1.0', when='@4.5.1:')
     # FIXME:
     # in @4.5.1. TBB support in SPQR seems to be broken as TBB-related linkng
     # flags does not seem to be used, which leads to linking errors on Linux.
-- 
cgit v1.2.3-70-g09d2


From 081918d71a9d58108b8617d8324fd51542161a1e Mon Sep 17 00:00:00 2001
From: Denis Davydov <davydden@gmail.com>
Date: Wed, 6 Jul 2016 22:45:30 +0200
Subject: add --run-tests argument for install()

---
 lib/spack/spack/cmd/install.py |  5 +++++
 lib/spack/spack/package.py     | 18 +++++++++++++-----
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/lib/spack/spack/cmd/install.py b/lib/spack/spack/cmd/install.py
index 9d3175786b..fadfa7f7c3 100644
--- a/lib/spack/spack/cmd/install.py
+++ b/lib/spack/spack/cmd/install.py
@@ -55,6 +55,10 @@ def setup_parser(subparser):
         help="Fake install.  Just remove the prefix and touch a fake file in it.")
     subparser.add_argument(
         'packages', nargs=argparse.REMAINDER, help="specs of packages to install")
+    subparser.add_argument(
+        '--run-tests', action='store_true', dest='run_tests',
+        help="Run tests during installation of a package.")
+
 
 
 def install(parser, args):
@@ -77,6 +81,7 @@ def install(parser, args):
                 keep_stage=args.keep_stage,
                 ignore_deps=args.ignore_deps,
                 make_jobs=args.jobs,
+                run_tests=args.run_tests,
                 verbose=args.verbose,
                 fake=args.fake,
                 explicit=True)
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index 53c521b776..bce6af9c02 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -311,6 +311,8 @@ class Package(object):
     parallel = True
     """# jobs to use for parallel make. If set, overrides default of ncpus."""
     make_jobs = None
+    """By default do not run tests within package's install()"""
+    run_tests = False
     """Most packages are NOT extendable. Set to True if you want extensions."""
     extendable = False
     """List of prefix-relative file paths (or a single path). If these do
@@ -755,7 +757,7 @@ class Package(object):
             self.stage.check()
 
         self.stage.cache_local()
-        
+
 
     def do_stage(self, mirror_only=False):
         """Unpacks the fetched tarball, then changes into the expanded tarball
@@ -881,6 +883,7 @@ class Package(object):
                    skip_patch=False,
                    verbose=False,
                    make_jobs=None,
+                   run_tests=False,
                    fake=False,
                    explicit=False,
                    install_phases = install_phases):
@@ -900,6 +903,7 @@ class Package(object):
         skip_patch  -- Skip patch stage of build if True.
         verbose     -- Display verbose build output (by default, suppresses it)
         make_jobs   -- Number of make jobs to use for install. Default is ncpus
+        run_tests   -- Runn tests within the package's install()
         """
         if not self.spec.concrete:
             raise ValueError("Can only install concrete packages.")
@@ -930,7 +934,11 @@ class Package(object):
                                          fake=fake,
                                          skip_patch=skip_patch,
                                          verbose=verbose,
-                                         make_jobs=make_jobs)
+                                         make_jobs=make_jobs,
+                                         run_tests=run_tests)
+
+        # Set run_tests flag before starting build.
+        self.run_tests = run_tests
 
         # Set parallelism before starting build.
         self.make_jobs = make_jobs
@@ -1527,15 +1535,15 @@ class StagedPackage(Package):
         raise InstallError("Package %s provides no install_setup() method!" % self.name)
 
     def install_configure(self):
-        """Runs the configure process."""   
+        """Runs the configure process."""
         raise InstallError("Package %s provides no install_configure() method!" % self.name)
 
     def install_build(self):
-        """Runs the build process."""       
+        """Runs the build process."""
         raise InstallError("Package %s provides no install_build() method!" % self.name)
 
     def install_install(self):
-        """Runs the install process."""     
+        """Runs the install process."""
         raise InstallError("Package %s provides no install_install() method!" % self.name)
 
     def install(self, spec, prefix):
-- 
cgit v1.2.3-70-g09d2


From c096bb332a7710a0618049f0e2df1800771bd3f9 Mon Sep 17 00:00:00 2001
From: Denis Davydov <davydden@gmail.com>
Date: Wed, 6 Jul 2016 22:45:43 +0200
Subject: petsc: fix unit tests

---
 var/spack/repos/builtin/packages/petsc/package.py | 30 ++++++++++++-----------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/var/spack/repos/builtin/packages/petsc/package.py b/var/spack/repos/builtin/packages/petsc/package.py
index 6a7bee9788..90afdbdb90 100644
--- a/var/spack/repos/builtin/packages/petsc/package.py
+++ b/var/spack/repos/builtin/packages/petsc/package.py
@@ -149,20 +149,22 @@ class Petsc(Package):
         make("install")
 
         # solve Poisson equation in 2D to make sure nothing is broken:
-        with working_dir('src/ksp/ksp/examples/tutorials'):
-            cc = os.environ['CC'] if '~mpi' in self.spec else self.spec['mpi'].mpicc  # NOQA: ignore=E501
-            os.system('%s ex50.c -I%s -L%s -lpetsc -o ex50' % (
-                cc, prefix.include, prefix.lib))
-            ex50 = Executable('./ex50')
-            ex50('-da_grid_x', '4', '-da_grid_y', '4')
-            if 'superlu-dist' in spec:
-                ex50('-da_grid_x', '4', '-da_grid_y', '4', '-pc_type', 'lu', '-pc_factor_mat_solver_package', 'superlu_dist')  # NOQA: ignore=E501
-
-            if 'mumps' in spec:
-                ex50('-da_grid_x', '4', '-da_grid_y', '4', '-pc_type', 'lu', '-pc_factor_mat_solver_package', 'mumps')  # NOQA: ignore=E501
-
-            if 'hypre' in spec:
-                ex50('-da_grid_x', '4', '-da_grid_y', '4', '-pc_type', 'hypre', '-pc_hypre_type', 'boomeramg')  # NOQA: ignore=E501
+        if ('mpi' in spec) and self.run_tests:
+            with working_dir('src/ksp/ksp/examples/tutorials'):
+                env['PETSC_DIR'] = self.prefix
+                cc = Executable(spec['mpi'].mpicc)
+                cc('ex50.c', '-I%s' % prefix.include, '-L%s' % prefix.lib,
+                   '-lpetsc', '-o', 'ex50')
+                run = Executable(join_path(spec['mpi'].prefix.bin, 'mpirun'))
+                run('ex50', '-da_grid_x', '4', '-da_grid_y', '4')
+                if 'superlu-dist' in spec:
+                    run('ex50', '-da_grid_x', '4', '-da_grid_y', '4', '-pc_type', 'lu', '-pc_factor_mat_solver_package', 'superlu_dist')  # NOQA: ignore=E501
+
+                if 'mumps' in spec:
+                    run('ex50', '-da_grid_x', '4', '-da_grid_y', '4', '-pc_type', 'lu', '-pc_factor_mat_solver_package', 'mumps')  # NOQA: ignore=E501
+
+                if 'hypre' in spec:
+                    run('ex50', '-da_grid_x', '4', '-da_grid_y', '4', '-pc_type', 'hypre', '-pc_hypre_type', 'boomeramg')  # NOQA: ignore=E501
 
     def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
         # set up PETSC_DIR for everyone using PETSc package
-- 
cgit v1.2.3-70-g09d2


From 14cef6eab8a29ac8cb93c6d528b0e62201a7f0d3 Mon Sep 17 00:00:00 2001
From: Denis Davydov <davydden@gmail.com>
Date: Wed, 6 Jul 2016 22:51:20 +0200
Subject: oce: flake8 fixes

---
 var/spack/repos/builtin/packages/oce/package.py | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/var/spack/repos/builtin/packages/oce/package.py b/var/spack/repos/builtin/packages/oce/package.py
index b93f1317ef..06b6b7cbb0 100644
--- a/var/spack/repos/builtin/packages/oce/package.py
+++ b/var/spack/repos/builtin/packages/oce/package.py
@@ -23,21 +23,22 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 ##############################################################################
 from spack import *
-import platform, sys
+import platform
+
 
 class Oce(Package):
-    """
-    Open CASCADE Community Edition:
-    patches/improvements/experiments contributed by users over the official Open CASCADE library.
+    """Open CASCADE Community Edition:
+    patches/improvements/experiments contributed by users over the official
+    Open CASCADE library.
     """
     homepage = "https://github.com/tpaviot/oce"
     url      = "https://github.com/tpaviot/oce/archive/OCE-0.17.tar.gz"
 
     version('0.17.2', 'bf2226be4cd192606af677cf178088e5')
     version('0.17.1', '36c67b87093c675698b483454258af91')
-    version('0.17'  , 'f1a89395c4b0d199bea3db62b85f818d')
+    version('0.17',   'f1a89395c4b0d199bea3db62b85f818d')
     version('0.16.1', '4d591b240c9293e879f50d86a0cb2bb3')
-    version('0.16'  , '7a4b4df5a104d75a537e25e7dd387eca')
+    version('0.16',   '7a4b4df5a104d75a537e25e7dd387eca')
 
     variant('tbb', default=True, description='Build with Intel Threading Building Blocks')
 
@@ -50,8 +51,7 @@ class Oce(Package):
     # http://tracker.dev.opencascade.org/view.php?id=26042
     # https://github.com/tpaviot/oce/issues/605
     # https://github.com/tpaviot/oce/commit/61cb965b9ffeca419005bc15e635e67589c421dd.patch
-    patch('null.patch',when='@0.16:0.17.1')
-
+    patch('null.patch', when='@0.16:0.17.1')
 
     def install(self, spec, prefix):
         options = []
@@ -64,7 +64,8 @@ class Oce(Package):
             '-DOCE_DISABLE_X11:BOOL=ON',
             '-DOCE_DRAW:BOOL=OFF',
             '-DOCE_MODEL:BOOL=ON',
-            '-DOCE_MULTITHREAD_LIBRARY:STRING=%s' % ('TBB' if '+tbb' in spec else 'NONE'),
+            '-DOCE_MULTITHREAD_LIBRARY:STRING=%s' % (
+                'TBB' if '+tbb' in spec else 'NONE'),
             '-DOCE_OCAF:BOOL=ON',
             '-DOCE_USE_TCL_TEST_FRAMEWORK:BOOL=OFF',
             '-DOCE_VISUALISATION:BOOL=OFF',
-- 
cgit v1.2.3-70-g09d2


From 663b30b3e89f2025a2a4746a61efd98416aeecea Mon Sep 17 00:00:00 2001
From: Gregory Becker <becker33@llnl.gov>
Date: Wed, 6 Jul 2016 12:02:08 -0700
Subject: Update target autodetection for linux platform

---
 lib/spack/spack/platforms/linux.py | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/lib/spack/spack/platforms/linux.py b/lib/spack/spack/platforms/linux.py
index 4d8adac384..4d3f59c320 100644
--- a/lib/spack/spack/platforms/linux.py
+++ b/lib/spack/spack/platforms/linux.py
@@ -1,16 +1,23 @@
 import subprocess
+import platform
 from spack.architecture import Platform, Target
 from spack.operating_systems.linux_distro import LinuxDistro
 
 class Linux(Platform):
     priority    = 90
-    front_end   = 'x86_64'
-    back_end    = 'x86_64'
-    default     = 'x86_64'
 
     def __init__(self):
         super(Linux, self).__init__('linux')
-        self.add_target(self.default, Target(self.default))
+        self.add_target('x86_64', Target('x86_64'))
+        self.add_target('ppc64le', Target('ppc64le'))
+
+        self.default = platform.machine()
+        self.front_end = platform.machine()
+        self.back_end = platform.machine()
+
+        if self.default not in self.targets:
+            self.add_target(self.default, Target(self.default))
+
         linux_dist = LinuxDistro()
         self.default_os = str(linux_dist)
         self.front_os = self.default_os
-- 
cgit v1.2.3-70-g09d2


From 403a55afb2655045e9d7752df3d2dec7c1bbf395 Mon Sep 17 00:00:00 2001
From: Gregory Becker <becker33@llnl.gov>
Date: Wed, 6 Jul 2016 13:33:37 -0700
Subject: Minor bug fix

---
 lib/spack/spack/test/mock_packages_test.py | 18 ------------------
 1 file changed, 18 deletions(-)

diff --git a/lib/spack/spack/test/mock_packages_test.py b/lib/spack/spack/test/mock_packages_test.py
index e1acc32cb7..c8b06cd7d7 100644
--- a/lib/spack/spack/test/mock_packages_test.py
+++ b/lib/spack/spack/test/mock_packages_test.py
@@ -82,15 +82,6 @@ compilers:
       f77: None
       fc: None
     modules: 'None'
-- compiler:
-    spec: clang@3.3
-    operating_system: redhat6
-    paths:
-      cc: /path/to/clang
-      cxx: /path/to/clang++
-      f77: None
-      fc: None
-    modules: 'None'
 - compiler:
     spec: clang@3.3
     operating_system: yosemite
@@ -118,15 +109,6 @@ compilers:
     operating_system: SuSE11
     spec: gcc@4.5.0
     modules: 'None'
-- compiler:
-    paths:
-      cc: /path/to/gcc
-      cxx: /path/to/g++
-      f77: /path/to/gfortran
-      fc: /path/to/gfortran
-    operating_system: redhat6
-    spec: gcc@4.5.0
-    modules: 'None'
 - compiler:
     paths:
       cc: /path/to/gcc
-- 
cgit v1.2.3-70-g09d2


From 1b53452618154b47caa5a4d8493ff025c9a3aa10 Mon Sep 17 00:00:00 2001
From: Stephen Herbein <stephen272@gmail.com>
Date: Thu, 7 Jul 2016 17:41:53 -0700
Subject: docbook-xml: replace 'cp -t' with install_tree

'-t' is not supported by the default cp on Mac OS X

replace with install/install_tree

cannot just use install_tree since shutil.copytree insists that the dst
directory not exist
---
 var/spack/repos/builtin/packages/docbook-xml/package.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/var/spack/repos/builtin/packages/docbook-xml/package.py b/var/spack/repos/builtin/packages/docbook-xml/package.py
index 9c22174610..87137168f3 100644
--- a/var/spack/repos/builtin/packages/docbook-xml/package.py
+++ b/var/spack/repos/builtin/packages/docbook-xml/package.py
@@ -23,7 +23,6 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 ##############################################################################
 import os
-import glob
 from spack import *
 
 
@@ -35,9 +34,10 @@ class DocbookXml(Package):
     version('4.5', '03083e288e87a7e829e437358da7ef9e')
 
     def install(self, spec, prefix):
-        cp = which('cp')
-
-        install_args = ['-a', '-t', prefix]
-        install_args.extend(glob.glob('*'))
-
-        cp(*install_args)
+        for item in os.listdir('.'):
+            src = os.path.abspath(item)
+            dst = os.path.join(prefix, item)
+            if os.path.isdir(item):
+                install_tree(src, dst, symlinks=True)
+            else:
+                install(src, dst)
-- 
cgit v1.2.3-70-g09d2


From 1a1bf31032fca3d61d1ae9209f9c77a4822eb733 Mon Sep 17 00:00:00 2001
From: Stephen Herbein <stephen272@gmail.com>
Date: Thu, 7 Jul 2016 18:54:34 -0700
Subject: lua: switch self.version[:2] to .up_to(2)

Previous package would not install correctly, would throw:
return os.path.join('share', 'lua', '%d.%d' % self.version[:2])
TypeError: %d format: a number is required, not Version
---
 var/spack/repos/builtin/packages/lua/package.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/var/spack/repos/builtin/packages/lua/package.py b/var/spack/repos/builtin/packages/lua/package.py
index 761932361b..48c1c6a919 100644
--- a/var/spack/repos/builtin/packages/lua/package.py
+++ b/var/spack/repos/builtin/packages/lua/package.py
@@ -140,11 +140,11 @@ class Lua(Package):
 
     @property
     def lua_lib_dir(self):
-        return os.path.join('lib', 'lua', '%d.%d' % self.version[:2])
+        return os.path.join('lib', 'lua', self.version.up_to(2))
 
     @property
     def lua_share_dir(self):
-        return os.path.join('share', 'lua', '%d.%d' % self.version[:2])
+        return os.path.join('share', 'lua', self.version.up_to(2))
 
     def setup_dependent_package(self, module, ext_spec):
         """
-- 
cgit v1.2.3-70-g09d2


From bb8a8ecda33bebe1dd19f84ded752432ab5855bf Mon Sep 17 00:00:00 2001
From: Stephen Herbein <stephen272@gmail.com>
Date: Fri, 8 Jul 2016 10:14:02 -0700
Subject: json-c: fix build by running serially

---
 var/spack/repos/builtin/packages/libjson-c/package.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/var/spack/repos/builtin/packages/libjson-c/package.py b/var/spack/repos/builtin/packages/libjson-c/package.py
index 75f3e130ad..662ed3cb5a 100644
--- a/var/spack/repos/builtin/packages/libjson-c/package.py
+++ b/var/spack/repos/builtin/packages/libjson-c/package.py
@@ -24,6 +24,7 @@
 ##############################################################################
 from spack import *
 
+
 class LibjsonC(Package):
     """ A JSON implementation in C """
     homepage = "https://github.com/json-c/json-c/wiki"
@@ -34,5 +35,5 @@ class LibjsonC(Package):
     def install(self, spec, prefix):
         configure('--prefix=%s' % prefix)
 
-        make()
+        make(parallel=False)
         make("install")
-- 
cgit v1.2.3-70-g09d2


From 1b9e8a0e65e927c74ea44a881c932a33cfb1745b Mon Sep 17 00:00:00 2001
From: George Hartzell <hartzell@alerce.com>
Date: Fri, 8 Jul 2016 11:01:08 -0700
Subject: Fix typo

Comamnds -> Commands
---
 lib/spack/docs/basic_usage.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/spack/docs/basic_usage.rst b/lib/spack/docs/basic_usage.rst
index 8fad96010e..dbad0a9f6d 100644
--- a/lib/spack/docs/basic_usage.rst
+++ b/lib/spack/docs/basic_usage.rst
@@ -1154,7 +1154,7 @@ Modules may be loaded recursively with the command:
 
 More than one spec may be placed on the command line here.
 
-Module Comamnds for Shell Scripts
+Module Commands for Shell Scripts
 ``````````````````````````````````
 
 Although Spack is flexbile, the ``module`` command is much faster.
-- 
cgit v1.2.3-70-g09d2


From c8137194f0f09c594cafd417ef820c3ecf5ead85 Mon Sep 17 00:00:00 2001
From: Erik Schnetter <schnetter@gmail.com>
Date: Fri, 8 Jul 2016 15:20:09 -0400
Subject: Update Cereal to 1.2.0

---
 var/spack/repos/builtin/packages/cereal/package.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/var/spack/repos/builtin/packages/cereal/package.py b/var/spack/repos/builtin/packages/cereal/package.py
index c53c667efb..80198fa224 100644
--- a/var/spack/repos/builtin/packages/cereal/package.py
+++ b/var/spack/repos/builtin/packages/cereal/package.py
@@ -31,6 +31,7 @@ class Cereal(Package):
     homepage = "http://uscilab.github.io/cereal/"
     url      = "https://github.com/USCiLab/cereal/archive/v1.1.2.tar.gz"
 
+    version('1.2.0', 'e372c9814696481dbdb7d500e1410d2b')
     version('1.1.2', '34d4ad174acbff005c36d4d10e48cbb9')
     version('1.1.1', '0ceff308c38f37d5b5f6df3927451c27')
     version('1.1.0', '9f2d5f72e935c54f4c6d23e954ce699f')
-- 
cgit v1.2.3-70-g09d2


From 33d0660abc19d33c6e1b5fa21f97f9292a2008d7 Mon Sep 17 00:00:00 2001
From: Glenn Johnson <glenn-johnson@uiowa.edu>
Date: Fri, 8 Jul 2016 15:11:37 -0500
Subject: Have ``spack create`` default to lower case name

This will create package directories with lower case names when using
`spack create`. The documentation was modified to reflect this.
---
 lib/spack/docs/packaging_guide.rst | 32 +++++++++++++++++++-------------
 lib/spack/spack/cmd/create.py      |  2 +-
 2 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/lib/spack/docs/packaging_guide.rst b/lib/spack/docs/packaging_guide.rst
index 6cea4da14f..ae83dd8089 100644
--- a/lib/spack/docs/packaging_guide.rst
+++ b/lib/spack/docs/packaging_guide.rst
@@ -36,10 +36,11 @@ Creating & editing packages
 ``spack create``
 ~~~~~~~~~~~~~~~~~~~~~
 
-The ``spack create`` command generates a boilerplate package template
-from a URL.  The URL should point to a tarball or other software
-archive.  In most cases, ``spack create`` plus a few modifications is
-all you need to get a package working.
+The ``spack create`` command creates a directory with the package name and
+generates a ``package.py`` file with a boilerplate package template from a URL.
+The URL should point to a tarball or other software archive.  In most cases,
+``spack create`` plus a few modifications is all you need to get a package
+working.
 
 Here's an example:
 
@@ -47,12 +48,16 @@ Here's an example:
 
    $ spack create http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz
 
-Spack examines the tarball URL and tries to figure out the name of the
-package to be created. It also tries to determine what version strings
-look like for this package. Using this information, it will try to
-find *additional* versions by spidering the package's webpage.  If it
-finds multiple versions, Spack prompts you to tell it how many
-versions you want to download and checksum:
+Spack examines the tarball URL and tries to figure out the name of the package
+to be created. Once the name is determined a directory in the appropriate
+repository is created with that name. Spack prefers, but does not require, that
+names be lower case so the directory name will be lower case when ``spack
+create`` generates it. In cases where it is desired to have mixed case or upper
+case simply rename the directory. Spack also tries to determine what version
+strings look like for this package. Using this information, it will try to find
+*additional* versions by spidering the package's webpage.  If it finds multiple
+versions, Spack prompts you to tell it how many versions you want to download
+and checksum:
 
 .. code-block:: sh
 
@@ -297,9 +302,10 @@ directories or files (like patches) that it needs to build.
 Package Names
 ~~~~~~~~~~~~~~~~~~
 
-Packages are named after the directory containing ``package.py``.  So,
-``libelf``'s ``package.py`` lives in a directory called ``libelf``.
-The ``package.py`` file defines a class called ``Libelf``, which
+Packages are named after the directory containing ``package.py``. It is
+preferred, but not required, that the directory, and thus the package name, are
+lower case. So, ``libelf``'s ``package.py`` lives in a directory called
+``libelf``.  The ``package.py`` file defines a class called ``Libelf``, which
 extends Spack's ``Package`` class.  for example, here is
 ``$SPACK_ROOT/var/spack/repos/builtin/packages/libelf/package.py``:
 
diff --git a/lib/spack/spack/cmd/create.py b/lib/spack/spack/cmd/create.py
index f5f234d7a7..18c748e483 100644
--- a/lib/spack/spack/cmd/create.py
+++ b/lib/spack/spack/cmd/create.py
@@ -325,7 +325,7 @@ def create(parser, args):
     # Figure out a name and repo for the package.
     name, version = guess_name_and_version(url, args)
     spec = Spec(name)
-    name = spec.name  # factors out namespace, if any
+    name = spec.name.lower()  # factors out namespace, if any
     repo = find_repository(spec, args)
 
     tty.msg("This looks like a URL for %s version %s" % (name, version))
-- 
cgit v1.2.3-70-g09d2


From e482994a1505bf7b8e506872c8ac205fce68b217 Mon Sep 17 00:00:00 2001
From: Denis Davydov <davydden@gmail.com>
Date: Sat, 9 Jul 2016 08:12:34 +0200
Subject: petsc: add -lm when building example

---
 var/spack/repos/builtin/packages/petsc/package.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/var/spack/repos/builtin/packages/petsc/package.py b/var/spack/repos/builtin/packages/petsc/package.py
index 90afdbdb90..11f5c36c22 100644
--- a/var/spack/repos/builtin/packages/petsc/package.py
+++ b/var/spack/repos/builtin/packages/petsc/package.py
@@ -154,7 +154,7 @@ class Petsc(Package):
                 env['PETSC_DIR'] = self.prefix
                 cc = Executable(spec['mpi'].mpicc)
                 cc('ex50.c', '-I%s' % prefix.include, '-L%s' % prefix.lib,
-                   '-lpetsc', '-o', 'ex50')
+                   '-lpetsc', '-lm', '-o', 'ex50')
                 run = Executable(join_path(spec['mpi'].prefix.bin, 'mpirun'))
                 run('ex50', '-da_grid_x', '4', '-da_grid_y', '4')
                 if 'superlu-dist' in spec:
-- 
cgit v1.2.3-70-g09d2


From b29d5e603209fe869dc5737d7d403c6f9536597f Mon Sep 17 00:00:00 2001
From: Denis Davydov <davydden@gmail.com>
Date: Thu, 7 Jul 2016 19:18:10 +0200
Subject: add special treatment of develop version

---
 lib/spack/spack/concretize.py    | 6 +++++-
 lib/spack/spack/test/versions.py | 3 +++
 lib/spack/spack/version.py       | 8 ++++++++
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/lib/spack/spack/concretize.py b/lib/spack/spack/concretize.py
index f792008c49..d9992a5680 100644
--- a/lib/spack/spack/concretize.py
+++ b/lib/spack/spack/concretize.py
@@ -166,7 +166,11 @@ class DefaultConcretizer(object):
         valid_versions.sort(key=prefer_key, reverse=True)
 
         if valid_versions:
-            spec.versions = ver([valid_versions[0]])
+            # Disregard @develop and take the next valid version
+            if ver(valid_versions[0]) == ver('develop') and len(valid_versions) > 1:
+                spec.versions = ver([valid_versions[1]])
+            else:
+                spec.versions = ver([valid_versions[0]])
         else:
             # We don't know of any SAFE versions that match the given
             # spec.  Grab the spec's versions and grab the highest
diff --git a/lib/spack/spack/test/versions.py b/lib/spack/spack/test/versions.py
index a3a328fb14..41d72e7c34 100644
--- a/lib/spack/spack/test/versions.py
+++ b/lib/spack/spack/test/versions.py
@@ -92,6 +92,9 @@ class VersionsTest(unittest.TestCase):
         self.assert_ver_eq('1.0', '1.0')
         self.assert_ver_lt('1.0', '2.0')
         self.assert_ver_gt('2.0', '1.0')
+        self.assert_ver_eq('develop', 'develop')
+        self.assert_ver_lt('1.0', 'develop')
+        self.assert_ver_gt('develop', '1.0')
 
     def test_three_segments(self):
         self.assert_ver_eq('2.0.1', '2.0.1')
diff --git a/lib/spack/spack/version.py b/lib/spack/spack/version.py
index 6839643941..6f6c83b3d8 100644
--- a/lib/spack/spack/version.py
+++ b/lib/spack/spack/version.py
@@ -236,6 +236,14 @@ class Version(object):
         if self.version == other.version:
             return False
 
+        # dev is __gt__ than anything but itself.
+        if other.string == 'develop':
+            return True
+
+        # If lhs is dev then it can't be < than anything
+        if self.string == 'develop':
+            return False
+
         for a, b in zip(self.version, other.version):
             if a == b:
                 continue
-- 
cgit v1.2.3-70-g09d2


From 38550bbc1b5a61c5c7a2869297642627fd598035 Mon Sep 17 00:00:00 2001
From: Denis Davydov <davydden@gmail.com>
Date: Mon, 11 Jul 2016 10:17:09 +0200
Subject: slepc: fix install_name for binaries on macOS for 3.7.1

---
 .../builtin/packages/slepc/install_name_371.patch  | 32 ++++++++++++++++++++++
 var/spack/repos/builtin/packages/slepc/package.py  | 15 ++++++----
 2 files changed, 42 insertions(+), 5 deletions(-)
 create mode 100644 var/spack/repos/builtin/packages/slepc/install_name_371.patch

diff --git a/var/spack/repos/builtin/packages/slepc/install_name_371.patch b/var/spack/repos/builtin/packages/slepc/install_name_371.patch
new file mode 100644
index 0000000000..d02ca88657
--- /dev/null
+++ b/var/spack/repos/builtin/packages/slepc/install_name_371.patch
@@ -0,0 +1,32 @@
+From 7489a3f3d569e2fbf5513ac9dcd769017d9f7eb7 Mon Sep 17 00:00:00 2001
+From: Lisandro Dalcin <dalcinl@gmail.com>
+Date: Thu, 2 Jun 2016 21:57:38 +0300
+Subject: [PATCH] OS X: Fix library path in invocation of install_name_tool
+
+---
+ config/install.py | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/config/install.py b/config/install.py
+index 09acd03..6ce98ae 100755
+--- a/config/install.py
++++ b/config/install.py
+@@ -25,6 +25,7 @@ class Installer:
+ 
+   def setupDirectories(self):
+     self.installDir        = self.destDir
++    self.archDir           = os.path.join(self.rootDir, self.arch)
+     self.rootIncludeDir    = os.path.join(self.rootDir, 'include')
+     self.archIncludeDir    = os.path.join(self.rootDir, self.arch, 'include')
+     self.rootConfDir       = os.path.join(self.rootDir, 'lib','slepc','conf')
+@@ -220,7 +221,7 @@ for dir in dirs:
+     if os.path.splitext(dst)[1] == '.dylib' and os.path.isfile('/usr/bin/install_name_tool'):
+       (result, output) = commands.getstatusoutput('otool -D '+src)
+       oldname = output[output.find("\n")+1:]
+-      installName = oldname.replace(self.destDir, self.installDir)
++      installName = oldname.replace(self.archDir, self.installDir)
+       (result, output) = commands.getstatusoutput('/usr/bin/install_name_tool -id ' + installName + ' ' + dst)
+     # preserve the original timestamps - so that the .a vs .so time order is preserved
+     shutil.copystat(src,dst)
+-- 
+2.7.4.1.g5468f9e
diff --git a/var/spack/repos/builtin/packages/slepc/package.py b/var/spack/repos/builtin/packages/slepc/package.py
index d3739bf6a6..fd6c42d9fc 100644
--- a/var/spack/repos/builtin/packages/slepc/package.py
+++ b/var/spack/repos/builtin/packages/slepc/package.py
@@ -28,7 +28,7 @@ from spack import *
 
 class Slepc(Package):
     """
-    Scalable Library for Eigenvalue Computations.
+    Scalable Library for Eigenvalue Problem Computations.
     """
 
     homepage = "http://www.grycap.upv.es/slepc"
@@ -45,9 +45,13 @@ class Slepc(Package):
     depends_on('arpack-ng~mpi', when='+arpack^petsc~mpi')
     depends_on('arpack-ng+mpi', when='+arpack^petsc+mpi')
 
+    patch('install_name_371.patch', when='@3.7.1')
+
     def install(self, spec, prefix):
         # set SLEPC_DIR for installation
-        os.environ['SLEPC_DIR'] = self.stage.source_path
+        # Note that one should set the current (temporary) directory instead
+        # its symlink in spack/stage/ !
+        os.environ['SLEPC_DIR'] = os.getcwd()
 
         options = []
 
@@ -67,9 +71,10 @@ class Slepc(Package):
         configure('--prefix=%s' % prefix, *options)
 
         make('MAKE_NP=%s' % make_jobs, parallel=False)
-        # FIXME:
-        # make('test')
-        make('install')
+        if self.run_tests:
+            make('test', parallel=False)
+
+        make('install', parallel=False)
 
     def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
         # set up SLEPC_DIR for everyone using SLEPc package
-- 
cgit v1.2.3-70-g09d2


From 0d3a52ae29c501c2259370d79a480630be4c7268 Mon Sep 17 00:00:00 2001
From: Paul Hopkins <paul.hopkins@ligo.org>
Date: Mon, 11 Jul 2016 16:00:19 +0100
Subject: Fix typo in Octave variant suitesparse

---
 var/spack/repos/builtin/packages/octave/package.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/var/spack/repos/builtin/packages/octave/package.py b/var/spack/repos/builtin/packages/octave/package.py
index f97bfc7d12..6535f528ee 100644
--- a/var/spack/repos/builtin/packages/octave/package.py
+++ b/var/spack/repos/builtin/packages/octave/package.py
@@ -61,7 +61,7 @@ class Octave(Package):
     variant('qrupdate',   default=False)
     variant('qscintilla', default=False)
     variant('qt',         default=False)
-    variant('suiteparse', default=False)
+    variant('suitesparse', default=False)
     variant('zlib',       default=False)
 
     # Required dependencies
-- 
cgit v1.2.3-70-g09d2


From 1682257b35b0c1089a723fac7996063e9c3d2729 Mon Sep 17 00:00:00 2001
From: George Hartzell <hartzell@alerce.com>
Date: Mon, 11 Jul 2016 09:42:49 -0700
Subject: Typo: verison -> version

---
 lib/spack/spack/cmd/diy.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/spack/spack/cmd/diy.py b/lib/spack/spack/cmd/diy.py
index 39faf59a17..643e6374b2 100644
--- a/lib/spack/spack/cmd/diy.py
+++ b/lib/spack/spack/cmd/diy.py
@@ -50,7 +50,7 @@ def setup_parser(subparser):
         help="Do not display verbose build output while installing.")
     subparser.add_argument(
         'spec', nargs=argparse.REMAINDER,
-        help="specs to use for install.  Must contain package AND verison.")
+        help="specs to use for install.  Must contain package AND version.")
 
 
 def diy(self, args):
-- 
cgit v1.2.3-70-g09d2


From 306e601d4e0e86090d8876ad50ddd6f6fcc768b7 Mon Sep 17 00:00:00 2001
From: Denis Davydov <davydden@gmail.com>
Date: Mon, 11 Jul 2016 19:50:33 +0200
Subject: document special treatment of development version

---
 lib/spack/docs/packaging_guide.rst | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/lib/spack/docs/packaging_guide.rst b/lib/spack/docs/packaging_guide.rst
index 72559e47ce..e616581ca4 100644
--- a/lib/spack/docs/packaging_guide.rst
+++ b/lib/spack/docs/packaging_guide.rst
@@ -568,7 +568,7 @@ The package author is responsible for coming up with a sensible name
 for each version to be fetched from a repository.  For example, if
 you're fetching from a tag like ``v1.0``, you might call that ``1.0``.
 If you're fetching a nameless git commit or an older subversion
-revision, you might give the commit an intuitive name, like ``dev``
+revision, you might give the commit an intuitive name, like ``develop``
 for a development version, or ``some-fancy-new-feature`` if you want
 to be more specific.
 
@@ -578,6 +578,17 @@ branches move forward over time and you aren't guaranteed to get the
 same thing every time you fetch a particular version.  Life isn't
 always simple, though, so this is not strictly enforced.
 
+When fetching from from the branch corresponding to the development version
+(often called ``master``,``trunk`` or ``dev``), it is recommended to
+call this version ``develop``. Spack has special treatment for this version so
+ that ``@develop`` will satisfy dependencies like
+``depends_on(abc, when="@x.y.z:")``. In other words, ``@develop`` is
+greater than any other version. The rationale is that certain features or
+options first appear in the development branch. Therefore if a package author
+wants to keep the package on the bleeding edge and provide support for new
+features, it is advised to use ``develop`` for such a version which will
+greatly simplify writing dependencies and version-related conditionals.
+
 In some future release, Spack may support extrapolating repository
 versions as it does for tarball URLs, but currently this is not
 supported.
@@ -603,7 +614,7 @@ Default branch
 
      class Example(Package):
          ...
-         version('dev', git='https://github.com/example-project/example.git')
+         version('develop', git='https://github.com/example-project/example.git')
 
   This is not recommended, as the contents of the default branch
   change over time.
@@ -676,7 +687,7 @@ Default
 
   .. code-block:: python
 
-     version('hg-head', hg='https://jay.grs.rwth-aachen.de/hg/example')
+     version('develop', hg='https://jay.grs.rwth-aachen.de/hg/example')
 
   Note that this is not recommended; try to fetch a particular
   revision instead.
@@ -708,7 +719,7 @@ Fetching the head
 
   .. code-block:: python
 
-     version('svn-head', svn='https://outreach.scidac.gov/svn/libmonitor/trunk')
+     version('develop', svn='https://outreach.scidac.gov/svn/libmonitor/trunk')
 
   This is not recommended, as the head will move forward over time.
 
@@ -718,7 +729,7 @@ Fetching a revision
 
   .. code-block:: python
 
-     version('svn-head', svn='https://outreach.scidac.gov/svn/libmonitor/trunk',
+     version('develop', svn='https://outreach.scidac.gov/svn/libmonitor/trunk',
              revision=128)
 
 Subversion branches are handled as part of the directory structure, so
@@ -2712,15 +2723,15 @@ build process will start from scratch.
 
 ``spack purge``
 ~~~~~~~~~~~~~~~~~
-Cleans up all of Spack's temporary and cached files.  This can be used to 
-recover disk space if temporary files from interrupted or failed installs 
-accumulate in the staging area.  
+Cleans up all of Spack's temporary and cached files.  This can be used to
+recover disk space if temporary files from interrupted or failed installs
+accumulate in the staging area.
 
 When called with ``--stage`` or ``--all`` (or without arguments, in which case
-the default is ``--all``) this removes all staged files; this is equivalent to 
+the default is ``--all``) this removes all staged files; this is equivalent to
 running ``spack clean`` for every package you have fetched or staged.
 
-When called with ``--cache`` or ``--all`` this will clear all resources 
+When called with ``--cache`` or ``--all`` this will clear all resources
 :ref:`cached <caching>` during installs.
 
 Keeping the stage directory on success
-- 
cgit v1.2.3-70-g09d2


From 664bdd359fc0421cc2327a4dbfdf50e739361664 Mon Sep 17 00:00:00 2001
From: Glenn Johnson <glenn-johnson@uiowa.edu>
Date: Mon, 11 Jul 2016 13:29:43 -0500
Subject: Filter compilers for R

This adds a filter_compilers function to have the Makeconf file for R
point to the actual compilers rather than the spack wrappers. Also added
version 3.3.1.
---
 var/spack/repos/builtin/packages/R/package.py | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/var/spack/repos/builtin/packages/R/package.py b/var/spack/repos/builtin/packages/R/package.py
index 001dde5329..07bb6b6b03 100644
--- a/var/spack/repos/builtin/packages/R/package.py
+++ b/var/spack/repos/builtin/packages/R/package.py
@@ -40,6 +40,7 @@ class R(Package):
 
     extendable = True
 
+    version('3.3.1', 'f50a659738b73036e2f5635adbd229c5')
     version('3.3.0', '5a7506c8813432d1621c9725e86baf7a')
     version('3.2.3', '1ba3dac113efab69e706902810cc2970')
     version('3.2.2', '57cef5c2e210a5454da1979562a10e5b')
@@ -87,6 +88,29 @@ class R(Package):
         make()
         make('install')
 
+        self.filter_compilers(spec, prefix)
+
+    def filter_compilers(self, spec, prefix):
+        """Run after install to tell the configuration files and Makefiles
+        to use the compilers that Spack built the package with.
+
+        If this isn't done, they'll have CC and CXX set to Spack's generic
+        cc and c++. We want them to be bound to whatever compiler
+        they were built with."""
+
+        etcdir = join_path(prefix, 'rlib', 'R', 'etc')
+
+        kwargs = {'ignore_absent': True, 'backup': False, 'string': True}
+
+        filter_file(env['CC'],  self.compiler.cc,
+                    join_path(etcdir, 'Makeconf'), **kwargs)
+        filter_file(env['CXX'], self.compiler.cxx,
+                    join_path(etcdir, 'Makeconf'), **kwargs)
+        filter_file(env['F77'], self.compiler.f77,
+                    join_path(etcdir, 'Makeconf'), **kwargs)
+        filter_file(env['FC'], self.compiler.fc,
+                    join_path(etcdir, 'Makeconf'), **kwargs)
+
     # ========================================================================
     # Set up environment to make install easy for R extensions.
     # ========================================================================
-- 
cgit v1.2.3-70-g09d2