From e256f74f2abba943e08c28601b82bab6acaf868c Mon Sep 17 00:00:00 2001
From: Max Gautier <mg@max.gautier.name>
Date: Thu, 5 Sep 2024 16:39:04 +0200
Subject: [PATCH] download_hash: propagate new patch versions to all archs

---
 scripts/download_hash.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/scripts/download_hash.py b/scripts/download_hash.py
index 727a7e317..ded61fb55 100644
--- a/scripts/download_hash.py
+++ b/scripts/download_hash.py
@@ -52,6 +52,18 @@ def download_hash(only_downloads: [str]) -> None:
     for download, url in (downloads if only_downloads == []
                           else {k:downloads[k] for k in downloads.keys() & only_downloads}).items():
         checksum_name = f"{download}_checksums"
+        # Propagate new patch versions to all architectures
+        for arch in data[checksum_name].values():
+            for arch2 in data[checksum_name].values():
+                arch.update({
+                    v:("NONE" if arch2[v] == "NONE" else 0)
+                    for v in (set(arch2.keys()) - set(arch.keys()))
+                    if v.split('.')[2] == '0'})
+                    # this is necessary to make the script indempotent,
+                    # by only adding a vX.X.0 version (=minor release) in each arch
+                    # and letting the rest of the script populate the potential
+                    # patch versions
+
         for arch, versions in data[checksum_name].items():
             for minor, patches in groupby(versions.copy().keys(), lambda v : '.'.join(v.split('.')[:-1])):
                 for version in (f"{minor}.{patch}" for patch in
-- 
GitLab