[projects/pld-builder.new] srpm_builder: save a request's number before queueing it

arekm arekm at pld-linux.org
Thu Nov 12 10:38:46 CET 2026


commit 622781c4cf2e1a884a3fc1e3303be2870ef98ce9
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Thu Nov 12 10:37:45 2026 +0100

    srpm_builder: save a request's number before queueing it
    
    The number was saved only after the request was in req_queue, so when
    writing the queue failed, every following request got the same number
    until one went through. Bin builders take each number once, so all but
    the first of them were never built. A failure now leaves a gap in the
    numbers instead.

 PLD_Builder/srpm_builder.py | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)
---
diff --git a/PLD_Builder/srpm_builder.py b/PLD_Builder/srpm_builder.py
index 6b69487..a707bd5 100644
--- a/PLD_Builder/srpm_builder.py
+++ b/PLD_Builder/srpm_builder.py
@@ -44,19 +44,8 @@ def store_binary_request(r):
     # 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
-
-    r.no = num
-    q = B_Queue(path.req_queue_file)
-    q.lock(0)
-    q.read()
-    q.add(r)
-    q.write()
-    q.dump(path.queue_stats_file)
-    q.dump_html(path.queue_html_stats_file)
-
-    # bump the counter before signing: if gpg fails, the request waits in
-    # req_queue for the next signed queue.gz instead of the next request
-    # reusing its number
+    # saved first: should anything below fail, the next request must not get
+    # this number again, as bin builders take each number only once
     (fdno, tmpfname) = tempfile.mkstemp(dir=os.path.dirname(path.max_req_no_file))
     cnt_f = os.fdopen(fdno, "w")
     cnt_f.seek(0)
@@ -67,6 +56,15 @@ def store_binary_request(r):
     os.chmod(tmpfname, 0o0644)
     os.rename(tmpfname, path.max_req_no_file)
 
+    r.no = num
+    q = B_Queue(path.req_queue_file)
+    q.lock(0)
+    q.read()
+    q.add(r)
+    q.write()
+    q.dump(path.queue_stats_file)
+    q.dump_html(path.queue_html_stats_file)
+
     q.write_signed(path.req_queue_signed_file)
     q.unlock()
 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/pld-builder.new.git/commitdiff/622781c4cf2e1a884a3fc1e3303be2870ef98ce9



More information about the pld-cvs-commit mailing list