Spack BundlePackage: a group of other packages (#11981)

This adds a special package type to Spack which is used to aggregate
a set of packages that a user might commonly install together; it
does not include any source code itself and does not require a
download URL like other Spack packages. It may include an 'install'
method to generate scripts, and Spack will run post-install hooks
(including module generation).

* Add new BundlePackage type
* Update the Xsdk package to be a BundlePackage and remove the
  'install' method (previously it had a noop install method)
* "spack create --template" now takes "bundle" as an option
* Rename cmd_create_repo fixture to "mock_test_repo" and relocate it
  to shared pytest fixtures
* Add unit tests for BundlePackage behavior
This commit is contained in:
Tamara Dahlgren
2019-08-22 11:08:23 -07:00
committed by Peter Scheibel
parent 47238b9714
commit c9e214f6d3
21 changed files with 569 additions and 195 deletions

View File

@@ -0,0 +1,31 @@
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
from spack import *
from llnl.util.filesystem import touch
class NosourceInstall(BundlePackage):
"""Simple bundle package with one dependency and metadata 'install'."""
homepage = "http://www.example.com"
version('2.0')
version('1.0')
depends_on('dependency-install')
# The install phase must be specified.
phases = ['install']
# The install method must also be present.
def install(self, spec, prefix):
touch(os.path.join(self.prefix, 'install.txt'))
@run_after('install')
def post_install(self):
touch(os.path.join(self.prefix, 'post-install.txt'))

View File

@@ -0,0 +1,17 @@
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Nosource(BundlePackage):
"""Simple bundle package with one dependency"""
homepage = "http://www.example.com"
version('1.0')
depends_on('dependency-install')

View File

@@ -0,0 +1,18 @@
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class NoversionBundle(BundlePackage):
"""
Simple bundle package with no version and one dependency, which
should be rejected for lack of a version.
"""
homepage = "http://www.example.com"
depends_on('dependency-install')

View File

@@ -0,0 +1,19 @@
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Noversion(Package):
"""
Simple package with no version, which should be rejected since a version
is required.
"""
homepage = "http://www.example.com"
url = "http://www.example.com/a-1.0.tar.gz"
def install(self, spec, prefix):
touch(join_path(prefix, 'an_installation_file'))

View File

@@ -4,25 +4,23 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
from spack import *
class Xsdk(Package):
class Xsdk(BundlePackage):
"""Xsdk is a suite of Department of Energy (DOE) packages for numerical
simulation. This is a Spack bundle package that installs the xSDK
packages
"""
homepage = "http://xsdk.info"
url = 'http://ftp.mcs.anl.gov/pub/petsc/externalpackages/xsdk.tar.gz'
maintainers = ['balay', 'luszczek']
version('develop', 'a52dc710c744afa0b71429b8ec9425bc')
version('0.4.0', 'a52dc710c744afa0b71429b8ec9425bc')
version('0.3.0', 'a52dc710c744afa0b71429b8ec9425bc')
version('xsdk-0.2.0', 'a52dc710c744afa0b71429b8ec9425bc')
version('develop')
version('0.4.0')
version('0.3.0')
version('xsdk-0.2.0')
variant('debug', default=False, description='Compile in debug mode')
variant('cuda', default=False, description='Enable CUDA dependent packages')
@@ -123,12 +121,3 @@ class Xsdk(Package):
# How do we propagate debug flag to all depends on packages ?
# If I just do spack install xsdk+debug will that propogate it down?
# Dummy install for now, will be removed when metapackage is available
def install(self, spec, prefix):
# Prevent the error message
# ==> Error: Install failed for xsdk. Nothing was installed!
# ==> Error: Installation process had nonzero exit code : 256
with open(os.path.join(spec.prefix, 'bundle-package.txt'), 'w') as out:
out.write('This is a bundle\n')
out.close()