[projects/pld-builder.new] rebuild-kernel-packages: check whether the branch exists before checking it out

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


commit 998bf01c4058a2ce07ee1e2a1dd79c4d6e472295
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sat Nov 7 23:06:00 2026 +0100

    rebuild-kernel-packages: check whether the branch exists before checking it out
    
    The local branch test was always true, as run_command() returns a tuple,
    so a kernel's LINUX_x_y branch, present only on origin, was checked out
    only thanks to git's checkout.guess. With it off no tag was found.

 client/rebuild-kernel-packages.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/client/rebuild-kernel-packages.py b/client/rebuild-kernel-packages.py
index 6e229aa..06d9a75 100755
--- a/client/rebuild-kernel-packages.py
+++ b/client/rebuild-kernel-packages.py
@@ -94,9 +94,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):
+        if run_command(["/usr/bin/git", "-C", gitdir, "rev-parse", "--verify", "-q", branch], verbose=verbose)[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):
+        elif run_command(["/usr/bin/git", "-C", gitdir, "rev-parse", "--verify", "-q", "refs/remotes/origin/" + branch], verbose=verbose)[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