[buildbot] phase1: replace 'repo_branch' with 'branch' prop in factory

LEDE Commits lede-commits at lists.infradead.org
Mon May 15 08:39:13 PDT 2023


ynezz pushed a commit to buildbot.git, branch master:
https://git.openwrt.org/c95c63def4ccea90f2294f9b48453d2cb1958f34

commit c95c63def4ccea90f2294f9b48453d2cb1958f34
Author: Thibaut VARÈNE <hacks at slashdirt.org>
AuthorDate: Fri Oct 21 18:25:03 2022 +0200

    phase1: replace 'repo_branch' with 'branch' prop in factory
    
    Signed-off-by: Thibaut VARÈNE <hacks at slashdirt.org>
---
 phase1/master.cfg | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/phase1/master.cfg b/phase1/master.cfg
index 1d31b78..a1c55db 100644
--- a/phase1/master.cfg
+++ b/phase1/master.cfg
@@ -380,17 +380,18 @@ def IsTaggingRequested(step):
 		return False
 
 def IsNoMasterBuild(step):
-	return repo_branch != "master"
+	return step.getProperty("branch") != "master"
 
-def GetBaseVersion():
-	if re.match(r"^[^-]+-[0-9]+\.[0-9]+$", repo_branch):
-		return repo_branch.split('-')[1]
+def GetBaseVersion(branch):
+	if re.match(r"^[^-]+-[0-9]+\.[0-9]+$", branch):
+		return branch.split('-')[1]
 	else:
 		return "master"
 
 @properties.renderer
 def GetVersionPrefix(props):
-	basever = GetBaseVersion()
+	branch = props.getProperty("branch")
+	basever = GetBaseVersion(branch)
 	if props.hasProperty("tag") and re.match(r"^[0-9]+\.[0-9]+\.[0-9]+(?:-rc[0-9]+)?$", props["tag"]):
 		return "%s/" % props["tag"]
 	elif basever != "master":
@@ -553,7 +554,7 @@ for target in targets:
 	factory.addStep(ShellCommand(
 		name = "gitcheckout",
 		description = "Ensure that Git HEAD is sane",
-		command = "if [ -d .git ]; then git checkout -f %s && git branch --set-upstream-to origin/%s || rm -fr .git; else exit 0; fi" %(repo_branch, repo_branch),
+		command = Interpolate("if [ -d .git ]; then git checkout -f %(prop:branch)s && git branch --set-upstream-to origin/%(prop:branch)s || rm -fr .git; else exit 0; fi"),
 		haltOnFailure = True))
 
 	# check out the source
@@ -564,7 +565,7 @@ for target in targets:
 	factory.addStep(Git(
 		name = "git",
 		repourl = repo_url,
-		branch = repo_branch,
+		branch = Interpolate("%(prop:branch)s"),
 		mode = 'full',
 		method = 'fresh',
 		locks = NetLockDl,
@@ -575,7 +576,7 @@ for target in targets:
 	factory.addStep(ShellCommand(
 		name = "fetchrefs",
 		description = "Fetching Git remote refs",
-		command = ["git", "fetch", "origin", "+refs/heads/%s:refs/remotes/origin/%s" %(repo_branch, repo_branch)],
+		command = ["git", "fetch", "origin", Interpolate("+refs/heads/%(prop:branch)s:refs/remotes/origin/%(prop:branch)s")],
 		haltOnFailure = True
 	))
 
@@ -921,7 +922,7 @@ for target in targets:
 	factory.addStep(ShellCommand(
 		name = "linkprepare",
 		description = "Preparing repository symlink",
-		command = ["ln", "-s", "-f", Interpolate("../packages-%(kw:basever)s", basever=GetBaseVersion()), Interpolate("tmp/upload/%(kw:prefix)spackages", prefix=GetVersionPrefix)],
+		command = ["ln", "-s", "-f", Interpolate("../packages-%(kw:basever)s", basever=util.Transform(GetBaseVersion, Property("branch"))), Interpolate("tmp/upload/%(kw:prefix)spackages", prefix=GetVersionPrefix)],
 		doStepIf = IsNoMasterBuild,
 		haltOnFailure = True
 	))




More information about the lede-commits mailing list