phase2: use a more reliable method to find the target version
authorJo-Philipp Wich <jo@mein.io>
Thu, 20 Jun 2019 15:50:21 +0000 (17:50 +0200)
committerJo-Philipp Wich <jo@mein.io>
Thu, 20 Jun 2019 15:50:21 +0000 (17:50 +0200)
Replace the slave name based target version detection by a more reliable
approach using SDK provided version information.

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

index ec1d5407879e0bd4b8b1d51f379a7ef658ec2712..b3c1574883e2cdbe231ec840eac9afdcaad07f31 100644 (file)
@@ -192,15 +192,18 @@ from buildbot.steps.shell import ShellCommand
 from buildbot.steps.shell import SetProperty
 from buildbot.steps.transfer import FileUpload
 from buildbot.steps.transfer import FileDownload
+from buildbot.steps.transfer import StringDownload
 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 ""
+       verpat = re.compile('^([0-9]{2})\.([0-9]{2})(?:\.([0-9]+)(?:-rc([0-9]+))?|-(SNAPSHOT))$')
+       if props.hasProperty("release_version"):
+               m = verpat.match(props["release_version"])
+               if m is not None:
+                       return "-%02d.%02d" %(int(m.group(1)), int(m.group(2)))
+       return ""
 
 def GetNumJobs(props):
        if props.hasProperty("slavename") and props.hasProperty("nproc"):
@@ -297,6 +300,19 @@ for arch in arches:
                command = "rsync --checksum -av sdk_update/ sdk/ && rm -rf sdk_update",
                haltOnFailure = True))
 
+       factory.addStep(StringDownload(
+               name = "writeversionmk",
+               s = 'TOPDIR:=${CURDIR}\n\ninclude $(TOPDIR)/include/version.mk\n\nversion:\n\t@echo $(VERSION_NUMBER)\n',
+               slavedest = "sdk/getversion.mk",
+               mode = 0755))
+
+       factory.addStep(SetProperty(
+               name = "getversion",
+               property = "release_version",
+               description = "Finding SDK release version",
+               workdir = "build/sdk",
+               command = ["make", "-f", "getversion.mk"]))
+
        factory.addStep(FileDownload(mastersrc=home_dir+'/key-build', slavedest="sdk/key-build", mode=0600))
        factory.addStep(FileDownload(mastersrc=home_dir+'/key-build.pub', slavedest="sdk/key-build.pub", mode=0600))