From 1c34c52707bbc0e8174b43ed6d41786f3024e976 Mon Sep 17 00:00:00 2001 From: Kevin Yue Date: Thu, 19 Nov 2026 03:39:45 +0800 Subject: [PATCH] fix: verify current distribution metadata --- .../globalprotect-openconnect-git/.SRCINFO | 1 - scripts/tests/test_wait_for_publication.py | 27 +++++++++++++------ scripts/wait-for-publication.py | 16 ++++++----- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/packaging/aur/globalprotect-openconnect-git/.SRCINFO b/packaging/aur/globalprotect-openconnect-git/.SRCINFO index 69aebce..c2b7d05 100644 --- a/packaging/aur/globalprotect-openconnect-git/.SRCINFO +++ b/packaging/aur/globalprotect-openconnect-git/.SRCINFO @@ -22,7 +22,6 @@ pkgbase = globalprotect-openconnect-git makedepends = librsvg makedepends = cargo depends = webkit2gtk-4.1 - depends = libappindicator-gtk3 depends = libsecret depends = libxml2 depends = zlib diff --git a/scripts/tests/test_wait_for_publication.py b/scripts/tests/test_wait_for_publication.py index 29f161b..23a4c14 100644 --- a/scripts/tests/test_wait_for_publication.py +++ b/scripts/tests/test_wait_for_publication.py @@ -39,14 +39,6 @@ class RepositoryTests(unittest.TestCase): with self.assertRaises(publication.Pending): publication.rpm_packages("https://repo") - def test_copr_same_version_from_another_build_does_not_pass(self): - primary = ET.fromstring(''' - globalprotect-openconnectx86_64 - ''') - with patch.object(publication, "rpm_packages", return_value=primary): - params = ("https://repo", "globalprotect-openconnect", "3.0.1", "x86_64", lambda release: True) - self.assertTrue(publication.rpm_present(*params, build_id=11106217)) - self.assertFalse(publication.rpm_present(*params, build_id=11106218)) class LaunchpadTests(unittest.TestCase): @@ -138,6 +130,25 @@ class OBSTests(unittest.TestCase): class CoprTests(unittest.TestCase): + def test_migrated_repository_matches_exact_build_manifest(self): + checker = publication.Copr(arguments(build_id=42)) + build = {"ownername": "yuezk", "projectname": "globalprotect-openconnect", + "state": "succeeded", "source_package": {"name": "globalprotect-openconnect", "version": "3.0.1-1"}, + "chroots": ["fedora-44-x86_64"], "repo_url": "https://repo"} + status = {"state": "succeeded", "result_url": "https://results/42/"} + package = {"name": "globalprotect-openconnect", "version": "3.0.1", "release": "1.fc44", "arch": "x86_64"} + primary = ET.fromstring(''' + globalprotect-openconnectx86_64 + ''') + with patch.object(publication, "api", side_effect=[build, status, {"packages": [package]}]), \ + patch.object(publication, "rpm_packages", return_value=primary): + self.assertIn("1 targets built and published", checker.check()) + package["release"] = "1.fc45" + with patch.object(publication, "api", side_effect=[build, status, {"packages": [package]}]), \ + patch.object(publication, "rpm_packages", return_value=primary): + with self.assertRaisesRegex(publication.Pending, "Waiting for Copr build 42"): + checker.check() + def test_unselected_chroot_cannot_be_hidden_by_verification(self): checker = publication.Copr(arguments(build_id=42, chroots=["fedora-44-x86_64"])) build = {"ownername": "yuezk", "projectname": "globalprotect-openconnect", diff --git a/scripts/wait-for-publication.py b/scripts/wait-for-publication.py index 78efe7c..51ba144 100644 --- a/scripts/wait-for-publication.py +++ b/scripts/wait-for-publication.py @@ -84,17 +84,14 @@ def rpm_packages(base_url): return ET.fromstring(unpack(content, location)) -def rpm_present(base_url, package, version, arch, release_matches, build_id=None): +def rpm_present(base_url, package, version, arch, release_matches): namespace = {"rpm": "http://linux.duke.edu/metadata/common"} for entry in rpm_packages(base_url).findall("rpm:package", namespace): info = entry.find("rpm:version", namespace) - location = entry.find("rpm:location", namespace).get("href") if (entry.findtext("rpm:name", namespaces=namespace) != package or entry.findtext("rpm:arch", namespaces=namespace) != arch or info.get("ver") != version or not release_matches(info.get("rel", ""))): continue - if build_id is not None and not re.search(rf"(?:^|/)0*{build_id}-", location): - continue return True return False @@ -254,9 +251,16 @@ class Copr: raise Pending(f"Copr {chroot}: {status['state']}; {link}") base = build["repo_url"].rstrip("/") + "/" + chroot arch = chroot.rsplit("-", 1)[1] + packages = api(urljoin(status["result_url"], "results.json"))["packages"] + package = next((item for item in packages + if item["name"] == args.package and item["version"] == args.version + and item["arch"] == arch + and (item["release"] == args.revision + or item["release"].startswith(args.revision + "."))), None) + if package is None: + raise Failed(f"Copr build {args.build_id} has no requested package for {chroot}") if not rpm_present(base, args.package, args.version, arch, - lambda release: release == args.revision or release.startswith(args.revision + "."), - build_id=args.build_id): + lambda release: release == package["release"]): raise Pending(f"Waiting for Copr build {args.build_id} in {base}") return f"Copr build {args.build_id}: {len(build['chroots'])} targets built and published; {link}"