[projects/pld-builder.new] queue.html: show the packages the src builder failed

arekm arekm at pld-linux.org
Sat Nov 28 21:34:35 CET 2026


commit dd7d886edb8229f248266f8aeddf3708782ee13f
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sat Nov 28 19:26:47 2026 +0100

    queue.html: show the packages the src builder failed
    
    Such a row shows the src builder alone, with its log; a package passed
    on to the bin builders shows them only, and the request's header says
    while its src.rpm is still on the way to ftp.  A builder taken out of
    the configuration keeps its column while the queue has requests for it.

 PLD_Builder/queue_html.py | 75 +++++++++++++++++++++++++++++++----------------
 PLD_Builder/style.css     |  5 ++++
 2 files changed, 55 insertions(+), 25 deletions(-)
---
diff --git a/PLD_Builder/queue_html.py b/PLD_Builder/queue_html.py
index bc65775..87f8a6e 100644
--- a/PLD_Builder/queue_html.py
+++ b/PLD_Builder/queue_html.py
@@ -40,6 +40,10 @@ def write(f, requests):
 def page(requests):
     newest_first = sorted(requests, key=lambda r: r.no, reverse=True)
     history = db.ok_builds({b.spec for r in requests for b in r.batches if not b.is_command()})
+    bins = bin_builders(requests)
+    # each bin builder has a column of its own, empty in rows not sent to it; the src builder takes the
+    # first, alone in the row of a package it failed, and style.css puts that of a command elsewhere
+    columns = {config.src_builder: 1} | {name: i + 1 for i, name in enumerate(bins)}
     now = time.time()
     return (
         '<!DOCTYPE html>\n'
@@ -61,9 +65,9 @@ def page(requests):
         f'<span id="written" title="When this page was written: it is written again when the queue changes">'
         f'data from {exact(now)}, <time class=ago datetime="{iso(now)}"></time></span>\n'
         '</header>\n'
-        + builders_line(requests)
-        + f'<main style="--builders: {len(config.binary_builders)}">\n'
-        + requests_by_day(newest_first, history)
+        + builders_line(requests, bins)
+        + f'<main style="--builders: {len(bins)}">\n'
+        + requests_by_day(newest_first, history, columns)
         + LEGEND.format(zone=time.strftime("%Z"))
         + '</main>\n'
         + f'<script>\n{SCRIPT}</script>\n'
@@ -123,12 +127,17 @@ def running_since(t):
 
 # -- the line of builders
 
-def builders_line(requests):
-    names = [b for b in config.binary_builders]
-    for r in requests:
-        for batch in r.batches:
-            names += [b for b in batch.builders if b not in names]
-    return '<div id="now">\n' + "".join(builder_now(name, requests) for name in names) + '</div>\n'
+def bin_builders(requests):
+    """The bin builders configured, then any other the queue still has: one taken out of the
+    configuration is shown till its last request expires"""
+    names = config.binary_builders + [b for r in requests for batch in r.batches for b in batch.builders]
+    # once each, as a batch queued before Batch.expand_builders() dropped repeats may name one twice
+    return [b for b in dict.fromkeys(names) if b != config.src_builder]
+
+
+def builders_line(requests, bins):
+    # not the src builder: it puts a request into the queue only once it is done with it
+    return '<div id="now">\n' + "".join(builder_now(name, requests) for name in bins) + '</div>\n'
 
 
 def builder_now(name, requests):
@@ -154,7 +163,7 @@ def builder_now(name, requests):
 
 # -- requests
 
-def requests_by_day(requests, history):
+def requests_by_day(requests, history, columns):
     out = []
     day = None
     for r in requests:
@@ -162,7 +171,7 @@ def requests_by_day(requests, history):
         if queued != day:
             day = queued
             out.append(f'<h2>{day}</h2>\n')
-        out.append(request_html(r, history))
+        out.append(request_html(r, history, columns))
     return "".join(out)
 
 
@@ -174,24 +183,32 @@ def request_state(r):
     return "done" if all(is_final(s) for s in statuses) else "open"
 
 
-def request_html(r, history):
+def request_html(r, history, columns):
     flags = "".join(f' <span class="flag {escape(flag)}">{escape(flag)}</span>' for flag in r.flags)
     jobs = f", jobs {r.max_jobs}" if r.max_jobs else ""
+    # a row shows it only where the src builder is the one builder of the package
+    uploading = ""
+    if any(b.builders_status.get(config.src_builder) == "UPLOADING" and config.src_builder not in shown_builders(b)
+           for b in r.batches):
+        uploading = ' <span class=uploading>src.rpm on the way to ftp</span>'
     return (
         f'<section class="request {request_state(r)}" id="{r.no}" data-requester="{escape(r.requester)}">\n'
         f'<header class="{escape(" ".join(r.flags))}"><a class=no href="#{r.no}">{r.no}</a> <b class=from>{escape(r.requester)}</b>{flags}'
         f' <span class=rid>priority {r.priority}{jobs}, <a href="srpms/{escape(r.id)}">{escape(r.id)}</a></span>'
-        f' <span class=sent>queued {clock_zone(r.time)}, <time class=ago datetime="{iso(r.time)}"></time></span></header>\n'
-        + "".join(batch_html(batch, r.id, history) for batch in r.batches)
+        f' <span class=sent>queued {clock_zone(r.time)}, <time class=ago datetime="{iso(r.time)}"></time></span>{uploading}</header>\n'
+        + "".join(batch_html(batch, r.id, history, columns) for batch in r.batches)
         + '</section>\n'
     )
 
 
 def batch_name(batch):
-    return "command" if batch.is_command() else batch.src_rpm.removesuffix(".src.rpm")
+    if batch.is_command():
+        return "command"
+    # no src.rpm when building it failed
+    return batch.src_rpm.removesuffix(".src.rpm") or batch.spec.removesuffix(".spec")
 
 
-def batch_html(batch, request_id, history):
+def batch_html(batch, request_id, history, columns):
     if batch.is_command():
         flags = f" [{escape(' '.join(batch.command_flags))}]" if batch.command_flags else ""
         what = f'<b>command</b>{flags}<pre>{escape(batch.command.strip())}</pre>'
@@ -205,12 +222,21 @@ def batch_html(batch, request_id, history):
                 f'{escape(options)}</span>')
     return (
         f'<div class="batch{" command" if batch.is_command() else ""}">\n<div class=what>{what}</div>\n<div class=builders>\n'
-        + "".join(builder_html(batch, name, request_id, history) for name in batch.builders)
+        # in the order of their columns, which a narrow page shows one under another, the src builder first
+        + "".join(builder_html(batch, name, request_id, history, columns[name])
+                  for name in sorted(shown_builders(batch), key=lambda n: (columns[n], n != config.src_builder)))
         + '</div>\n</div>\n'
     )
 
 
-def builder_html(batch, name, request_id, history):
+def shown_builders(batch):
+    """A package the src builder passed on shows the bin builders alone: that they have it says the src.rpm was made"""
+    if batch.is_command() or batch.builders == [config.src_builder]:
+        return batch.builders
+    return [b for b in batch.builders if b != config.src_builder]
+
+
+def builder_html(batch, name, request_id, history, column):
     """What one builder made of a batch: status, start and end, duration and log, each in a column of its own"""
     status = batch.builders_status[name]
     start = batch.builders_build_start.get(name)
@@ -251,12 +277,8 @@ def builder_html(batch, name, request_id, history):
     more = ", ".join(([f"<b class=took{data}>{took}</b>"] if took else []) + ([last_ok] if last_ok else []) + ([log] if log else []))
     more = f" ({more})" if more else ""
     title = f' title="{escape(about)}"' if about else ""
-    # each bin builder in its own column, empty in rows not sent to it; the src builder goes elsewhere
-    if name in config.binary_builders:
-        src, column = "", f' style="--column: {config.binary_builders.index(name) + 1}"'
-    else:
-        src, column = " src", ""
-    return (f'<div class="builder {kind(status)}{src}"{column}{title}><span class=who>{escape(name)}</span>'
+    src = " src" if name == config.src_builder else ""
+    return (f'<div class="builder {kind(status)}{src}" style="--column: {column}"{title}><span class=who>{escape(name)}</span>'
             f'<span class=state>{plaque(status)}{more}</span><span class=span>{span}</span></div>\n')
 
 
@@ -272,7 +294,8 @@ LEGEND = """<h2>How to read a request</h2>
 <section class="request legend">
 <header><span class=no>number</span> <b class=from>who sent it</b> <span class="flag upgrade">upgrade</span>
  or <span class="flag test-build">test-build</span>, <span class="flag skip">skip</span> when asked to stop <span class=rid>priority, request id with its src.rpm files</span>
- <span class=sent>queued: when the src builder took the request in</span></header>
+ <span class=sent>queued: when the src builder took the request in</span>
+ <span class=uploading>src.rpm on the way to ftp</span> till the src builder has put it there</header>
 <div class=batch>
 <div class=what><b>package-version-release</b> spec and branch with their git log, build options</div>
 <div class=builders>
@@ -301,6 +324,8 @@ LEGEND = """<h2>How to read a request</h2>
 </div>
 <p class=note>Start and end: from the builder taking the package (fetching the src.rpm, installing
 BuildRequires, rpmbuild) to its result; sending the rpms to ftp is not counted. A tooltip gives them to the second.
+A package whose src.rpm the src builder fails to make or tag (its tag exists, a source is missing) goes to no bin
+builder: the src builder alone shows it.
 Last OK time: how long the package last built well on that builder, whatever this build ends with. A duration <b class="took slow">on orange</b> is a fifth
 longer than on the other builders (or than the last OK one, while none of them is done), <b class="took slower">on dark orange</b>
 twice as long, and at least a minute either way. The stripe on the left is red when anything failed, yellow while something waits or builds, green when
diff --git a/PLD_Builder/style.css b/PLD_Builder/style.css
index 9f2d5fc..78c4ff1 100644
--- a/PLD_Builder/style.css
+++ b/PLD_Builder/style.css
@@ -162,6 +162,11 @@ h2 {
 	margin-left: 12px;
 }
 
+.uploading {
+	font-style: italic;
+	margin-left: 12px;
+}
+
 .rid {
 	color: #555;
 	font-size: 12px;
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/pld-builder.new.git/commitdiff/037bbbdb7a6dd2a0d492f650797514fec18bc6b8



More information about the pld-cvs-commit mailing list