Browse Source

infra/buildbot: allow bots to be picked out by installed compiler.

* master.cfg: add "compilers" function to return available compilers.
  Add "ccbots" to select the bots with given compiler tag present.

  workers: Change the compiler info lists from tuples to dicts, so
  the name can be picked out and to allow optional information.
Paul Jakma 1 year ago
parent
commit
0349ff4eb5
1 changed files with 55 additions and 41 deletions
  1. 55 41
      infra/buildbot/master/master.cfg

+ 55 - 41
infra/buildbot/master/master.cfg

@@ -25,12 +25,26 @@ def workers2publicprops (worker):
 			"latent", "env" ]
 	return  { k:worker[k] for k in worker if k in publicprops }
 
+# get compiler names
+def compilers(workers):
+	names = set ()
+	for l in [ w["cc"] for w in workers.values ()]:
+		for e in l:
+			names |= { e["n"] }
+	return names
+
+# bots with given compiler tag
+def ccbots (cc):
+	return [ workers[kw]["bot"] for kw in workers 
+			if len([c["n"] for c in workers[kw]["cc"] 
+				if c["n"] is cc]) > 0]
+
 # vm: non-VM are assumed faster and used for initial build
 # pkg: rpm, sysv, dpkg - only do test rpm builds at moment
 # texi: True or "true" if we can use for doc building
-# cc: List of tuples of installed compilers, with:
-#     (<tag>, <version>, <command>)
-#     tag: gcc, clang, sunpro
+# cc: List of dicts of installed compilers, with:
+#     { "n": <tag>, "v": <version>, "bin": <command>) }
+#     tags: gcc, clang, sunpro, tcc
 # env: JSON dictionary of environment variables to be passed to shell
 #      commands as a dictionary via json.load.
 # latent: VM spun up on demand via LatentSlave, uses "session" for
@@ -47,9 +61,9 @@ workers = {
 	  "vm": False,
 	  "pkg": "rpm",
 	  "texi": True,
-	  "cc": [ ("gcc", "6.3.1"),
-	  	  ("clang", "3.8.1"),
-	  	  ("gcc",  "3.4.6", "gcc34"),
+	  "cc": [ { "n": "gcc",   "v": "6.3.1"},
+	  	  { "n": "clang", "v": "3.8.1"},
+	  	  { "n": "gcc",   "v": "3.4.6", "bin": "gcc34"},
 	  	],
 	}, 
 	"fedora-26": { 
@@ -57,9 +71,9 @@ workers = {
 	  "version": "26",
 	  "vm": False,
 	  "pkg": "rpm",
-	  "cc": [ ("gcc", "7.0.1"),
-	  	  ("clang", "3.9.0"),
-	  	  ("gcc",  "3.4.6", "gcc34"),
+	  "cc": [ { "n": "gcc",   "v": "7.0.1" },
+	  	  { "n": "clang", "v": "3.9.0" },
+	  	  { "n": "gcc",   "v": "3.4.6", "bin": "gcc34" },
 	  	],
 	}, 
 	"centos-7": {
@@ -67,7 +81,7 @@ workers = {
 	  "version": "7",
 	  "vm": False,
 	  "pkg": "rpm",
-	  "cc": [ ("gcc", "4.8.5") ],
+	  "cc": [ { "n": "gcc", "v": "4.8.5"} ],
 	},
 	"ubuntu-16.10": {
 	  "os": "Ubuntu",
@@ -75,8 +89,8 @@ workers = {
 	  "vm": False,
 	  "pkg": "dpkg",
 	  "cc": [
-	  	("gcc", "6.2.0"),
-	  	("tcc", "0.9.26"),
+	  	{ "n": "gcc", "v": "6.2.0"},
+	  	{ "n": "tcc", "v": "0.9.26"},
 	  ],
 	},
 	"debian-8": {
@@ -85,7 +99,7 @@ workers = {
 	  "vm": True,	
   	  "pkg": "dpkg",
   	  "latent": True,
-  	  "cc": [ ("gcc", "4.9.2") ],
+  	  "cc": [ { "n": "gcc", "v": "4.9.2"} ],
   	  "hd_image": "/var/lib/libvirt/images/debian8.qcow2",
   	},
   	"debian-9": { 
@@ -93,7 +107,7 @@ workers = {
 	  "version": "9",
 	  "vm": True,	
   	  "pkg": "dpkg",
-  	  "cc": [ ("gcc", "6.3.0") ],
+  	  "cc": [ { "n": "gcc", "v": "6.3.0"} ],
   	  "latent": True,
   	  "hd_image": "/var/lib/libvirt/images/debian9.qcow2",
   	},
@@ -103,7 +117,7 @@ workers = {
 	  "vm": True,	
   	  "pkg": "",
   	  "latent": True,
-  	  "cc": [ ("clang", "3.4.1") ],
+  	  "cc": [ { "n": "clang", "v": "3.4.1"} ],
   	  "hd_image": "/var/lib/libvirt/images/freebsd103.qcow2",
   	}, 
   	"freebsd-11": { 
@@ -111,7 +125,9 @@ workers = {
 	  "version": "11",
 	  "vm": True,	
   	  "pkg": "",
-  	  "cc": [ ("gcc", "4.9.4"), ("clang", "3.8.0"), ],
+  	  "cc": [ {"n": "gcc",    "v": "4.9.4"},
+  	  	  { "n": "clang", "v": "3.8.0"},
+  	  ],
   	  "latent": True,
   	  "hd_image": "/var/lib/libvirt/images/freebsd110.qcow2",
   	},
@@ -120,7 +136,7 @@ workers = {
 	  "version": "6.0",
 	  "vm": True,	
   	  "pkg": "",
-  	  "cc": [ ("gcc", "4.2.1") ],
+  	  "cc": [ { "n": "gcc", "v": "4.2.1"} ],
   	  "latent": True,
   	  "hd_image": "/var/lib/libvirt/images/openbsd-6.qcow2",
 	  "env": ' { "AUTOMAKE_VERSION": "1.15", "AUTOCONF_VERSION": "2.69" } ',
@@ -131,39 +147,39 @@ workers = {
   	  "vm": True,
   	  "pkg": "sysv",
 	  "latent": True,
-	  "cc": [ ("gcc", "6.3.0"), ("sunpro", "12.0"), 
-	  	  ("gcc", "4.4.4") 
+	  "cc": [ { "n": "gcc",    "v": "6.3.0"},
+	  	  { "n": "sunpro", "v": "12.0" }, 
+	  	  { "n": "gcc",    "v": "4.4.4"}
 	  	],
 	  "hd_image": "/var/lib/libvirt/images/buildbot-oi-hipster.qcow2",
   	},
 }
 
-# ensure "latent" is set to false, where not set.
-# add in the passwords
-for kw in workers:
-	w = workers[kw]
-	w["bot"] = "buildbot-" + kw
-	if "latent" not in w:
-		w["latent"] = False
-	w["pass"] = workers_pass[kw]
+# workers config preparation:
+# - add defaults for important fields not set
+# - add passwords
+def workers_prep (workers):
+	for kw in workers:
+		w = workers[kw]
+		w["bot"] = "buildbot-" + kw
+		# 'latent' must be set.
+		if "latent" not in w:
+			w["latent"] = False
+		# set default libvirt session for latent bots
+		if w["latent"] and ("session" not in w):
+			w["session"] = 'qemu+ssh://buildbot@sagan.jakma.org/system'
+		w["pass"] = workers_pass[kw]
+
+workers_prep (workers)
 
 analyses_builders = [ "clang-analyzer" ]
 
-# default Libvirt session
-for w in (w for w in workers.values () if ("latent" in w and w["latent"])
-					and ("session" not in w)):
-	w["session"] = 'qemu+ssh://buildbot@sagan.jakma.org/system'
-
 osbuilders = ["build-" + kw for kw in workers]
 osfastbuilders = ["build-" + kw for kw in workers if workers[kw]["vm"] == False]
 osslowbuilders = ["build-" + kw for kw in workers if workers[kw]["vm"] == True]
 
 rpmbuilders = ["rpm-" + kw for kw in workers if workers[kw]["pkg"] == "rpm"]
 
-# compilers
-# not using yet
-# [kw for kw in workers if len([v for (c,v) in workers[kw]["cc"] if c == "gcc"]) > 0 ]
-
 allbuilders =  []
 allbuilders += osbuilders
 allbuilders += rpmbuilders
@@ -182,6 +198,7 @@ c['slaves'] = []
 # a BuildSlave object, specifying a unique slave name and password.  The same
 # slave name and password must be configured on the slave.
 
+
 for w in (w for w in workers.values() if ("latent" not in w)
 				      or (w["latent"] == False)):
 	c['slaves'].append(buildslave.BuildSlave(w["bot"], w["pass"],
@@ -415,12 +432,9 @@ f.addStep(steps.RemoveDirectory(
 
 c['builders'].append(
     util.BuilderConfig(name="clang-analyzer",
-      slavenames=list(w["bot"] for w in workers.values() if not w["vm"]
-			),
-      factory=f))
+	slavenames=ccbots ("clang"),
+        factory=f))
 
-#[kw["bot"] for kw in workers if 
-		len([v for (c,v) in workers[kw]["cc"] if c == "gcc"]) > 0 ]
 ### RPM: check and build
 f = util.BuildFactory ()