phase1: replace 'repo_branch' with 'branch' prop in factory
authorThibaut VARÈNE <hacks@slashdirt.org>
Fri, 21 Oct 2022 16:25:03 +0000 (18:25 +0200)
committerPetr Štetiar <ynezz@true.cz>
Mon, 15 May 2023 15:36:01 +0000 (17:36 +0200)
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
phase1/master.cfg

index 1d31b780be3b704f6c4eb60b5b2b2016588abb7b..a1c55db7c2e747876d37c3cf76a839bac8af97ff 100644 (file)
@@ -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
        ))