summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEgbert Eich <eich@suse.de>2023-05-03 13:05:14 +0200
committerGitHub <noreply@github.com>2023-05-03 13:05:14 +0200
commit1491d8471de4561bcb21c58551237de99695cbf6 (patch)
treee0bc27ae9227f64fcc8e4825e8868289262e597d /lib
parent03d18413853de8e1feb3068acf7f19e54c21dd12 (diff)
downloadspack-1491d8471de4561bcb21c58551237de99695cbf6.tar.gz
spack-1491d8471de4561bcb21c58551237de99695cbf6.tar.bz2
spack-1491d8471de4561bcb21c58551237de99695cbf6.tar.xz
spack-1491d8471de4561bcb21c58551237de99695cbf6.zip
Add 'zypper' to the valid container.os_packages options (#36681)
Signed-off-by: Egbert Eich <eich@suse.com> Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com> Co-authored-by: e4t <e4t@users.noreply.github.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/docs/containers.rst2
-rw-r--r--lib/spack/spack/schema/container.py5
-rw-r--r--lib/spack/spack/test/container/docker.py22
3 files changed, 27 insertions, 2 deletions
diff --git a/lib/spack/docs/containers.rst b/lib/spack/docs/containers.rst
index 2c097d366c..aa861e28c9 100644
--- a/lib/spack/docs/containers.rst
+++ b/lib/spack/docs/containers.rst
@@ -616,7 +616,7 @@ to customize the generation of container recipes:
- No
* - ``os_packages:command``
- Tool used to manage system packages
- - ``apt``, ``yum``
+ - ``apt``, ``yum``, ``zypper``, ``apk``, ``yum_amazon``
- Only with custom base images
* - ``os_packages:update``
- Whether or not to update the list of available packages
diff --git a/lib/spack/spack/schema/container.py b/lib/spack/spack/schema/container.py
index 37912d4c55..030b238290 100644
--- a/lib/spack/spack/schema/container.py
+++ b/lib/spack/spack/schema/container.py
@@ -54,7 +54,10 @@ container_schema = {
"os_packages": {
"type": "object",
"properties": {
- "command": {"type": "string", "enum": ["apt", "yum"]},
+ "command": {
+ "type": "string",
+ "enum": ["apt", "yum", "zypper", "apk", "yum_amazon"],
+ },
"update": {"type": "boolean"},
"build": _list_of_packages,
"final": _list_of_packages,
diff --git a/lib/spack/spack/test/container/docker.py b/lib/spack/spack/test/container/docker.py
index 4f65dfd983..d6edca99a6 100644
--- a/lib/spack/spack/test/container/docker.py
+++ b/lib/spack/spack/test/container/docker.py
@@ -43,6 +43,28 @@ def test_packages(minimal_configuration):
assert p.list == pkgs
+def test_container_os_packages_command(minimal_configuration):
+ # In this minimal configuration we don't have packages
+ writer = writers.create(minimal_configuration)
+ assert writer.os_packages_build is None
+ assert writer.os_packages_final is None
+
+ # If we add them a list should be returned
+ minimal_configuration["spack"]["container"]["images"] = {
+ "build": "custom-build:latest",
+ "final": "custom-final:latest",
+ }
+ minimal_configuration["spack"]["container"]["os_packages"] = {
+ "command": "zypper",
+ "final": ["libgomp1"],
+ }
+ writer = writers.create(minimal_configuration)
+ p = writer.os_packages_final
+ assert "zypper update -y" in p.update
+ assert "zypper install -y" in p.install
+ assert "zypper clean -a" in p.clean
+
+
def test_ensure_render_works(minimal_configuration, default_config):
# Here we just want to ensure that nothing is raised
writer = writers.create(minimal_configuration)