[projects/pld-builder.new] srpm_builder: publish the batches that failed here too
arekm
arekm at pld-linux.org
Sat Nov 28 21:34:30 CET 2026
commit 893f56a21d531a950aa0eba2ab01899842d8fa53
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Sat Nov 28 19:26:08 2026 +0100
srpm_builder: publish the batches that failed here too
A request whose src.rpm failed (tag exists, no sources) never reached
the queue, so queue.html did not show it. Each batch now carries the
src builder's status; failed and skipped ones go to no bin builder.
rebuild-kernel-packages stops on a failed command at once.
Bin builders without the previous commit build such a batch and wreck
the request: update them first, then the src builder (th-* matches
th-src too, so name the bin builders):
make-request --pull -b 'th-x86_64 th-i686 ...'
make-request --pull -b th-src once each bin builder has it OK
An older rebuild-kernel-packages.py takes a published FAIL of its
command for done and goes on sending the builds.
PLD_Builder/db.py | 2 +-
PLD_Builder/notify.py | 10 ++++++++--
PLD_Builder/request_handler.py | 10 ++++++++--
PLD_Builder/srpm_builder.py | 14 +++++++++-----
client/rebuild-kernel-packages.py | 18 ++++++++++++------
doc/jak-to-dziala.txt | 4 +++-
6 files changed, 41 insertions(+), 17 deletions(-)
---
diff --git a/PLD_Builder/db.py b/PLD_Builder/db.py
index 1e96aac..ba2482d 100644
--- a/PLD_Builder/db.py
+++ b/PLD_Builder/db.py
@@ -1,7 +1,7 @@
# vi: ts=8 sts=4 sw=4 et
"""The src builder's own database, spool/builder.sqlite: what it keeps longer than the queue does.
- builds the builds the bin builders finished: what, where, how it ended and when it ran
+ builds the builds the builders finished: what, where, how it ended and when it ran
"""
import contextlib
diff --git a/PLD_Builder/notify.py b/PLD_Builder/notify.py
index 910519e..754bddd 100644
--- a/PLD_Builder/notify.py
+++ b/PLD_Builder/notify.py
@@ -21,7 +21,8 @@ def begin(g, now=False):
notifyq.init(g)
def progress(batch, status):
- """A status on the way to the final one; only a builder that sends each status at once reports these"""
+ """A status on the way to the final one, kept by the batch; only a builder that sends each status at once reports these"""
+ batch.set_status(config.builder, status, time.time())
if live:
add_batch(batch, status)
@@ -29,8 +30,13 @@ def add_batch(batch, status, after=()):
"""Queue the status of one batch for the src builder: sent at once, or by send()
With after, ids of files in the ftp queue, it is sent only once they are.
+ The batch keeps it too, as the src builder publishes its own statuses from there: with after
+ only once this notification gets through, it stays UPLOADING till then.
"""
- xml = (f"<notification group-id='{group.id}' builder='{config.builder}' time='{time.time()}'>\n"
+ now = time.time()
+ if not after:
+ batch.set_status(config.builder, status, now)
+ xml = (f"<notification group-id='{group.id}' builder='{config.builder}' time='{now}'>\n"
f" <batch id='{batch.b_id}' status='{status}' />\n"
"</notification>\n")
try:
diff --git a/PLD_Builder/request_handler.py b/PLD_Builder/request_handler.py
index c0250a8..3d3247b 100644
--- a/PLD_Builder/request_handler.py
+++ b/PLD_Builder/request_handler.py
@@ -137,6 +137,12 @@ def handle_group(r, user):
lockf.close()
return HTTPStatus.OK
+def remove_srpms(r):
+ """The src.rpms are there for the bin builders to fetch; those of a request for the src builder
+ alone are all it made, left for maintainer.py to expire"""
+ if any(bld != config.src_builder for b in r.batches for bld in b.builders):
+ util.clean_tmp(path.srpms_dir + '/' + r.id)
+
def handle_notification(r, user):
if not user.can_do("notify", r.builder):
# fail the request: the sender keeps retrying and mails about it
@@ -151,7 +157,7 @@ def handle_notification(r, user):
applied = q.requests
for req in not_fin:
if req.is_done():
- util.clean_tmp(path.srpms_dir + '/' + req.id)
+ remove_srpms(req)
now = time.time()
def leave_it(r):
# for ,,done'' set timeout to 4d
@@ -159,7 +165,7 @@ def handle_notification(r, user):
return False
# and for not ,,done'' set it to 20d
if r.time + 20 * 24 * 60 * 60 < now:
- util.clean_tmp(path.srpms_dir + '/' + r.id)
+ remove_srpms(r)
return False
return True
q.requests = list(filter(leave_it, q.requests))
diff --git a/PLD_Builder/srpm_builder.py b/PLD_Builder/srpm_builder.py
index 707e73f..49a5195 100644
--- a/PLD_Builder/srpm_builder.py
+++ b/PLD_Builder/srpm_builder.py
@@ -1,6 +1,7 @@
# vi: ts=8 sts=4 sw=4 et
import argparse
+import contextlib
import os
import tempfile
import time
@@ -35,12 +36,15 @@ def pick_request(q):
return ret
def store_binary_request(r):
- new_b = []
+ """Publish r with how each batch went here: one that failed or was skipped goes to no bin builder"""
for b in r.batches:
- if not b.build_failed: new_b.append(b)
- if new_b == []:
- return
- r.batches = new_b
+ if b.build_failed:
+ b.builders = [config.builder]
+ elif not b.is_command():
+ b.builders.append(config.builder)
+ # without a src.rpm (all failed, or commands only) it is of no use to anyone
+ with contextlib.suppress(OSError):
+ os.rmdir(path.srpms_dir + '/' + r.id)
# store new queue and max_req_no for binary builders
with open(path.max_req_no_file) as f:
num = int(f.read().strip()) + 1
diff --git a/client/rebuild-kernel-packages.py b/client/rebuild-kernel-packages.py
index 9236c0b..7f390e4 100755
--- a/client/rebuild-kernel-packages.py
+++ b/client/rebuild-kernel-packages.py
@@ -120,7 +120,7 @@ def fetch_package(name, spec, branch, verbose=False):
run_command(["/usr/bin/git", "-C", gitdir, "merge", "--ff-only", "@{upstream}"], verbose=verbose)
def request_published(queue_url, group_id):
- """Is group_id in the src builder's queue.gz? It gets there only once all went well."""
+ """The statuses of group_id in the src builder's queue.gz, None while it is not there yet"""
req = urllib.request.Request(queue_url, headers={"Cache-Control": "no-cache", "Pragma": "no-cache"})
with urllib.request.urlopen(req, timeout=20) as f:
text = gzip.decompress(f.read()).decode("utf-8")
@@ -128,8 +128,10 @@ def request_published(queue_url, group_id):
m = re.match(r"(<queue>.*?</queue>)", text, re.DOTALL)
if not m:
raise ValueError("no <queue> in it")
- groups = minidom.parseString(m.group(1)).getElementsByTagName("group")
- return any(g.getAttribute("id") == group_id for g in groups)
+ for g in minidom.parseString(m.group(1)).getElementsByTagName("group"):
+ if g.getAttribute("id") == group_id:
+ return [b.getAttribute("status") for b in g.getElementsByTagName("builder")]
+ return None
def wait_for_request(queue_url, group_id, timeout):
"""Return once the src builder has run group_id or Enter is pressed."""
@@ -139,7 +141,11 @@ def wait_for_request(queue_url, group_id, timeout):
stdin_open = True
while True:
try:
- if request_published(queue_url, group_id):
+ statuses = request_published(queue_url, group_id)
+ if statuses is not None:
+ if any(s.startswith("FAIL") for s in statuses):
+ print(" failed.")
+ sys.exit("The command failed on the src builder, see its log on queue.html; builds not sent.")
print(" done.")
return
print(".", end="", flush=True)
@@ -156,8 +162,8 @@ def wait_for_request(queue_url, group_id, timeout):
print("\nGoing on without waiting.")
return
stdin_open = False
- # a failed command is never published: queue.gz alone cannot tell it from a busy builder
- print(f"\nNot in the queue after {timeout}s: the command failed or the src builder is busy.")
+ # a src builder older than this script publishes no failed command
+ print(f"\nNot in the queue after {timeout}s: the src builder is busy, or the command failed.")
if not stdin_open:
sys.exit("No Enter can come from a closed stdin; builds not sent.")
input("Press Enter after src builder updates kernel packages...")
diff --git a/doc/jak-to-dziala.txt b/doc/jak-to-dziala.txt
index 9f2dfd5..2b26df1 100644
--- a/doc/jak-to-dziala.txt
+++ b/doc/jak-to-dziala.txt
@@ -28,7 +28,9 @@ srpm buildera.
c) Buduje w chroot wszystkie pakiety z grupy, kolejkując pliki w spool/ftp/
oraz spool/buildlogs/. Dodatkowo srpmy są wrzucane do www/srpms/<group-id>/
skąd ciągną je bin-buildery.
- d) jeśli nie powiodło się budowanie żadnego pakietu to wypad
+ d) pakiety, których nie udało się zbudować, oraz zależne od nich zostają
+ w zleceniu tylko ze statusem srpm buildera: bin-buildery ich nie
+ budują, a queue.html pokazuje porażkę z linkiem do logu
e) zleceniu nadawany jest numer
f) zlecenie jest wrzucane do spool/req_queue
g) kolejka jest podpisywana kluczem srpm buildera, gzipowana i wrzucana do
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/projects/pld-builder.new.git/commitdiff/037bbbdb7a6dd2a0d492f650797514fec18bc6b8
More information about the pld-cvs-commit
mailing list