From c3b7d40df80ceec860c3c1237a2ff9f7e3a57e0e Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 28 Nov 2016 20:03:15 +0100 Subject: [PATCH] phase1: create version directories For tagged or non-master builds, emit version subdirectories for the binary artifacts and symlink the shared feed repositories to a common location. Signed-off-by: Jo-Philipp Wich --- phase1/master.cfg | 43 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/phase1/master.cfg b/phase1/master.cfg index f8b11df..e445359 100644 --- a/phase1/master.cfg +++ b/phase1/master.cfg @@ -184,6 +184,24 @@ def IsTaggingRequested(step): def IsNoTaggingRequested(step): return not IsTaggingRequested(step) +def IsNoMasterBuild(step): + return repo_branch != "master" + +def GetBaseVersion(props): + if re.match("^[^-]+-[0-9]+\.[0-9]+$", repo_branch): + return repo_branch.split('-')[1] + else: + return "master" + +def GetVersionPrefix(props): + basever = GetBaseVersion(props) + if props.hasProperty("tag") and re.match("^[0-9]+\.[0-9]+\.[0-9]+$", props["tag"]): + return "%s/" % props["tag"] + elif basever != "master": + return "%s-HEAD/" % basever + else: + return "" + c['builders'] = [] @@ -543,9 +561,24 @@ for target in targets: # upload factory.addStep(ShellCommand( - name = "uploadprepare", - description = "Preparing target directory", - command=["rsync", "-av", "--include", "/%s/" %(ts[0]), "--include", "/%s/%s/" %(ts[0], ts[1]), "--exclude", "/*", "--exclude", "/*/*", "--exclude", "/%s/%s/*" %(ts[0], ts[1]), "bin/targets/", "%s/targets/" %(rsync_bin_url)], + name = "dirprepare", + description = "Preparing upload directory structure", + command = ["mkdir", "-p", WithProperties("tmp/upload/%%(prefix)stargets/%s/%s" %(ts[0], ts[1]), prefix=GetVersionPrefix)], + haltOnFailure = True + )) + + factory.addStep(ShellCommand( + name = "linkprepare", + description = "Preparing repository symlink", + command = ["ln", "-s", "-f", WithProperties("../packages-%(basever)s", basever=GetBaseVersion), WithProperties("tmp/upload/%(prefix)spackages", prefix=GetVersionPrefix)], + doStepIf = IsNoMasterBuild, + haltOnFailure = True + )) + + factory.addStep(ShellCommand( + name = "dirupload", + description = "Uploading directory structure", + command = ["rsync", "-avz", "tmp/upload/", "%s/" %(rsync_bin_url)], env={'RSYNC_PASSWORD': rsync_bin_key}, haltOnFailure = True, logEnviron = False @@ -554,7 +587,9 @@ for target in targets: factory.addStep(ShellCommand( name = "targetupload", description = "Uploading target files", - command=["rsync", "--delete", "--checksum", "--delay-updates", "--partial-dir=.~tmp~%s~%s" %(ts[0], ts[1]), "-avz", WithProperties("bin/targets/%s/%s%%(libc)s/" %(ts[0], ts[1])), "%s/targets/%s/%s/" %(rsync_bin_url, ts[0], ts[1])], + command=["rsync", "--delete", "--checksum", "--delay-updates", "--partial-dir=.~tmp~%s~%s" %(ts[0], ts[1]), + "-avz", WithProperties("bin/targets/%s/%s%%(libc)s/" %(ts[0], ts[1])), + WithProperties("%s/%%(prefix)stargets/%s/%s/" %(rsync_bin_url, ts[0], ts[1]), prefix=GetVersionPrefix)], env={'RSYNC_PASSWORD': rsync_bin_key}, haltOnFailure = True, logEnviron = False -- 2.30.2