From: Jo-Philipp Wich Date: Mon, 28 Nov 2016 19:06:26 +0000 (+0100) Subject: phase2: add base version suffix to directory for non-master builds X-Git-Tag: v1~212 X-Git-Url: http://git.openwrt.org/?p=buildbot.git;a=commitdiff_plain;h=61e1ae0e032515af65d26b3ccd16f0adae3a762a phase2: add base version suffix to directory for non-master builds Also support persistent operation where previous build artifacts are not cleared out. Signed-off-by: Jo-Philipp Wich --- diff --git a/phase2/config.ini.example b/phase2/config.ini.example index dae0673..5c7437e 100644 --- a/phase2/config.ini.example +++ b/phase2/config.ini.example @@ -4,6 +4,7 @@ title_url = http://lede-project.org/ buildbot_url = http://phase2.builds.lede-project.org/ homedir = ../phase1 port = 9990 +persistent = false [status] bind = tcp:8011:interface=127.0.0.1 diff --git a/phase2/master.cfg b/phase2/master.cfg index eb88909..ddcca29 100644 --- a/phase2/master.cfg +++ b/phase2/master.cfg @@ -28,10 +28,14 @@ c = BuildmasterConfig = {} from buildbot.buildslave import BuildSlave slave_port = 9990 +persistent = False if ini.has_option("general", "port"): slave_port = ini.getint("general", "port") +if ini.has_option("general", "persistent"): + persistent = ini.getboolean("general", "persistent") + c['slaves'] = [] for section in ini.sections(): @@ -163,6 +167,14 @@ from buildbot.steps.transfer import FileDownload from buildbot.steps.master import MasterShellCommand from buildbot.process.properties import WithProperties + +def GetDirectorySuffix(props): + if props.hasProperty("slavename") and re.match("^[^-]+-[0-9]+\.[0-9]+-[^-]+$", props["slavename"]): + return "-%s" % props["slavename"].split('-')[1] + else: + return "" + + c['builders'] = [] dlLock = locks.SlaveLock("slave_dl") @@ -187,24 +199,25 @@ for arch in arches: # prepare workspace factory.addStep(FileDownload(mastersrc="cleanup.sh", slavedest="cleanup.sh", mode=0755)) - factory.addStep(ShellCommand( - name = "cleanold", - description = "Cleaning previous builds", - command = ["./cleanup.sh", buildbot_url, WithProperties("%(slavename)s"), WithProperties("%(buildername)s"), "full"], - haltOnFailure = True, - timeout = 2400)) + if not persistent: + factory.addStep(ShellCommand( + name = "cleanold", + description = "Cleaning previous builds", + command = ["./cleanup.sh", buildbot_url, WithProperties("%(slavename)s"), WithProperties("%(buildername)s"), "full"], + haltOnFailure = True, + timeout = 2400)) - factory.addStep(ShellCommand( - name = "cleanup", - description = "Cleaning work area", - command = ["./cleanup.sh", buildbot_url, WithProperties("%(slavename)s"), WithProperties("%(buildername)s"), "single"], - haltOnFailure = True, - timeout = 2400)) + factory.addStep(ShellCommand( + name = "cleanup", + description = "Cleaning work area", + command = ["./cleanup.sh", buildbot_url, WithProperties("%(slavename)s"), WithProperties("%(buildername)s"), "single"], + haltOnFailure = True, + timeout = 2400)) factory.addStep(ShellCommand( name = "mksdkdir", description = "Preparing SDK directory", - command = ["mkdir", "sdk"], + command = ["mkdir", "-p", "sdk"], haltOnFailure = True)) factory.addStep(ShellCommand( @@ -301,7 +314,7 @@ for arch in arches: name = "uploadprepare", description = "Preparing package directory", workdir = "build/sdk", - command = ["rsync", "-av", "--include", "/%s/" %(arch[0]), "--exclude", "/*", "--exclude", "/%s/*" %(arch[0]), "bin/packages/", "%s/packages/" %(rsync_bin_url)], + command = ["rsync", "-av", "--include", "/%s/" %(arch[0]), "--exclude", "/*", "--exclude", "/%s/*" %(arch[0]), "bin/packages/", WithProperties("%s/packages%%(suffix)s/" %(rsync_bin_url), suffix=GetDirectorySuffix)], env={'RSYNC_PASSWORD': rsync_bin_key}, haltOnFailure = True, logEnviron = False @@ -311,7 +324,7 @@ for arch in arches: name = "packageupload", description = "Uploading package files", workdir = "build/sdk", - command = ["rsync", "--delete", "--checksum", "--delay-updates", "--partial-dir=.~tmp~%s" %(arch[0]), "-avz", "bin/packages/%s/" %(arch[0]), "%s/packages/%s/" %(rsync_bin_url, arch[0])], + command = ["rsync", "--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)], env={'RSYNC_PASSWORD': rsync_bin_key}, haltOnFailure = True, logEnviron = False