From dcd7e5ff2a42f18578f8fab72d7919db8d040903 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Mon, 28 Apr 2025 12:49:02 +0200 Subject: [PATCH] Drop compatibility with Koji < 1.32 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 1.32 version with checksum API has been released more than 2 years ago. Signed-off-by: Lubomír Sedlář (cherry picked from commit 65336b406c01a99ccc9dabd011cc969b4395e106) --- pungi/phases/pkgset/pkgsets.py | 24 ++++++++---------------- pungi/wrappers/kojiwrapper.py | 2 -- tests/test_pkgset_pkgsets.py | 1 - 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/pungi/phases/pkgset/pkgsets.py b/pungi/phases/pkgset/pkgsets.py index a252ba54..a0daf489 100644 --- a/pungi/phases/pkgset/pkgsets.py +++ b/pungi/phases/pkgset/pkgsets.py @@ -548,22 +548,14 @@ class KojiPackageSet(PackageSetBase): pathinfo = self.koji_wrapper.koji_module.pathinfo paths = [] - if "getRPMChecksums" in self.koji_wrapper.koji_methods: - - def checksum_validator(keyname, pkg_path): - checksums = self.koji_proxy.getRPMChecksums( - rpm_info["id"], checksum_types=("sha256",) - ) - if "sha256" in checksums.get(keyname, {}): - computed = compute_file_checksums(pkg_path, ("sha256",)) - if computed["sha256"] != checksums[keyname]["sha256"]: - raise RuntimeError("Checksum mismatch for %s" % pkg_path) - - else: - - def checksum_validator(keyname, pkg_path): - # Koji doesn't support checksums yet - pass + def checksum_validator(keyname, pkg_path): + checksums = self.koji_proxy.getRPMChecksums( + rpm_info["id"], checksum_types=("sha256",) + ) + if "sha256" in checksums.get(keyname, {}): + computed = compute_file_checksums(pkg_path, ("sha256",)) + if computed["sha256"] != checksums[keyname]["sha256"]: + raise RuntimeError("Checksum mismatch for %s" % pkg_path) attempts_left = self.signed_packages_retries + 1 while attempts_left > 0: diff --git a/pungi/wrappers/kojiwrapper.py b/pungi/wrappers/kojiwrapper.py index 91a8e89d..8f63509a 100644 --- a/pungi/wrappers/kojiwrapper.py +++ b/pungi/wrappers/kojiwrapper.py @@ -72,8 +72,6 @@ class KojiWrapper(object): self.koji_proxy = tracing.instrument_xmlrpc_proxy( koji.ClientSession(self.koji_module.config.server, session_opts) ) - with tracing.span("koji.system.listMethods"): - self.koji_methods = self.koji_proxy.system.listMethods() # This retry should be removed once https://pagure.io/koji/issue/3170 is # fixed and released. diff --git a/tests/test_pkgset_pkgsets.py b/tests/test_pkgset_pkgsets.py index a33d5ccf..3bc8efaf 100644 --- a/tests/test_pkgset_pkgsets.py +++ b/tests/test_pkgset_pkgsets.py @@ -158,7 +158,6 @@ class TestKojiPkgset(PkgsetCompareMixin, helpers.PungiTestCase): self.koji_downloader = helpers.FSKojiDownloader() self.koji_wrapper = mock.Mock() self.koji_wrapper.koji_proxy.listTaggedRPMS.return_value = self.tagged_rpms - self.koji_wrapper.koji_methods = ["getRPM", "getRPMChecksums"] self.koji_wrapper.koji_module.pathinfo = self.path_info def _touch_files(self, filenames):