Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES/+remove-old-rpm-features.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Removed support for the old options `--package-checksum-type`, `--metadata-checksum-type`, `--gpgcheck`, and `--repo-gpgcheck` for newer version of pulp_rpm. These options have been deprecated for some time.
1 change: 1 addition & 0 deletions CHANGES/pulp-glue/+remove-old-rpm-features.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Removed support for gpgcheck, repo_gpgcheck, package_checksum_type and metadata_checksum_type for the RPM plugin for version >=3.30.0
39 changes: 39 additions & 0 deletions pulp-glue/pulp_glue/rpm/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,15 @@ def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> En
package_checksum_type = body.get("metadata_checksum_type")
disallowed_checksums = {"md5", "sha1", "sha224"}

self.pulp_ctx.needs_plugin(
PluginRequirement(
"rpm",
specifier=">=3.30.0",
inverted=True,
feature=_("package_checksum_type/metadata_checksum_type"),
)
)

if metadata_checksum_type and metadata_checksum_type in disallowed_checksums:
self.pulp_ctx.needs_plugin(
PluginRequirement(
Expand All @@ -278,6 +287,16 @@ def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> En
"rpm", specifier=">=3.25.0", inverted=True, feature=_("weak checksums")
)
)
if "repo_gpgcheck" in body or "gpgcheck" in body:
self.pulp_ctx.needs_plugin(
PluginRequirement(
"rpm",
specifier=">=3.30.0",
inverted=True,
feature=_("gpgcheck/repo_gpgcheck"),
)
)

return body


Expand Down Expand Up @@ -362,6 +381,15 @@ def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> En
package_checksum_type = body.get("metadata_checksum_type")
disallowed_checksums = {"md5", "sha1", "sha224"}

self.pulp_ctx.needs_plugin(
PluginRequirement(
"rpm",
specifier=">=3.30.0",
inverted=True,
feature=_("package_checksum_type/metadata_checksum_type"),
)
)

if metadata_checksum_type and metadata_checksum_type in disallowed_checksums:
self.pulp_ctx.needs_plugin(
PluginRequirement(
Expand All @@ -383,6 +411,17 @@ def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> En
feature=_("checksum_type"),
)
)

if "repo_gpgcheck" in body or "gpgcheck" in body:
self.pulp_ctx.needs_plugin(
PluginRequirement(
"rpm",
specifier=">=3.30.0",
inverted=True,
feature=_("gpgcheck/repo_gpgcheck"),
)
)

return body

def sync(self, body: t.Optional[EntityDefinition] = None) -> t.Any:
Expand Down
26 changes: 17 additions & 9 deletions pulpcore/cli/rpm/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,18 +145,23 @@ def repository(ctx: click.Context, pulp_ctx: PulpCLIContext, /, repo_type: str)
click.option("--retain-package-versions", type=int),
remote_option,
metadata_signing_service_option,
click.option(
pulp_option(
"--metadata-checksum-type",
type=click.Choice(LEGACY_CHECKSUM_CHOICES, case_sensitive=False),
help=_("DEPRECATED: Option specifying the checksum type to use for repository metadata."),
help=_(
"DEPRECATED: Option specifying the checksum type to use for repository metadata. "
"Unavailable for pulp_rpm>=3.30.0"
),
needs_plugins=[PluginRequirement("rpm", specifier="<3.30.0")],
),
click.option(
pulp_option(
"--package-checksum-type",
type=click.Choice(LEGACY_CHECKSUM_CHOICES, case_sensitive=False),
help=_(
"DEPRECATED: Option specifying the checksum type to use for packages in "
"repository metadata."
"repository metadata. Unavailable for pulp_rpm>=3.30.0"
),
needs_plugins=[PluginRequirement("rpm", specifier="<3.30.0")],
),
pulp_option(
"--checksum-type",
Expand All @@ -166,31 +171,34 @@ def repository(ctx: click.Context, pulp_ctx: PulpCLIContext, /, repo_type: str)
),
needs_plugins=[PluginRequirement("rpm", specifier=">=3.25.0")],
),
click.option(
pulp_option(
"--gpgcheck",
type=click.Choice(("0", "1")),
callback=choice_to_int_callback,
help=_(
"""DEPRECATED: Option specifying whether a client should perform a GPG signature check
on packages."""
on packages. Unavailable for pulp_rpm>=3.30.0"""
),
needs_plugins=[PluginRequirement("rpm", specifier="<3.30.0")],
),
click.option(
pulp_option(
"--repo-gpgcheck",
type=click.Choice(("0", "1")),
callback=choice_to_int_callback,
help=_(
"""DEPRECATED: Option specifying whether a client should perform a GPG signature check
on the repodata."""
on the repodata. Unavailable for pulp_rpm>=3.30.0"""
),
needs_plugins=[PluginRequirement("rpm", specifier="<3.30.0")],
),
click.option(
pulp_option(
"--sqlite-metadata/--no-sqlite-metadata",
default=None,
help=_(
"""DEPRECATED: An option specifying whether Pulp should generate SQLite metadata.
Unavailable for pulp_rpm>=3.25.0"""
),
needs_plugins=[PluginRequirement("rpm", specifier="<3.25.0")],
),
pulp_option(
"--autopublish/--no-autopublish",
Expand Down
35 changes: 27 additions & 8 deletions tests/scripts/pulp_rpm/gpgcheck_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,31 @@ cleanup () {
}
trap cleanup EXIT

expect succ pulp rpm repository create --name "cli-repo-gpgcheck" --gpgcheck 1 --repo-gpgcheck 1
expect succ pulp rpm repository show --name "cli-repo-gpgcheck"
test "$(echo "$OUTPUT" | jq -r '.gpgcheck')" = 1
test "$(echo "$OUTPUT" | jq -r '.repo_gpgcheck')" = 1
if pulp debug has-plugin --name "rpm" --specifier "<=3.29.0"
then
expect succ pulp rpm repository create --name "cli-repo-gpgcheck" --gpgcheck 1 --repo-gpgcheck 1
expect succ pulp rpm repository show --name "cli-repo-gpgcheck"
test "$(echo "$OUTPUT" | jq -r '.gpgcheck')" = 1
test "$(echo "$OUTPUT" | jq -r '.repo_gpgcheck')" = 1

expect succ pulp rpm repository update --name "cli-repo-gpgcheck" --gpgcheck 0 --repo-gpgcheck 0
expect succ pulp rpm repository show --name "cli-repo-gpgcheck"
test "$(echo "$OUTPUT" | jq -r '.gpgcheck')" = 0
test "$(echo "$OUTPUT" | jq -r '.repo_gpgcheck')" = 0
expect succ pulp rpm repository update --name "cli-repo-gpgcheck" --gpgcheck 0 --repo-gpgcheck 0
expect succ pulp rpm repository show --name "cli-repo-gpgcheck"
test "$(echo "$OUTPUT" | jq -r '.gpgcheck')" = 0
test "$(echo "$OUTPUT" | jq -r '.repo_gpgcheck')" = 0
else
expect fail pulp rpm repository create --name "cli-repo-gpgcheck" --gpgcheck 1
expect fail pulp rpm repository create --name "cli-repo-gpgcheck" --repo-gpgcheck 1
fi

if pulp debug has-plugin --name "rpm" --specifier ">=3.24.0"
then
expect succ pulp rpm repository create --name "cli-repo-config" --repo-config "{\"gpgcheck\"=1, \"repo_gpgcheck\"=1}"
expect succ pulp rpm repository show --name "cli-repo-config"
test "$(echo "$OUTPUT" | jq -r '.gpgcheck')" = 1
test "$(echo "$OUTPUT" | jq -r '.repo_gpgcheck')" = 1

expect succ pulp rpm repository update --name "cli-repo-config" --repo-config "{\"gpgcheck\"=0, \"repo_gpgcheck\"=0}"
expect succ pulp rpm repository show --name "cli-repo-config"
test "$(echo "$OUTPUT" | jq -r '.gpgcheck')" = 0
test "$(echo "$OUTPUT" | jq -r '.repo_gpgcheck')" = 0
fi
8 changes: 6 additions & 2 deletions tests/scripts/pulp_rpm/test_rpm_sync_publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,12 @@ then

expect_succ pulp rpm repository update --name "cli_test_rpm_repository" --checksum-type sha512
expect_fail pulp rpm repository update --name "cli_test_rpm_repository" --checksum-type sha1
expect_fail pulp rpm repository update --name "cli_test_rpm_repository" --package-checksum-type sha1
expect_fail pulp rpm repository update --name "cli_test_rpm_repository" --metadata-checksum-type sha1

if pulp debug has-plugin --name "rpm" --specifier ">=3.30.0"
then
expect_fail pulp rpm repository update --name "cli_test_rpm_repository" --package-checksum-type sha256
expect_fail pulp rpm repository update --name "cli_test_rpm_repository" --metadata-checksum-type sha256
fi
else
expect_succ pulp rpm repository update --name "cli_test_rpm_repository" --metadata-checksum-type sha1
expect_succ pulp rpm repository update --name "cli_test_rpm_repository" --package-checksum-type sha1
Expand Down