From 91f94c219327293cd0793887b46f36846dcea792 Mon Sep 17 00:00:00 2001 From: Arif Burak Demiray Date: Mon, 30 Nov 2026 16:08:48 +0300 Subject: [PATCH] Accept Maven 3.10's repository record in the consumer check --- .github/release/consumers.py | 6 +++++- .github/release/tests/test_consumers.py | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/release/consumers.py b/.github/release/consumers.py index 69eb7151..6b269c87 100644 --- a/.github/release/consumers.py +++ b/.github/release/consumers.py @@ -1,5 +1,6 @@ """Commands for the clean projects in .github/release/consumers that build against a staged release.""" +import re from pathlib import Path GRADLE_PROJECT = ".github/release/consumers/gradle" @@ -7,6 +8,9 @@ GRADLE_FLAGS = ["--no-daemon", "--no-configuration-cache", "--stacktrace"] PROBE_CLASS = "ly.count.consumer.Probe" REPOSITORY_ID = "countly" +# Maven 3.9 records the repository as "countly=", Maven 3.10 as "countly-=". A hex-only suffix +# keeps the "countly-public" repository out. +STAGED_SOURCE = re.compile(rf"{REPOSITORY_ID}(-[0-9a-f]+)?=") def gradle_command(gradlew, repository, public_repository, plan, artifact): @@ -51,6 +55,6 @@ def maven_source_problems(local_repository, plan, consumed): problems.append(f"Maven did not download {artifact.coordinates}:{plan.version}") continue sources = [line.split(">", 1)[1] for line in record.read_text(encoding="utf-8").splitlines() if ">" in line and not line.startswith("#")] - if not sources or any(source != f"{REPOSITORY_ID}=" for source in sources): + if not sources or any(not STAGED_SOURCE.fullmatch(source) for source in sources): problems.append(f"Maven resolved {artifact.coordinates}:{plan.version} from another repository than the staged release") return problems diff --git a/.github/release/tests/test_consumers.py b/.github/release/tests/test_consumers.py index b1c75d14..c50680bf 100644 --- a/.github/release/tests/test_consumers.py +++ b/.github/release/tests/test_consumers.py @@ -52,6 +52,16 @@ def test_maven_must_resolve_the_release_from_the_staged_folder(self): self.write_record(local, self.ui, "26.8.1", "java-ui-26.8.1.jar>central=\njava-ui-26.8.1.pom>countly=\n") self.assertEqual(maven_source_problems(local, self.ui_plan, self.ui), ["Maven resolved ly.count.sdk:java-ui:26.8.1 from another repository than the staged release"]) + def test_maven_3_10_records_the_staged_folder_with_a_hash_of_its_url(self): + """Maven 3.10 writes the repository ID followed by a hash of its URL; the public repository must still fail.""" + local = tempfile.mkdtemp() + staged = "countly-58d9892363928677300153295cdc58687f00b301=" + self.write_record(local, self.java, "26.9.0", f"java-26.9.0.jar>{staged}\njava-26.9.0.pom>{staged}\n") + self.assertEqual(maven_source_problems(local, self.core_plan, self.java), []) + public = "countly-public-0c2d4b3f1e8a7c6d5b4a3f2e1d0c9b8a7f6e5d4c=" + self.write_record(local, self.java, "26.9.0", f"java-26.9.0.jar>{public}\njava-26.9.0.pom>{staged}\n") + self.assertEqual(maven_source_problems(local, self.core_plan, self.java), ["Maven resolved ly.count.sdk:java:26.9.0 from another repository than the staged release"]) + def test_the_core_of_a_ui_release_may_come_from_anywhere(self): local = tempfile.mkdtemp() self.write_record(local, self.ui, "26.8.1", "java-ui-26.8.1.jar>countly=\njava-ui-26.8.1.pom>countly=\n")