From bdc7f971e9060814e2bc8351fbe7d0ee47bef5b1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= <hacks@slashdirt.org>
Date: Tue, 16 May 2023 10:13:11 +0200
Subject: [PATCH] phase1: perform kmodupload only when needed
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fixes: 909e899

Signed-off-by: Thibaut VARĂˆNE <hacks@slashdirt.org>
---
 phase1/master.cfg | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/phase1/master.cfg b/phase1/master.cfg
index 7c04fa6..1113583 100644
--- a/phase1/master.cfg
+++ b/phase1/master.cfg
@@ -506,6 +506,10 @@ def IsKmodArchiveEnabled(step):
 	branch = step.getProperty("branch")
 	return branch and branches[branch].get("kmod_archive")
 
+def IsKmodArchiveAndRsyncEnabled(step):
+	branch = step.getProperty("branch")
+	return bool(IsKmodArchiveEnabled(step) and branches[branch].get("bin_url"))
+
 def GetBaseVersion(branch):
 	if re.match(r"^[^-]+-[0-9]+\.[0-9]+$", branch):
 		return branch.split('-')[1]
@@ -1208,7 +1212,7 @@ for target in targets:
 		haltOnFailure = True,
 		logEnviron = False,
 		locks = NetLockUl,
-		doStepIf = util.Transform(lambda a, b: bool(a and b), IsKmodArchiveEnabled, GetRsyncParams.withArgs("bin", "url")),
+		doStepIf = IsKmodArchiveAndRsyncEnabled,
 	))
 
 	factory.addStep(ShellCommand(
-- 
2.30.2