diff mbox series

[yocto-autobuilder-helper,v2,5/7] scripts/yocto-supported-distros: add option to print old distros

Message ID 20250806-check-worker-statuses-v2-5-59dd990d22e7@bootlin.com
State New
Headers show
Series scripts/yocto-supported-distros improvements | expand

Commit Message

Antonin Godard Aug. 6, 2025, 3:43 p.m. UTC
We can use config.py to list distributions that used to be tested for a
given release, by comparing the values in workers_prev_releases (all
workers for a release) and all_workers (all active workers for any
release).

Add the --old-distros to do that. Make it mutually exclusive to
--compare, we don't want to do multiple things at the same time.

Add a pattern to match centos, as it was defined for kirkstone in the
past (we use stream now).

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
 scripts/yocto-supported-distros | 30 +++++++++++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/scripts/yocto-supported-distros b/scripts/yocto-supported-distros
index f05788e..d53cc68 100755
--- a/scripts/yocto-supported-distros
+++ b/scripts/yocto-supported-distros
@@ -80,9 +80,15 @@  def parse_arguments() -> argparse.Namespace:
                     action="store_true",
                     help="Get config.py from yoctoproject's git web interface")
 
-    parser.add_argument("--compare",
-                        action="store_true",
-                        help="Compare to poky.conf releases")
+    g3 = parser.add_mutually_exclusive_group()
+
+    g3.add_argument("--compare",
+                    action="store_true",
+                    help="Compare to poky.conf releases")
+
+    g3.add_argument("--old-distros",
+                    action="store_true",
+                    help="Print previously tested distros")
 
     parser.add_argument("--check-worker-statuses",
                         action="store_true",
@@ -211,6 +217,11 @@  def _mangle_worker(worker: str) -> str:
     if m:
         return f"centosstream-{m.group(1)}"
 
+    r = re.compile(r"^centos(\d+)")
+    m = re.match(r, worker)
+    if m:
+        return f"centos-{m.group(1)}"
+
     r = re.compile(r"^ubuntu(\d{2})(\d{2})")
     m = re.match(r, worker)
     if m:
@@ -354,6 +365,19 @@  def main():
         else:
             print("All good!")
 
+    elif args.old_distros:
+        if release == "master":
+            print("The --old-distros argument only makes sense for stable release")
+            exit(1)
+
+        old_distros = []
+
+        for distro in config.workers_prev_releases[release]:
+            if not any(distro in w for w in config.all_workers):
+                old_distros.append(_mangle_worker(distro))
+
+        _print_workers(release, old_distros)
+
     else:
         _print_workers(release, possible_workers)