Repository: packit/packit
Pull request #2619 (2025-06-01 20:33:14)

Properly transform minor versions of EPEL 10+ to mock/Copr chroots
Fixes https://github.com/packit/packit/issues/2615.

softwarefactory-project-zuul[bot]: Build succeeded.
https://softwarefactory-project.io/zuul/t/packit-service/buildset/af4eb6cf25ab428ab1cd7e29794a6162

:heavy_check_mark: [pre-commit ](https://softwarefactory-project.io/zuul/t/packit-service/build/a37de49c4ab54c7c8fa9b033a6509edc) SUCCESS in 2m 06s
:heavy_check_mark: [packit-tests-rpm ](https://softwarefactory-project.io/zuul/t/packit-service/build/b512ecde010d444685386f130aa08ce8) SUCCESS in 22m 14s
:heavy_check_mark: [packit-tests-pip-deps ](https://softwarefactory-project.io/zuul/t/packit-service/build/412fd28bc12248bf942a2e9dc7ff7377) SUCCESS in 22m 34s
:heavy_check_mark: [packit-tests-git-main ](https://softwarefactory-project.io/zuul/t/packit-service/build/7602448b2e9645c2aca2a4b726075a16) SUCCESS in 22m 32s
:heavy_check_mark: [packit-tests-pip-deps-sess-rec ](https://softwarefactory-project.io/zuul/t/packit-service/build/9be895bba91f4c119d5e2c4b11687dce) SUCCESS in 2m 55s
:heavy_check_mark: [packit-tests-git-main-sess-rec ](https://softwarefactory-project.io/zuul/t/packit-service/build/81e0d2229180458c8cc07f02931b9968) SUCCESS in 2m 58s
:heavy_check_mark: [reverse-dep-packit-service-tests ](https://softwarefactory-project.io/zuul/t/packit-service/build/a793d296450446e6a477162f8eba084e) SUCCESS in 5m 29s


Patch:
diff --git a/packit/config/aliases.py b/packit/config/aliases.py
index f6b4a089..4a0aaf50 100644
--- a/packit/config/aliases.py
+++ b/packit/config/aliases.py
@@ -189,10 +189,15 @@ def get_build_targets(
 
     def chroot_name(x):
         if isinstance(x, Distro):
-            if x.namever.startswith("epel-10."):
-                # TODO: change this accordingly once mock/Copr chroot names
-                #       for minor EPEL versions are known
-                return "epel-10"
+            name, ver = x.namever.split("-", maxsplit=1)
+            if name == "epel":
+                # handle minor versions of EPEL 10+
+                majorver = int(ver.split(".", maxsplit=1)[0])
+                if majorver >= 10:
+                    if "." in x.branch:
+                        return f"rhel+{name}-{majorver}"
+                    return f"{name}-{majorver}"
+                return x.namever
             return x.namever
         return x
 


Test patch:
diff --git a/tests/unit/config/test_config_aliases.py b/tests/unit/config/test_config_aliases.py
index 23393047..e6afc4ef 100644
--- a/tests/unit/config/test_config_aliases.py
+++ b/tests/unit/config/test_config_aliases.py
@@ -81,6 +81,10 @@ class TestGetBuildTargets:
             ("rawhide", {"fedora-rawhide-x86_64"}),
             ("fedora-29", {"fedora-29-x86_64"}),
             ("epel-8", {"epel-8-x86_64"}),
+            ("epel-10", {"epel-10-x86_64"}),
+            ("epel-10-branched", {"rhel+epel-10-x86_64"}),
+            ("epel10", {"epel-10-x86_64"}),
+            ("epel10.0", {"rhel+epel-10-x86_64"}),
             ("fedora-rawhide", {"fedora-rawhide-x86_64"}),
             ("openmandriva-rolling", {"openmandriva-rolling-x86_64"}),
             ("opensuse-leap-15.0", {"opensuse-leap-15.0-x86_64"}),
diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py
index 4aa7b807..58e2cfcb 100644
--- a/tests/unit/conftest.py
+++ b/tests/unit/conftest.py
@@ -45,6 +45,16 @@ def mock_get_aliases():
                 Distro("epel-10.0", "epel10.0"),
                 Distro("epel-10.1", "epel10"),
             ],
+            "epel-10-all": [
+                Distro("epel-10.0", "epel10.0"),
+                Distro("epel-10.1", "epel10"),
+            ],
+            "epel-10-branched": [
+                Distro("epel-10.0", "epel10.0"),
+            ],
+            "epel-10": [
+                Distro("epel-10.1", "epel10"),
+            ],
             "opensuse-leap-all": [
                 "opensuse-leap-15.5",
                 "opensuse-leap-15.4",