jenkins: per build, drop programs built "unintentionally"

Each of the jenkins-build-* scripts intends to build a specific set of
programs. While compiling dependencies, other programs may end up in
$prefix/bin. Drop those other binaries to reduce potential confusion.

Add arguments to the create_bin_tgz function: callers need to list exactly the
$prefix/bin/* binaries that should be tar'd. All others are first removed from
the prefix.

Adjust existing scripts to provide such binary names.

Change-Id: Ib1a00b2149453fedf9ece0460dd4d6e83f774d45
diff --git a/contrib/jenkins-build-common.sh b/contrib/jenkins-build-common.sh
index 3e30873..3d9932d 100644
--- a/contrib/jenkins-build-common.sh
+++ b/contrib/jenkins-build-common.sh
@@ -140,6 +140,22 @@
 
 create_bin_tgz() {
   # build the archive that is going to be copied to the tester
+
+  wanted_binaries="$@"
+
+  if [ -z "$wanted_binaries" ]; then
+    set +x; echo "ERROR: create_bin_tgz needs a list of permitted binaries"; set -x
+    exit 1
+  fi
+
+  # remove binaries not intended to originate from this build
+  cd "$prefix_real"/bin
+  for f in * ; do
+    if [ -z "$(echo "_ $wanted_binaries _" | grep " $f ")" ]; then
+      rm "$f"
+    fi
+  done
+
   cd "$prefix_real"
   this="$name.build-${BUILD_NUMBER-$(date +%Y-%m-%d_%H_%M_%S)}"
   tar="${this}.tgz"