From 4c4ad710bfc82dcf0854507c3cf77612028aefdb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thibaut=20VAR=C3=88NE?= Date: Sat, 11 Nov 2023 17:26:41 +0100 Subject: [PATCH] phase2: use Interpolate instead of WithProperties MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Align with phase1 (d1a92ba) Signed-off-by: Thibaut VARÈNE --- phase2/master.cfg | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/phase2/master.cfg b/phase2/master.cfg index 9a0211f..b0aacc5 100644 --- a/phase2/master.cfg +++ b/phase2/master.cfg @@ -25,7 +25,8 @@ from buildbot.plugins import util from buildbot.process import results from buildbot.process.factory import BuildFactory from buildbot.process.properties import Property -from buildbot.process.properties import WithProperties +from buildbot.process.properties import Interpolate +from buildbot.process import properties from buildbot.schedulers.basic import SingleBranchScheduler from buildbot.schedulers.forcesched import ForceScheduler from buildbot.steps.master import MasterShellCommand @@ -279,6 +280,7 @@ c['schedulers'].append(ForceScheduler( # what steps, and which workers can execute them. Note that any particular build will # only take place on one worker. +@properties.renderer def GetDirectorySuffix(props): verpat = re.compile(r'^([0-9]{2})\.([0-9]{2})(?:\.([0-9]+)(?:-rc([0-9]+))?|-(SNAPSHOT))$') if props.hasProperty("release_version"): @@ -287,12 +289,14 @@ def GetDirectorySuffix(props): return "-%02d.%02d" %(int(m.group(1)), int(m.group(2))) return "" +@properties.renderer def GetNumJobs(props): if props.hasProperty("workername") and props.hasProperty("nproc"): - return (int(props["nproc"]) / max_builds[props["workername"]]) + return str(int(props["nproc"]) / max_builds[props["workername"]]) else: - return 1 + return "1" +@properties.renderer def GetCwd(props): if props.hasProperty("builddir"): return props["builddir"] @@ -451,7 +455,7 @@ for arch in arches: factory.addStep(ShellCommand( name = "cleanold", description = "Cleaning previous builds", - command = ["./cleanup.sh", buildbot_url, WithProperties("%(workername)s"), WithProperties("%(buildername)s"), "full"], + command = ["./cleanup.sh", buildbot_url, Interpolate("%(prop:workername)s"), Interpolate("%(prop:buildername)s"), "full"], workdir = ".", haltOnFailure = True, timeout = 2400)) @@ -459,7 +463,7 @@ for arch in arches: factory.addStep(ShellCommand( name = "cleanup", description = "Cleaning work area", - command = ["./cleanup.sh", buildbot_url, WithProperties("%(workername)s"), WithProperties("%(buildername)s"), "single"], + command = ["./cleanup.sh", buildbot_url, Interpolate("%(prop:workername)s"), Interpolate("%(prop:buildername)s"), "single"], workdir = ".", haltOnFailure = True, timeout = 2400)) @@ -594,7 +598,7 @@ for arch in arches: description = "Updating feeds", workdir = "build/sdk", command = ["./scripts/feeds", "update", "-f"], - env = {'GIT_SSH_COMMAND': WithProperties("ssh -o IdentitiesOnly=yes -o IdentityFile=%(cwd)s/git-clone.key -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no", cwd=GetCwd)} if git_ssh else {}, + env = {'GIT_SSH_COMMAND': Interpolate("ssh -o IdentitiesOnly=yes -o IdentityFile=%(kw:cwd)s/git-clone.key -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no", cwd=GetCwd)} if git_ssh else {}, haltOnFailure = True)) if git_ssh: @@ -627,8 +631,8 @@ for arch in arches: description = "Building packages", workdir = "build/sdk", timeout = 3600, - command = ["make", WithProperties("-j%(jobs)d", jobs=GetNumJobs), "IGNORE_ERRORS=n m y", "BUILD_LOG=1", "CONFIG_AUTOREMOVE=y", "CONFIG_SIGNED_PACKAGES="], - env = {'CCACHE_BASEDIR': WithProperties("%(cwd)s", cwd=GetCwd)}, + command = ["make", Interpolate("-j%(kw:jobs)s", jobs=GetNumJobs), "IGNORE_ERRORS=n m y", "BUILD_LOG=1", "CONFIG_AUTOREMOVE=y", "CONFIG_SIGNED_PACKAGES="], + env = {'CCACHE_BASEDIR': Interpolate("%(kw:cwd)s", cwd=GetCwd)}, haltOnFailure = True)) factory.addStep(ShellCommand( @@ -685,7 +689,7 @@ for arch in arches: name = "uploadprepare", description = "Preparing package directory", workdir = "build/sdk", - command = ["rsync", "-4", "-av", "--include", "/%s/" %(arch[0]), "--exclude", "/*", "--exclude", "/%s/*" %(arch[0]), "bin/packages/", WithProperties("%s/packages%%(suffix)s/" %(rsync_bin_url), suffix=GetDirectorySuffix)], + command = ["rsync", "-4", "-av", "--include", "/%s/" %(arch[0]), "--exclude", "/*", "--exclude", "/%s/*" %(arch[0]), "bin/packages/", Interpolate("%(kw:rsyncbinurl)s/packages%(kw:suffix)s/", rsyncbinurl=rsync_bin_url, suffix=GetDirectorySuffix)], env={'RSYNC_PASSWORD': rsync_bin_key}, haltOnFailure = True, logEnviron = False @@ -695,7 +699,7 @@ for arch in arches: name = "packageupload", description = "Uploading package files", workdir = "build/sdk", - command = ["rsync", "-4", "--progress", "--delete", "--checksum", "--delay-updates", "--partial-dir=.~tmp~%s" %(arch[0]), "-avz", "bin/packages/%s/" %(arch[0]), WithProperties("%s/packages%%(suffix)s/%s/" %(rsync_bin_url, arch[0]), suffix=GetDirectorySuffix)], + command = ["rsync", "-4", "--progress", "--delete", "--checksum", "--delay-updates", "--partial-dir=.~tmp~%s" %(arch[0]), "-avz", "bin/packages/%s/" %(arch[0]), Interpolate("%(kw:rsyncbinurl)s/packages%(kw:suffix)s/%(kw:archname)s/", rsyncbinurl=rsync_bin_url, suffix=GetDirectorySuffix, archname=arch[0])], env={'RSYNC_PASSWORD': rsync_bin_key}, haltOnFailure = True, logEnviron = False @@ -705,7 +709,7 @@ for arch in arches: name = "logprepare", description = "Preparing log directory", workdir = "build/sdk", - command = ["rsync", "-4", "-av", "--include", "/%s/" %(arch[0]), "--exclude", "/*", "--exclude", "/%s/*" %(arch[0]), "bin/packages/", WithProperties("%s/faillogs%%(suffix)s/" %(rsync_bin_url), suffix=GetDirectorySuffix)], + command = ["rsync", "-4", "-av", "--include", "/%s/" %(arch[0]), "--exclude", "/*", "--exclude", "/%s/*" %(arch[0]), "bin/packages/", Interpolate("%(kw:rsyncbinurl)s/faillogs%(kw:suffix)s/", rsyncbinurl=rsync_bin_url, suffix=GetDirectorySuffix)], env={'RSYNC_PASSWORD': rsync_bin_key}, haltOnFailure = True, logEnviron = False @@ -735,7 +739,7 @@ for arch in arches: name = "logupload", description = "Uploading failure logs", workdir = "build/sdk", - command = ["rsync", "-4", "--progress", "--delete", "--delay-updates", "--partial-dir=.~tmp~%s" %(arch[0]), "-avz", "faillogs/", WithProperties("%s/faillogs%%(suffix)s/%s/" %(rsync_bin_url, arch[0]), suffix=GetDirectorySuffix)], + command = ["rsync", "-4", "--progress", "--delete", "--delay-updates", "--partial-dir=.~tmp~%s" %(arch[0]), "-avz", "faillogs/", Interpolate("%(kw:rsyncbinurl)s/faillogs%(kw:suffix)s/%(kw:archname)s/", rsyncbinurl=rsync_bin_url, suffix=GetDirectorySuffix, archname=arch[0])], env={'RSYNC_PASSWORD': rsync_bin_key}, haltOnFailure = False, flunkOnFailure = False, @@ -757,7 +761,7 @@ for arch in arches: description = "Uploading source archives", workdir = "build/sdk", command = ["rsync", "--files-from=sourcelist", "-4", "--progress", "--checksum", "--delay-updates", - WithProperties("--partial-dir=.~tmp~%s~%%(workername)s" %(arch[0])), "-avz", "dl/", "%s/" %(rsync_src_url)], + Interpolate("--partial-dir=.~tmp~%(kw:archname)s~%(prop:workername)s", archname=arch[0]), "-avz", "dl/", "%s/" %(rsync_src_url)], env={'RSYNC_PASSWORD': rsync_src_key}, haltOnFailure = False, flunkOnFailure = False, -- 2.30.2