summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorPeter Scheibel <scheibel1@llnl.gov>2024-04-24 09:41:03 -0700
committerGitHub <noreply@github.com>2024-04-24 09:41:03 -0700
commit02cc3ea005c7bda9478d0358a9fdf23873235d5e (patch)
treeeae0f69db7d8a1562cba44686a37dab3c64ec5d5 /var
parent641ab95a317b03ce252dc480cdc5d594450dd8ef (diff)
downloadspack-02cc3ea005c7bda9478d0358a9fdf23873235d5e.tar.gz
spack-02cc3ea005c7bda9478d0358a9fdf23873235d5e.tar.bz2
spack-02cc3ea005c7bda9478d0358a9fdf23873235d5e.tar.xz
spack-02cc3ea005c7bda9478d0358a9fdf23873235d5e.zip
Add new `redistribute()` directive (#20185)
Some packages can't be redistributed in source or binary form. We need an explicit way to say that in a package. This adds a `redistribute()` directive so that package authors can write, e.g.: ```python redistribute(source=False, binary=False) ``` You can also do this conditionally with `when=`, as with other directives, e.g.: ```python # 12.0 and higher are proprietary redistribute(source=False, binary=False, when="@12.0:") # can't redistribute when we depend on some proprietary dependency redistribute(source=False, binary=False, when="^proprietary-dependency") ``` To prevent Spack from adding either their sources or binaries to public mirrors and build caches. You can still unconditionally add things *if* you run either: * `spack mirror create --private` * `spack buildcache push --private` But the default behavior for build caches is not to include non-redistributable packages in either mirrors or build caches. We have previously done this manually for our public buildcache, but with this we can start maintaining redistributability directly in packages. Caveats: currently the default for `redistribute()` is `True` for both `source` and `binary`, and you can only set either of them to `False` via this directive. - [x] add `redistribute()` directive - [x] add `redistribute_source` and `redistribute_binary` class methods to `PackageBase` - [x] add `--private` option to `spack mirror` - [x] add `--private` option to `spack buildcache push` - [x] test exclusion of packages from source mirror (both as a root and as a dependency) - [x] test exclusion of packages from binary mirror (both as a root and as a dependency)
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin.mock/packages/no-redistribute-dependent/package.py23
-rw-r--r--var/spack/repos/builtin.mock/packages/no-redistribute/package.py23
-rw-r--r--var/spack/repos/builtin/packages/namd/package.py1
-rw-r--r--var/spack/repos/builtin/packages/nvhpc/package.py2
4 files changed, 49 insertions, 0 deletions
diff --git a/var/spack/repos/builtin.mock/packages/no-redistribute-dependent/package.py b/var/spack/repos/builtin.mock/packages/no-redistribute-dependent/package.py
new file mode 100644
index 0000000000..a362b84ab8
--- /dev/null
+++ b/var/spack/repos/builtin.mock/packages/no-redistribute-dependent/package.py
@@ -0,0 +1,23 @@
+# Copyright 2013-2024 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.package import *
+
+
+class NoRedistributeDependent(AutotoolsPackage):
+ """Package with one dependency on a package that should not be
+ redistributed"""
+
+ homepage = "http://www.example.com"
+ url = "http://www.example.com/no-redistribute-dependent-1.0.tar.gz"
+
+ version("1.0", "0123456789abcdef0123456789abcdef")
+
+ depends_on("no-redistribute")
+
+ def install(self, spec, prefix):
+ # sanity_check_prefix requires something in the install directory
+ # Test requires overriding the one provided by `AutotoolsPackage`
+ mkdirp(prefix.bin)
diff --git a/var/spack/repos/builtin.mock/packages/no-redistribute/package.py b/var/spack/repos/builtin.mock/packages/no-redistribute/package.py
new file mode 100644
index 0000000000..b9dfd5fae3
--- /dev/null
+++ b/var/spack/repos/builtin.mock/packages/no-redistribute/package.py
@@ -0,0 +1,23 @@
+# Copyright 2013-2024 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.package import *
+
+
+class NoRedistribute(Package):
+ """Package which has source code that should not be added to a public
+ mirror"""
+
+ homepage = "http://www.example.com"
+ url = "http://www.example.com/no-redistribute-1.0.tar.gz"
+
+ redistribute(source=False, binary=False)
+
+ version("1.0", "0123456789abcdef0123456789abcdef")
+
+ def install(self, spec, prefix):
+ # sanity_check_prefix requires something in the install directory
+ # Test requires overriding the one provided by `AutotoolsPackage`
+ mkdirp(prefix.bin)
diff --git a/var/spack/repos/builtin/packages/namd/package.py b/var/spack/repos/builtin/packages/namd/package.py
index 9d9d87b250..ae47ddd46b 100644
--- a/var/spack/repos/builtin/packages/namd/package.py
+++ b/var/spack/repos/builtin/packages/namd/package.py
@@ -20,6 +20,7 @@ class Namd(MakefilePackage, CudaPackage):
url = "file://{0}/NAMD_2.12_Source.tar.gz".format(os.getcwd())
git = "https://charm.cs.illinois.edu/gerrit/namd.git"
manual_download = True
+ redistribute(source=False, binary=False)
maintainers("jcphill")
diff --git a/var/spack/repos/builtin/packages/nvhpc/package.py b/var/spack/repos/builtin/packages/nvhpc/package.py
index 4531965a18..d627548cd5 100644
--- a/var/spack/repos/builtin/packages/nvhpc/package.py
+++ b/var/spack/repos/builtin/packages/nvhpc/package.py
@@ -390,6 +390,8 @@ class Nvhpc(Package):
skip_version_audit = ["platform=darwin"]
+ redistribute(source=False, binary=False)
+
for ver, packages in _versions.items():
key = "{0}-{1}".format(platform.system(), platform.machine())
pkg = packages.get(key)