checkout dependencies from script

The jenkins jobs used to have multiple source repositories configured, but it
is really cumbersome to add all the SCM links to a jenkins job.

Instead, clone the git sources from the script, as we also do in various other
contrib/ scripts.

This partly duplicates the osmo-ci scripts, but since this code is much more
intended to run on other peoples' jenkins instances, rather keep the osmo-ci
dependency out of here.

Change-Id: Ie05cb9cd2bd884f72cbdbcc96d9c4389ffca7357
diff --git a/contrib/jenkins-osmo-nitb.sh b/contrib/jenkins-osmo-nitb.sh
index 05d2041..61d6e2f 100755
--- a/contrib/jenkins-osmo-nitb.sh
+++ b/contrib/jenkins-osmo-nitb.sh
@@ -1,3 +1,4 @@
+#!/bin/sh
 set -e -x
 
 base="$PWD"
@@ -18,14 +19,14 @@
 have_repo() {
 	repo="$1"
 	cd "$base"
-	if [ ! -e "$repo" ]; then
-		set +x
-		echo "MISSING REPOSITORY: $repo"
-		echo "should be provided by the jenkins workspace"
-		exit 1
+	if [ ! -d "$repo" ]; then
+		git clone "git://git.osmocom.org/$repo" "$repo"
 	fi
 	cd "$repo"
 	git clean -dxf
+	git fetch origin
+	git reset --hard origin/master
+	git rev-parse HEAD
 	cd "$base"
 }