[projects/pld-builder.new] rebuild-kernel-packages: don't report the branch checks as errors

arekm arekm at pld-linux.org
Sun Nov 8 00:32:58 CET 2026


commit 0fe372e62d4e92cd30ed562a93b2531e2d750ed1
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sun Nov 8 00:31:23 2026 +0100

    rebuild-kernel-packages: don't report the branch checks as errors
    
    Before checking out a kernel branch the script asks git whether it
    exists locally, then on origin. A "no" is expected the first time, yet
    it printed "Error running command". Those checks are now quiet; a branch
    missing everywhere is still reported by "cannot checkout".

 client/rebuild-kernel-packages.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/client/rebuild-kernel-packages.py b/client/rebuild-kernel-packages.py
index 2d05095..8cf027a 100755
--- a/client/rebuild-kernel-packages.py
+++ b/client/rebuild-kernel-packages.py
@@ -59,7 +59,7 @@ def clean_pkgname(package):
         branch = "master"
     return [name, spec, branch]
 
-def run_command(command, verbose=False, dry_run=False, quiet=True):
+def run_command(command, verbose=False, dry_run=False, quiet=True, probe=False):
     if verbose or dry_run:
         print(' '.join(command))
     if dry_run:
@@ -69,6 +69,9 @@ def run_command(command, verbose=False, dry_run=False, quiet=True):
     out = gitproc.communicate()[0].strip("\n'")
     if not quiet:
         print(out)
+    # a probe's failure is an answer, not an error
+    if gitproc.returncode != 0 and probe:
+        return (False, None)
     if gitproc.returncode != 0:
         if quiet:
             print(out)
@@ -105,9 +108,9 @@ def fetch_package(name, spec, branch, verbose=False):
         run_command(["/usr/bin/git", "-C", gitdir, "remote", "set-url", "--push", "origin", "ssh://git@git.pld-linux.org/packages/" + name], verbose=verbose)
     run_command(["/usr/bin/git", "-C", gitdir, "fetch", "origin", "refs/notes/*:refs/notes/*"], verbose=verbose)
     if branch:
-        if run_command(["/usr/bin/git", "-C", gitdir, "rev-parse", "--verify", "-q", branch], verbose=verbose)[0]:
+        if run_command(["/usr/bin/git", "-C", gitdir, "rev-parse", "--verify", "-q", branch], verbose=verbose, probe=True)[0]:
             run_command(["/usr/bin/git", "-C", gitdir, "checkout", branch, "--"], verbose=verbose)
-        elif run_command(["/usr/bin/git", "-C", gitdir, "rev-parse", "--verify", "-q", "refs/remotes/origin/" + branch], verbose=verbose)[0]:
+        elif run_command(["/usr/bin/git", "-C", gitdir, "rev-parse", "--verify", "-q", "refs/remotes/origin/" + branch], verbose=verbose, probe=True)[0]:
             run_command(["/usr/bin/git", "-C", gitdir, "checkout", "-t", "refs/remotes/origin/" + branch], verbose=verbose)
         rev_branch = run_command(["/usr/bin/git", "-C", gitdir, "rev-parse", branch], verbose=verbose)
         rev_head = run_command(["/usr/bin/git", "-C", gitdir, "rev-parse", "HEAD"], verbose=verbose)
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/pld-builder.new.git/commitdiff/0fe372e62d4e92cd30ed562a93b2531e2d750ed1



More information about the pld-cvs-commit mailing list