[buildbot] phase1: create version directories

LEDE Commits lede-commits at lists.infradead.org
Mon Nov 28 11:26:02 PST 2016


jow pushed a commit to buildbot.git, branch master:
https://git.lede-project.org/c3b7d40df80ceec860c3c1237a2ff9f7e3a57e0e

commit c3b7d40df80ceec860c3c1237a2ff9f7e3a57e0e
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Mon Nov 28 20:03:15 2016 +0100

    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 <jo at mein.io>
---
 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



More information about the lede-commits mailing list