Skip to content

Commit c2ce75a

Browse files
committed
Add --compression-type to rpm commands
Fixes #1246
1 parent d745426 commit c2ce75a

5 files changed

Lines changed: 21 additions & 2 deletions

File tree

CHANGES/1246.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Added compression type options to RPM repositories and publications.

src/pulpcore/cli/rpm/common.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
LEGACY_CHECKSUM_CHOICES = ("md5", "sha1", "sha224", "sha256", "sha384", "sha512")
22

33
CHECKSUM_CHOICES = ("sha256", "sha384", "sha512")
4+
5+
COMPRESSION_CHOICES = ("zstd", "gz", "none")

src/pulpcore/cli/rpm/publication.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
show_command,
1919
type_option,
2020
)
21-
from pulpcore.cli.rpm.common import CHECKSUM_CHOICES
21+
from pulpcore.cli.rpm.common import CHECKSUM_CHOICES, COMPRESSION_CHOICES
2222

2323
translation = get_translation(__package__)
2424
_ = translation.gettext
@@ -64,6 +64,12 @@ def publication() -> None:
6464
),
6565
needs_plugins=[PluginRequirement("rpm", specifier=">=3.25.0")],
6666
),
67+
pulp_option(
68+
"--compression-type",
69+
type=click.Choice(COMPRESSION_CHOICES, case_sensitive=False),
70+
help=_("Option specifying the compression type to use for metadata."),
71+
needs_plugins=[PluginRequirement("rpm", specifier=">=3.25.0")],
72+
),
6773
pulp_option(
6874
"--checkpoint",
6975
is_flag=True,

src/pulpcore/cli/rpm/repository.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
version_command,
4747
)
4848
from pulpcore.cli.core.generic import task_command
49-
from pulpcore.cli.rpm.common import CHECKSUM_CHOICES, LEGACY_CHECKSUM_CHOICES
49+
from pulpcore.cli.rpm.common import CHECKSUM_CHOICES, COMPRESSION_CHOICES, LEGACY_CHECKSUM_CHOICES
5050

5151
translation = get_translation(__package__)
5252
_ = translation.gettext
@@ -160,6 +160,12 @@ def repository() -> None:
160160
),
161161
needs_plugins=[PluginRequirement("rpm", specifier=">=3.25.0")],
162162
),
163+
pulp_option(
164+
"--compression-type",
165+
type=click.Choice(COMPRESSION_CHOICES, case_sensitive=False),
166+
help=_("Option specifying the compression type to use for metadata."),
167+
needs_plugins=[PluginRequirement("rpm", specifier=">=3.25.0")],
168+
),
163169
pulp_option(
164170
"--gpgcheck",
165171
type=click.Choice(("0", "1")),

tests/scripts/pulp_rpm/test_rpm_sync_publish.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ else
122122
expect_succ pulp rpm repository update --name "cli_test_rpm_sync_repository" --package-checksum-type sha1
123123
fi
124124

125+
expect_succ pulp rpm repository update --repository "cli_test_rpm_sync_repository" --compression-type zstd
126+
expect_succ pulp rpm publication create --repository "cli_test_rpm_sync_repository" --compression-type gz
127+
expect_succ test "$(echo "$OUTPUT" | jq -r '.compression_type')" = "gz"
128+
125129
expect_succ pulp rpm distribution destroy --name "cli_test_rpm_sync_distro"
126130
expect_succ pulp rpm publication destroy --href "$PUBLICATION_HREF"
127131
expect_succ pulp rpm publication destroy --href "$PUBLICATION_VER_HREF"

0 commit comments

Comments
 (0)