phase2: add base version suffix to directory for non-master builds
authorJo-Philipp Wich <jo@mein.io>
Mon, 28 Nov 2016 19:06:26 +0000 (20:06 +0100)
committerJo-Philipp Wich <jo@mein.io>
Mon, 28 Nov 2016 19:07:42 +0000 (20:07 +0100)
Also support persistent operation where previous build artifacts are not
cleared out.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
phase2/config.ini.example
phase2/master.cfg

index dae0673bb79d267e73c63588363ed750bf8efeb6..5c7437e54c6eee54d9be81b03ffc9c37b581b1fe 100644 (file)
@@ -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
index eb88909e75231538911ec35864198348223c45ac..ddcca29b123b6fab28a205edfa85e2b6b5b835f2 100644 (file)
@@ -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