summaryrefslogtreecommitdiff
path: root/var/spack/repos
diff options
context:
space:
mode:
authorTamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>2019-08-22 11:08:23 -0700
committerPeter Scheibel <scheibel1@llnl.gov>2019-08-22 11:08:23 -0700
commitc9e214f6d37af9320afc3a3bca304143c91254e7 (patch)
treeeee05c06e8fbe6f2e68a60f3e35be1fc1aa6793c /var/spack/repos
parent47238b9714d6ef32e7867ac915936cc5bd6599fd (diff)
downloadspack-c9e214f6d37af9320afc3a3bca304143c91254e7.tar.gz
spack-c9e214f6d37af9320afc3a3bca304143c91254e7.tar.bz2
spack-c9e214f6d37af9320afc3a3bca304143c91254e7.tar.xz
spack-c9e214f6d37af9320afc3a3bca304143c91254e7.zip
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
Diffstat (limited to 'var/spack/repos')
-rw-r--r--var/spack/repos/builtin.mock/packages/nosource-install/package.py31
-rw-r--r--var/spack/repos/builtin.mock/packages/nosource/package.py17
-rw-r--r--var/spack/repos/builtin.mock/packages/noversion-bundle/package.py18
-rw-r--r--var/spack/repos/builtin.mock/packages/noversion/package.py19
-rw-r--r--var/spack/repos/builtin/packages/xsdk/package.py21
5 files changed, 90 insertions, 16 deletions
diff --git a/var/spack/repos/builtin.mock/packages/nosource-install/package.py b/var/spack/repos/builtin.mock/packages/nosource-install/package.py
new file mode 100644
index 0000000000..7ea8661d6e
--- /dev/null
+++ b/var/spack/repos/builtin.mock/packages/nosource-install/package.py
@@ -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'))
diff --git a/var/spack/repos/builtin.mock/packages/nosource/package.py b/var/spack/repos/builtin.mock/packages/nosource/package.py
new file mode 100644
index 0000000000..82e82267b0
--- /dev/null
+++ b/var/spack/repos/builtin.mock/packages/nosource/package.py
@@ -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')
diff --git a/var/spack/repos/builtin.mock/packages/noversion-bundle/package.py b/var/spack/repos/builtin.mock/packages/noversion-bundle/package.py
new file mode 100644
index 0000000000..de6400636d
--- /dev/null
+++ b/var/spack/repos/builtin.mock/packages/noversion-bundle/package.py
@@ -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')
diff --git a/var/spack/repos/builtin.mock/packages/noversion/package.py b/var/spack/repos/builtin.mock/packages/noversion/package.py
new file mode 100644
index 0000000000..40889a6a11
--- /dev/null
+++ b/var/spack/repos/builtin.mock/packages/noversion/package.py
@@ -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'))
diff --git a/var/spack/repos/builtin/packages/xsdk/package.py b/var/spack/repos/builtin/packages/xsdk/package.py
index e6e3426f4d..8f1caa0a7c 100644
--- a/var/spack/repos/builtin/packages/xsdk/package.py
+++ b/var/spack/repos/builtin/packages/xsdk/package.py
@@ -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()