From 31f3bf89675c8d70a5d441be4e47e969174fdddd Mon Sep 17 00:00:00 2001 From: Matthias Dellweg Date: Fri, 17 Jul 2026 14:11:35 +0200 Subject: [PATCH] Add --compression-type to rpm commands Fixes #1246 --- CHANGES/1246.feature | 1 + src/pulpcore/cli/rpm/common.py | 2 ++ src/pulpcore/cli/rpm/publication.py | 8 +++++++- src/pulpcore/cli/rpm/repository.py | 8 +++++++- tests/scripts/pulp_rpm/test_rpm_sync_publish.sh | 4 ++++ 5 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 CHANGES/1246.feature diff --git a/CHANGES/1246.feature b/CHANGES/1246.feature new file mode 100644 index 000000000..e2075e372 --- /dev/null +++ b/CHANGES/1246.feature @@ -0,0 +1 @@ +Added compression type options to RPM repositories and publications. diff --git a/src/pulpcore/cli/rpm/common.py b/src/pulpcore/cli/rpm/common.py index ee430e740..8a43e0895 100644 --- a/src/pulpcore/cli/rpm/common.py +++ b/src/pulpcore/cli/rpm/common.py @@ -1,3 +1,5 @@ LEGACY_CHECKSUM_CHOICES = ("md5", "sha1", "sha224", "sha256", "sha384", "sha512") CHECKSUM_CHOICES = ("sha256", "sha384", "sha512") + +COMPRESSION_CHOICES = ("zstd", "gz", "none") diff --git a/src/pulpcore/cli/rpm/publication.py b/src/pulpcore/cli/rpm/publication.py index 5910adee2..41b0102c6 100644 --- a/src/pulpcore/cli/rpm/publication.py +++ b/src/pulpcore/cli/rpm/publication.py @@ -18,7 +18,7 @@ show_command, type_option, ) -from pulpcore.cli.rpm.common import CHECKSUM_CHOICES +from pulpcore.cli.rpm.common import CHECKSUM_CHOICES, COMPRESSION_CHOICES translation = get_translation(__package__) _ = translation.gettext @@ -64,6 +64,12 @@ def publication() -> None: ), needs_plugins=[PluginRequirement("rpm", specifier=">=3.25.0")], ), + pulp_option( + "--compression-type", + type=click.Choice(COMPRESSION_CHOICES, case_sensitive=False), + help=_("Option specifying the compression type to use for metadata."), + needs_plugins=[PluginRequirement("rpm", specifier=">=3.25.0")], + ), pulp_option( "--checkpoint", is_flag=True, diff --git a/src/pulpcore/cli/rpm/repository.py b/src/pulpcore/cli/rpm/repository.py index d4b6d7aa1..c19d89837 100644 --- a/src/pulpcore/cli/rpm/repository.py +++ b/src/pulpcore/cli/rpm/repository.py @@ -46,7 +46,7 @@ version_command, ) from pulpcore.cli.core.generic import task_command -from pulpcore.cli.rpm.common import CHECKSUM_CHOICES, LEGACY_CHECKSUM_CHOICES +from pulpcore.cli.rpm.common import CHECKSUM_CHOICES, COMPRESSION_CHOICES, LEGACY_CHECKSUM_CHOICES translation = get_translation(__package__) _ = translation.gettext @@ -160,6 +160,12 @@ def repository() -> None: ), needs_plugins=[PluginRequirement("rpm", specifier=">=3.25.0")], ), + pulp_option( + "--compression-type", + type=click.Choice(COMPRESSION_CHOICES, case_sensitive=False), + help=_("Option specifying the compression type to use for metadata."), + needs_plugins=[PluginRequirement("rpm", specifier=">=3.25.0")], + ), pulp_option( "--gpgcheck", type=click.Choice(("0", "1")), diff --git a/tests/scripts/pulp_rpm/test_rpm_sync_publish.sh b/tests/scripts/pulp_rpm/test_rpm_sync_publish.sh index bf2151761..cabbece41 100755 --- a/tests/scripts/pulp_rpm/test_rpm_sync_publish.sh +++ b/tests/scripts/pulp_rpm/test_rpm_sync_publish.sh @@ -122,6 +122,10 @@ else expect_succ pulp rpm repository update --name "cli_test_rpm_sync_repository" --package-checksum-type sha1 fi +expect_succ pulp rpm repository update --repository "cli_test_rpm_sync_repository" --compression-type zstd +expect_succ pulp rpm publication create --repository "cli_test_rpm_sync_repository" --compression-type gz +expect_succ test "$(echo "$OUTPUT" | jq -r '.compression_type')" = "gz" + expect_succ pulp rpm distribution destroy --name "cli_test_rpm_sync_distro" expect_succ pulp rpm publication destroy --href "$PUBLICATION_HREF" expect_succ pulp rpm publication destroy --href "$PUBLICATION_VER_HREF"