summary refs log tree commit diff stats
path: root/gitlab/output.py
diff options
context:
space:
mode:
authorChristian Krinitsin <mail@krinitsin.com>2025-05-18 16:17:59 +0200
committerChristian Krinitsin <mail@krinitsin.com>2025-05-18 16:17:59 +0200
commita9eb56beab0a66199b6fc7844132d28ba81174fa (patch)
treec918fe98b6fe49c20956646efa052fe7fb7b5889 /gitlab/output.py
parent53d4922d51b6b40ed85367ec611773abe47421e5 (diff)
downloadqemu-analysis-a9eb56beab0a66199b6fc7844132d28ba81174fa.tar.gz
qemu-analysis-a9eb56beab0a66199b6fc7844132d28ba81174fa.zip
move project to gitlab directory
Diffstat (limited to 'gitlab/output.py')
-rwxr-xr-xgitlab/output.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/gitlab/output.py b/gitlab/output.py
new file mode 100755
index 000000000..745081aef
--- /dev/null
+++ b/gitlab/output.py
@@ -0,0 +1,23 @@
+from tomlkit import dumps
+from os import path, makedirs
+
+def find_label(labels, keyword):
+    match = next((s for s in labels if f"{keyword}:" in s), None)
+    if not match:
+        return f"{keyword}_missing"
+    return match.replace(": ", "_")
+
+def write_file(file_path, string):
+    makedirs(path.dirname(file_path), exist_ok=True)
+    with open(file_path, "w") as file:
+        file.write(string)
+
+def output_issue(issue):
+    labels = issue['labels']
+    issue_id = issue['id']
+    toml_string = dumps(issue)
+
+    target_label = find_label(labels, "target")
+    host_label = find_label(labels, "host")
+    accel_label = find_label(labels, "accel")
+    write_file(f"issues/{target_label}/{host_label}/{accel_label}/{issue_id}.toml", toml_string)