contrib: common: create_bin_tgz supports sbin dir now
This is a preparation for inclusion of osmocom-bb build job, which
installs binaries such as osmocon in sbin.
Change-Id: I562721af82e481e926ee65dbcd9dcc5b55057ae8
diff --git a/contrib/jenkins-build-common.sh b/contrib/jenkins-build-common.sh
index 9d85622..b8cafcf 100644
--- a/contrib/jenkins-build-common.sh
+++ b/contrib/jenkins-build-common.sh
@@ -139,32 +139,42 @@
make install
}
+prune_files() {
+ bindir="$1"
+ wanted_binaries="$2"
+
+ if [ ! -d "$prefix_real/$bindir" ]; then return; fi
+ # remove binaries not intended to originate from this build
+ cd "$prefix_real/$bindir"
+ for f in * ; do
+ if [ -z "$(echo "_ $wanted_binaries _" | grep " $f ")" ]; then
+ rm "$f"
+ fi
+ done
+
+ # ensure requested binaries indeed exist
+ for b in $wanted_binaries ; do
+ if [ ! -f "$b" ]; then
+ set +x; echo "ERROR: no such binary: $b in $prefix_real/$bindir/"; set -x
+ ls -1 "$prefix_real/$bindir"
+ exit 1
+ fi
+ done
+}
+
create_bin_tgz() {
# build the archive that is going to be copied to the tester
- wanted_binaries="$@"
+ wanted_binaries_bin="$1"
+ wanted_binaries_sbin="$2"
- if [ -z "$wanted_binaries" ]; then
+ if [ -z "$wanted_binaries_bin" ] && [ -z "$wanted_binaries_sbin" ]; 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
-
- # ensure requested binaries indeed exist
- for b in $wanted_binaries ; do
- if [ ! -f "$b" ]; then
- set +x; echo "ERROR: no such binary: $b in $prefix_real/bin/"; set -x
- ls -1 "$prefix_real/bin"
- exit 1
- fi
- done
+ prune_files bin "$wanted_binaries_bin"
+ prune_files sbin "$wanted_binaries_sbin"
cd "$prefix_real"
this="$name.build-${BUILD_NUMBER-$(date +%Y-%m-%d_%H_%M_%S)}"
diff --git a/contrib/jenkins-build-osmo-bsc.sh b/contrib/jenkins-build-osmo-bsc.sh
index 73e71e5..4081a00 100755
--- a/contrib/jenkins-build-osmo-bsc.sh
+++ b/contrib/jenkins-build-osmo-bsc.sh
@@ -11,4 +11,4 @@
build_repo osmo-mgw --enable-sanitize
build_repo osmo-bsc --enable-sanitize
-create_bin_tgz osmo-bsc abisip-find ipaccess-config
+create_bin_tgz "osmo-bsc abisip-find ipaccess-config"
diff --git a/contrib/jenkins-build-osmo-bts.sh b/contrib/jenkins-build-osmo-bts.sh
index b40c613..e5fab5d 100755
--- a/contrib/jenkins-build-osmo-bts.sh
+++ b/contrib/jenkins-build-osmo-bts.sh
@@ -10,4 +10,4 @@
build_repo libosmo-abis --enable-sanitize
build_repo osmo-bts --enable-sanitize --enable-trx --with-openbsc=$base/openbsc/openbsc/include --enable-octphy --with-octsdr-2g=$base/octphy-2g-headers
-create_bin_tgz osmo-bts-trx osmo-bts-octphy
+create_bin_tgz "osmo-bts-trx osmo-bts-octphy"
diff --git a/contrib/jenkins-build-osmo-mgw.sh b/contrib/jenkins-build-osmo-mgw.sh
index d4ff0b9..43473c6 100755
--- a/contrib/jenkins-build-osmo-mgw.sh
+++ b/contrib/jenkins-build-osmo-mgw.sh
@@ -9,4 +9,4 @@
build_repo libosmo-netif --enable-sanitize --disable-doxygen
build_repo osmo-mgw --enable-sanitize
-create_bin_tgz osmo-bsc_mgcp osmo-mgw
+create_bin_tgz "osmo-bsc_mgcp osmo-mgw"