diff mbox series

[1/2] toaster: Add script to compare toaster fixtures to project release data

Message ID 20250305101732.2042605-1-richard.purdie@linuxfoundation.org
State Accepted, archived
Commit 5b2d79ed505bbfa2fb2d355935e75199b7f2c37e
Headers show
Series [1/2] toaster: Add script to compare toaster fixtures to project release data | expand

Commit Message

Richard Purdie March 5, 2025, 10:17 a.m. UTC
We need to validate the toaster fixtures information against our current release
data to ensure it is correct when we release. Add a script we can use to
do this which the autobuilder can run to validate things.

[YOCTO #15516]

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/toaster/orm/fixtures/check_fixtures.py | 38 ++++++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100755 lib/toaster/orm/fixtures/check_fixtures.py
diff mbox series

Patch

diff --git a/lib/toaster/orm/fixtures/check_fixtures.py b/lib/toaster/orm/fixtures/check_fixtures.py
new file mode 100755
index 0000000000..ae3722e0f6
--- /dev/null
+++ b/lib/toaster/orm/fixtures/check_fixtures.py
@@ -0,0 +1,38 @@ 
+#!/usr/bin/env python3
+#
+# Copyright (C) 2025 Linux Foundation
+# SPDX-License-Identifier: GPL-2.0-only
+#
+
+import json
+import urllib.request
+
+import gen_fixtures as fixtures
+
+RELEASE_URL = "https://dashboard.yoctoproject.org/releases.json"
+
+with urllib.request.urlopen(RELEASE_URL) as response:
+    if response.getcode() == 200:
+        data = response.read().decode("utf-8")
+        releases = json.loads(data)
+    else:
+        print("Couldn't access %s: %s" % (RELEASE_URL, reponse.getcode()))
+        exit(1)
+
+
+# grab the recent release branches and add master, so we can ignore old branches
+active_releases = [
+    e["release_codename"].lower() for e in releases if e["series"] == "current"
+]
+active_releases.append("master")
+active_releases.append("head")
+
+fixtures_releases = [x[0].lower() for x in fixtures.current_releases]
+
+if set(active_releases) != set(fixtures_releases):
+    print("WARNING: Active releases don't match toaster configured releases, the difference is: %s" % set(active_releases).difference(set(fixtures_releases)))
+    print("Active releases: %s" % sorted(active_releases))
+    print("Toaster configured releases: %s" % sorted(fixtures_releases))
+else:
+    print("Success, configuration matches")
+