infra/buildbot: Add initial RPM check builders

* master.cfg: Add an initial RPM rpm check builders, to run rpmlint and
  rpmbuild tests on builders with "pkg" == "rpm".
  some issues in buildbot (least on F24):
  - RpmLint doesn't get imported, have to run manually.
  - RpmBuild always sets 'dist', it shouldn't really. urg.
  - RpmBuild 'rpmdir' argument doesn't get Interpolated, so can't
    put the built RPMs cleanly into a distinct directory.

  When fixed, can auto-publish RPMs. For now, just check.
diff --git a/infra/buildbot/master/master.cfg b/infra/buildbot/master/master.cfg
index 2561234..3bb2711 100644
--- a/infra/buildbot/master/master.cfg
+++ b/infra/buildbot/master/master.cfg
@@ -79,10 +79,11 @@
 					and ("session" not in w)):
 	w["session"] = 'qemu+ssh://buildbot@sagan.jakma.org/system'
 
-osbuilders = list("build-" + kw for kw in workers)
+osbuilders = ["build-" + kw for kw in workers]
 
 allbuilders =  []
 allbuilders += osbuilders
+allbuilders += ["rpm-" + kw for kw in workers if workers[kw]["pkg"] == "rpm"]
 allbuilders += analyses_builders
 allbuilders += ["commit-builder"]
 allbuilders += ["build-distcheck"]
@@ -177,6 +178,12 @@
 c['schedulers'].append(schedulers.Triggerable(
 		       name="trigger-distcheck",	
 		       builderNames=["build-distcheck"]))
+# RPM check and build
+c['schedulers'].append(schedulers.Triggerable(
+		       name="trigger-rpm",	
+		       builderNames=["rpm-" + kw
+				      for kw in workers 
+				      if workers[kw]["pkg"] == "rpm"]))
 
 # Try and force schedulers
 c['schedulers'].append(schedulers.ForceScheduler(
@@ -185,8 +192,9 @@
 
 c['schedulers'].append(schedulers.Try_Userpass(
 		       name="try",
-		       builderNames=list("build-" + kw 
-					   for w in workers)
+		       builderNames=["build-" + kw for kw in workers]
+		       		    + ["rpm-" + kw for kw in workers
+		       		    	if workers[kw]["pkg"] == "rpm"]
 				     + ["build-distcheck", 
 					 "clang-analyzer" ],
 			userpass=users,
@@ -207,62 +215,64 @@
 steps.Compile(),
 ]
 
-### Each OS specific builder
+### Default 'check' build, builder instantiated for each OS
 
 factory = util.BuildFactory()
 # check out the source
 factory.addStep(steps.Git(repourl=quaggagit, mode='incremental'))
 factory.addStep(steps.ShellCommand(command=["./update-autotools"],
 				   description="generating autoconf",
-				   descriptionDone="autoconf generated"))
+				   descriptionDone="autoconf"))
 factory.addStep(steps.Configure())
 factory.addStep(steps.ShellCommand(command=["make", "clean"],
 				   description="cleaning",
-				   descriptionDone="cleaned"))
+				   descriptionDone="clean"))
 factory.addStep(steps.Compile(command=["make", "-j", "2", "all"]))
 factory.addStep(steps.ShellCommand(command=["make", "check"],
-				   description="testing",
-				   descriptionDone="tests"))
+				   description="checking",
+				   descriptionDone="make check"))
 
+# create builder for every OS, for every buildbot
+# XXX: at moment this assumes 1:1 OS<->bot
 for kw in workers:
    c['builders'].append(util.BuilderConfig(
 	name="build-" + kw,
 	slavenames=workers[kw]["bot"],
 	factory=factory))
 
-### distcheck
+### distcheck Builder, executed on any available bot
 factory = util.BuildFactory()
 # check out the source
 factory.addStep(steps.Git(repourl=quaggagit, mode='incremental'))
 factory.addStep(steps.ShellCommand(command=["./update-autotools"],
 				   description="generating autoconf",
-				   descriptionDone="autoconf generated"))
+				   descriptionDone="autoconf"))
 factory.addStep(steps.Configure())
 factory.addStep(steps.ShellCommand(command=["make", "clean"],
 				   description="cleaning",
-				   descriptionDone="cleaned"))
+				   descriptionDone="make clean"))
 factory.addStep(steps.ShellCommand(command=["make", "distcheck"],
-				   description="distcheck",
-				   descriptionDone="distcheck passes"))
+				   description="run make distcheck",
+				   descriptionDone="make distcheck"))
 c['builders'].append(
 	util.BuilderConfig(name="build-distcheck",
 	slavenames=list(w["bot"] for w in workers.values()),
 	factory=factory,
 ))
 
-### LLVM clang-analyzer build
+### LLVM clang-analyzer build, executed on any available non-VM bot
 
 f = util.BuildFactory()
 # check out the source
 f.addStep(steps.Git(repourl=quaggagit, mode='incremental',
 		    getDescription=True))
 f.addStep(steps.ShellCommand(command=["./update-autotools"],
-			     description="autotools",
-			     descriptionDone="autoconf generated"))
+			     description="run autotools",
+			     descriptionDone="autoconf"))
 f.addStep(steps.Configure())
 f.addStep(steps.ShellCommand(command=["make", "clean"],
 			     description="cleaning",
-			     descriptionDone="cleaned"))
+			     descriptionDone="make clean"))
 
 f.addStep(steps.SetProperty(property="clang-id",
 	value=util.Interpolate("%(prop:commit-description)s-%(prop:buildnumber)s")))
@@ -291,31 +301,77 @@
 	dir=util.Interpolate("%(prop:clang-output-dir)s")
 ))
 
+
 c['builders'].append(
     util.BuilderConfig(name="clang-analyzer",
       slavenames=list(w["bot"] for w in workers.values() if not w["vm"]),
       factory=f))
 
-## Co-ordination builds used to sequence parallel builds via Triggerable
+
+### RPM: check and build
+f = util.BuildFactory ()
+
+# check out the source
+f.addStep(steps.Git(repourl=quaggagit, mode='full'))
+f.addStep(steps.ShellCommand(command=["./update-autotools"],
+				   description="run autotools",
+				   descriptionDone="autotools"))
+f.addStep(steps.Configure())
+f.addStep(steps.ShellCommand(command=["make", "dist"],
+				     description="run make dist",
+				     descriptionDone="make dist"))
+# not imported somehow
+#f.addStep(steps.RpmLint(fileloc="redhat/quagga.spec"))
+f.addStep(steps.ShellCommand(command=["rpmlint", "-i", "redhat/quagga.spec"],
+				description="run rpmlint",
+				descriptionDone="rpmlint"))
+f.addStep(steps.RpmBuild(specfile="redhat/quagga.spec"))
+#			 rpmdir=util.Interpolate("%(prop:builddir)s/rpm")))
+
+# XXX: assuming 1:1 OS:buildbot mapping
+for kw in (kw for kw in workers if workers[kw]["pkg"] == "rpm"):
+	c['builders'].append(
+    		util.BuilderConfig(name="rpm-" + kw,
+      				   slavenames="buildbot-" + kw,
+      				   factory=f
+      		)
+      	)
+
+### Co-ordination builds used to sequence parallel builds via Triggerable
+
+# to understand this you have to read this list and the Triggered schedulers
+# to see what sets of builds are being sequenced. Bit clunky, but Buildbot
+# doesn't have a way to just specify a pipeline of groups of builders more
+# cleanly.
+
 f = util.BuildFactory()
 f.addStep(steps.Trigger (
 	schedulerNames = [ "trigger-build-first" ],
-	waitForFinish=True
+	waitForFinish=True,
+	updateSourceStamp=True
 ))
 f.addStep(steps.Trigger (
 	schedulerNames = [ "trigger-build-rest" ],
-	waitForFinish=True
+	waitForFinish=True,
+	updateSourceStamp=True
 ))
 f.addStep(steps.Trigger (
 	schedulerNames = [ "trigger-build-analyses", "trigger-distcheck" ],
-	waitForFinish=True
+	waitForFinish=True,
+	updateSourceStamp=True
+))
+f.addStep(steps.Trigger (
+	schedulerNames = [ "trigger-rpm" ],
+	waitForFinish=True,
+	updateSourceStamp=True
 ))
 
 c['builders'].append(
     util.BuilderConfig(name="commit-builder",
-      slavenames=["buildbot-fedora-24"],
-      factory=f
-))
+      slavenames=[w["bot"] for w in workers.values() if not w["vm"]],
+      factory=f)
+)
+
 
 ####### STATUS TARGETS