Skip to content

Commit bdb5711

Browse files
committed
Remove support for old RPM features
Remove gpgcheck, repo_gpgcheck, package_checksum_type and metadata_checksum_type options.
1 parent 220d85d commit bdb5711

6 files changed

Lines changed: 86 additions & 14 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Removed support for gpgcheck, repo_gpgcheck, package_checksum_type and metadata_checksum_type for the RPM plugin for version >=3.30.0

pulp-glue/pulp_glue/rpm/context.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,15 @@ def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> En
266266
package_checksum_type = body.get("metadata_checksum_type")
267267
disallowed_checksums = {"md5", "sha1", "sha224"}
268268

269+
self.pulp_ctx.needs_plugin(
270+
PluginRequirement(
271+
"rpm",
272+
specifier=">=3.30.0",
273+
inverted=True,
274+
feature=_("package_checksum_type/metadata_checksum_type"),
275+
)
276+
)
277+
269278
if metadata_checksum_type and metadata_checksum_type in disallowed_checksums:
270279
self.pulp_ctx.needs_plugin(
271280
PluginRequirement(
@@ -278,6 +287,16 @@ def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> En
278287
"rpm", specifier=">=3.25.0", inverted=True, feature=_("weak checksums")
279288
)
280289
)
290+
if "repo_gpgcheck" in body or "gpgcheck" in body:
291+
self.pulp_ctx.needs_plugin(
292+
PluginRequirement(
293+
"rpm",
294+
specifier=">=3.30.0",
295+
inverted=True,
296+
feature=_("gpgcheck/repo_gpgcheck"),
297+
)
298+
)
299+
281300
return body
282301

283302

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

384+
self.pulp_ctx.needs_plugin(
385+
PluginRequirement(
386+
"rpm",
387+
specifier=">=3.30.0",
388+
inverted=True,
389+
feature=_("package_checksum_type/metadata_checksum_type"),
390+
)
391+
)
392+
365393
if metadata_checksum_type and metadata_checksum_type in disallowed_checksums:
366394
self.pulp_ctx.needs_plugin(
367395
PluginRequirement(
@@ -383,6 +411,17 @@ def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> En
383411
feature=_("checksum_type"),
384412
)
385413
)
414+
415+
if "repo_gpgcheck" in body or "gpgcheck" in body:
416+
self.pulp_ctx.needs_plugin(
417+
PluginRequirement(
418+
"rpm",
419+
specifier=">=3.30.0",
420+
inverted=True,
421+
feature=_("gpgcheck/repo_gpgcheck"),
422+
)
423+
)
424+
386425
return body
387426

388427
def sync(self, body: t.Optional[EntityDefinition] = None) -> t.Any:

pulpcore/cli/rpm/repository.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,20 @@ def repository(ctx: click.Context, pulp_ctx: PulpCLIContext, /, repo_type: str)
148148
click.option(
149149
"--metadata-checksum-type",
150150
type=click.Choice(LEGACY_CHECKSUM_CHOICES, case_sensitive=False),
151-
help=_("DEPRECATED: Option specifying the checksum type to use for repository metadata."),
151+
help=_(
152+
"DEPRECATED: Option specifying the checksum type to use for repository metadata. "
153+
"Unavailable for pulp_rpm>=3.30.0"
154+
),
155+
needs_plugins=[PluginRequirement("rpm", specifier="<3.30.0")],
152156
),
153157
click.option(
154158
"--package-checksum-type",
155159
type=click.Choice(LEGACY_CHECKSUM_CHOICES, case_sensitive=False),
156160
help=_(
157161
"DEPRECATED: Option specifying the checksum type to use for packages in "
158-
"repository metadata."
162+
"repository metadata. Unavailable for pulp_rpm>=3.30.0"
159163
),
164+
needs_plugins=[PluginRequirement("rpm", specifier="<3.30.0")],
160165
),
161166
pulp_option(
162167
"--checksum-type",
@@ -172,17 +177,19 @@ def repository(ctx: click.Context, pulp_ctx: PulpCLIContext, /, repo_type: str)
172177
callback=choice_to_int_callback,
173178
help=_(
174179
"""DEPRECATED: Option specifying whether a client should perform a GPG signature check
175-
on packages."""
180+
on packages. Unavailable for pulp_rpm>=3.30.0"""
176181
),
182+
needs_plugins=[PluginRequirement("rpm", specifier="<3.30.0")],
177183
),
178184
click.option(
179185
"--repo-gpgcheck",
180186
type=click.Choice(("0", "1")),
181187
callback=choice_to_int_callback,
182188
help=_(
183189
"""DEPRECATED: Option specifying whether a client should perform a GPG signature check
184-
on the repodata."""
190+
on the repodata. Unavailable for pulp_rpm>=3.30.0"""
185191
),
192+
needs_plugins=[PluginRequirement("rpm", specifier="<3.30.0")],
186193
),
187194
click.option(
188195
"--sqlite-metadata/--no-sqlite-metadata",
@@ -191,6 +198,7 @@ def repository(ctx: click.Context, pulp_ctx: PulpCLIContext, /, repo_type: str)
191198
"""DEPRECATED: An option specifying whether Pulp should generate SQLite metadata.
192199
Unavailable for pulp_rpm>=3.25.0"""
193200
),
201+
needs_plugins=[PluginRequirement("rpm", specifier="<3.25.0")],
194202
),
195203
pulp_option(
196204
"--autopublish/--no-autopublish",

tests/scripts/pulp_rpm/gpgcheck_test.sh

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,31 @@ cleanup () {
1010
}
1111
trap cleanup EXIT
1212

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

18-
expect succ pulp rpm repository update --name "cli-repo-gpgcheck" --gpgcheck 0 --repo-gpgcheck 0
19-
expect succ pulp rpm repository show --name "cli-repo-gpgcheck"
20-
test "$(echo "$OUTPUT" | jq -r '.gpgcheck')" = 0
21-
test "$(echo "$OUTPUT" | jq -r '.repo_gpgcheck')" = 0
20+
expect succ pulp rpm repository update --name "cli-repo-gpgcheck" --gpgcheck 0 --repo-gpgcheck 0
21+
expect succ pulp rpm repository show --name "cli-repo-gpgcheck"
22+
test "$(echo "$OUTPUT" | jq -r '.gpgcheck')" = 0
23+
test "$(echo "$OUTPUT" | jq -r '.repo_gpgcheck')" = 0
24+
else
25+
expect fail pulp rpm repository create --name "cli-repo-gpgcheck" --gpgcheck 1
26+
expect fail pulp rpm repository create --name "cli-repo-gpgcheck" --repo-gpgcheck 1
27+
fi
28+
29+
if pulp debug has-plugin --name "rpm" --specifier ">=3.24.0"
30+
then
31+
expect succ pulp rpm repository create --name "cli-repo-config" --repo-config "{\"gpgcheck\"=1, \"repo_gpgcheck\"=1}"
32+
expect succ pulp rpm repository show --name "cli-repo-config"
33+
test "$(echo "$OUTPUT" | jq -r '.gpgcheck')" = 1
34+
test "$(echo "$OUTPUT" | jq -r '.repo_gpgcheck')" = 1
35+
36+
expect succ pulp rpm repository update --name "cli-repo-config" --repo-config "{\"gpgcheck\"=0, \"repo_gpgcheck\"=0}"
37+
expect succ pulp rpm repository show --name "cli-repo-config"
38+
test "$(echo "$OUTPUT" | jq -r '.gpgcheck')" = 0
39+
test "$(echo "$OUTPUT" | jq -r '.repo_gpgcheck')" = 0
40+
fi

tests/scripts/pulp_rpm/test_rpm_sync_publish.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,12 @@ then
106106

107107
expect_succ pulp rpm repository update --name "cli_test_rpm_repository" --checksum-type sha512
108108
expect_fail pulp rpm repository update --name "cli_test_rpm_repository" --checksum-type sha1
109-
expect_fail pulp rpm repository update --name "cli_test_rpm_repository" --package-checksum-type sha1
110-
expect_fail pulp rpm repository update --name "cli_test_rpm_repository" --metadata-checksum-type sha1
109+
110+
if pulp debug has-plugin --name "rpm" --specifier ">=3.29.0"
111+
then
112+
expect_fail pulp rpm repository update --name "cli_test_rpm_repository" --package-checksum-type sha256
113+
expect_fail pulp rpm repository update --name "cli_test_rpm_repository" --metadata-checksum-type sha256
114+
fi
111115
else
112116
expect_succ pulp rpm repository update --name "cli_test_rpm_repository" --metadata-checksum-type sha1
113117
expect_succ pulp rpm repository update --name "cli_test_rpm_repository" --package-checksum-type sha1

0 commit comments

Comments
 (0)