From 54dc448ab2a3e6845bd12e282ec429b400cb4965 Mon Sep 17 00:00:00 2001
From: Anders Roxell <anders.roxell@linaro.org>
Date: Tue, 9 Dec 2025 11:41:32 +0100
Subject: [PATCH 7/8] kbuild: Skip tarball download when value is "none"

When testing with a local kernel tree, the tarball is set to "none".
Skip the wget/tar download steps in this case and add a comment
indicating the existing kernel tree is being used.

Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
 kernelci/kbuild.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/kernelci/kbuild.py b/kernelci/kbuild.py
index d79201afad16..a7bb0abf9737 100644
--- a/kernelci/kbuild.py
+++ b/kernelci/kbuild.py
@@ -358,11 +358,14 @@ class KBuild():
             self._artifacts.append("build_dtbs_check.log")
             self._artifacts.append("build_dtbs_check_stderr.log")
         self._artifacts.append("metadata.json")
-        # download tarball
-        self.addcomment("Download tarball")
-        self.addcmd("cd " + self._workspace)
-        self.addcmd("wget -c -t 10 --retry-on-host-error \"" + self._srctarball + "\" -O linux.tgz")
-        self.addcmd("tar -xzf linux.tgz -C " + self._srcdir + " --strip-components=1")
+        # download tarball (skip if kernel tree already exists or tarball is "none")
+        if self._srctarball != "none":
+            self.addcomment("Download tarball")
+            self.addcmd("cd " + self._workspace)
+            self.addcmd("wget -c -t 10 --retry-on-host-error \"" + self._srctarball + "\" -O linux.tgz")
+            self.addcmd("tar -xzf linux.tgz -C " + self._srcdir + " --strip-components=1")
+        else:
+            self.addcomment("Using existing kernel tree (no tarball download)")
 
     def addspacer(self):
         """ Add empty line, mostly for easier reading """
-- 
2.51.0

