[Git][qa/jenkins.debian.net][master] rdn stats: fix sort and diff URL

Holger Levsen (@holger) gitlab at salsa.debian.org
Tue Aug 26 09:25:31 BST 2025



Holger Levsen pushed to branch master at Debian QA / jenkins.debian.net


Commits:
210b9e66 by Jochen Sprickerhof at 2025-08-26T10:25:22+02:00
rdn stats: fix sort and diff URL

(cherry picked from commit c47b5242359ea5c6f80d40ae3548b03c40b11a4b)
Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -


1 changed file:

- bin/rebuilderd_stats.py


Changes:

=====================================
bin/rebuilderd_stats.py
=====================================
@@ -154,7 +154,7 @@ def main() -> None:
         filter_release = f"AND s.release = '{args.release}'"
     if cu.execute("SELECT COUNT(name) FROM sqlite_schema WHERE name = 'rebuild_artifacts'").fetchall()[0][0] == 1:
         sql = (
-            "SELECT a.name, s.name, r.id, l.build_log, d.diffoscope_log"
+            "SELECT a.name, s.name, r.id, l.build_log, d.diffoscope_log, a.id"
             " FROM rebuild_artifacts a"
             " JOIN diffoscope_logs d ON a.diffoscope_log_id = d.id"
             " JOIN rebuilds r ON a.rebuild_id = r.id"
@@ -166,18 +166,18 @@ def main() -> None:
         api = "../api/v1"
     else:
         sql = (
-            "SELECT p.name, s.name, p.build_id, b.build_log, b.diffoscope"
+            "SELECT p.name, s.name, p.build_id, b.build_log, b.diffoscope, NULL"
             " FROM packages p JOIN pkgbases s ON s.id = p.pkgbase_id LEFT JOIN builds b ON b.id = p.build_id"
             " WHERE p.status = 'BAD' ORDER BY p.build_id"
         )
         api = "api/v0"
-    for name, src_name, build_id, build_log, diffoscope in cu.execute(sql):
+    for name, src_name, build_id, build_log, diffoscope, diffoscope_id in cu.execute(sql):
         total += 1
 
         if build_id in cache:
             cache_new[build_id] = cache[build_id]
             message, difflen = cache[build_id]
-            messages_packages[message].append({"name": name, "src": src_name, "id": build_id, "diff": difflen})
+            messages_packages[message].append({"name": name, "src": src_name, "id": build_id, "diff": difflen, "diff_id": diffoscope_id})
             continue
 
         build_log = unzstd.stream_reader(build_log).read().decode("utf-8")
@@ -190,7 +190,7 @@ def main() -> None:
             if error_match_fn(build_log, diffoscope):
                 difflen = len(diffoscope)
                 cache_new[build_id] = (message, difflen)
-                messages_packages[message].append({"name": name, "src": src_name, "id": build_id, "diff": difflen})
+                messages_packages[message].append({"name": name, "src": src_name, "id": build_id, "diff": difflen, "diff_id": diffoscope_id})
                 break
 
     messages_packages = {k: v for k, v in messages_packages.items() if v}  # Remove empty categories
@@ -254,9 +254,11 @@ def output(outfile, arch, db_size, total, messages_packages, size_sort, api):
     def sorter(pkg):
         if rn_bug := rn_bugs.get(pkg["src"]):
             if "bugs" in rn_bug or "comments" in rn_bug:
+                if size_sort and pkg["diff"]:
+                    return 1 - 1 / pkg["diff"]
                 return -1
-        if size_sort:
-            return pkg["diff"]
+            if size_sort and pkg["diff"]:
+                return pkg["diff"]
         return 1
 
     if arch not in ['amd64', 'arm64']:
@@ -272,12 +274,15 @@ def output(outfile, arch, db_size, total, messages_packages, size_sort, api):
         bug_break = False
         print("<p><span>", file=outfile)
         for pkg in sorted(packages, key=sorter):
-            if not bug_break and not (pkg["src"] in rn_bugs and ("bugs" in rn_bugs[pkg["src"] or "comments" in rn_bugs[pkg["src"]]])):
+            if not bug_break and (pkg["src"] not in rn_bugs or ("bugs" not in rn_bugs[pkg["src"]] and "comments" not in rn_bugs[pkg["src"]])):
                 bug_break = True
                 print("</span></p><p><span>", file=outfile)
             print(f'<a href="../{api}/builds/{pkg["id"]}/log">{pkg["name"]}</a> ', end='', file=outfile)
             if pkg["diff"]:
-                print(f'<a href="../{api}/builds/{pkg["id"]}/diffoscope">💠</a>', end='', file=outfile)
+                if pkg["diff_id"]:
+                    print(f'<a href="../{api}/builds/{pkg["id"]}/artifacts/{pkg["diff_id"]}/diffoscope">💠</a>', end='', file=outfile)
+                else:
+                    print(f'<a href="../{api}/builds/{pkg["id"]}/diffoscope">💠</a>', end='', file=outfile)
             print(f'<a href="https://tracker.debian.org/pkg/{pkg["src"]}">🍥</a>', end='', file=outfile)
             print(f'<a href="https://tests.reproducible-builds.org/debian/rb-pkg/trixie/{ci_arch}/{pkg["src"]}.html">🔬</a>', end='', file=outfile)
             if rn_bug := rn_bugs.get(pkg["src"]):



View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/210b9e66270afd848d623e2216d80c625dac23ea

-- 
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/210b9e66270afd848d623e2216d80c625dac23ea
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/qa-jenkins-scm/attachments/20250826/22442887/attachment-0001.htm>


More information about the Qa-jenkins-scm mailing list