From 1828d352c15b2cf5ac1d11c6d40b2695902a63ce Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Thu, 17 May 2018 18:06:15 +0200 Subject: [PATCH] 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 --- contrib/jenkins-build-common.sh | 46 +++++++++++++++++++------------ contrib/jenkins-build-osmo-bsc.sh | 2 +- contrib/jenkins-build-osmo-bts.sh | 2 +- contrib/jenkins-build-osmo-mgw.sh | 2 +- 4 files changed, 31 insertions(+), 21 deletions(-) diff --git a/contrib/jenkins-build-common.sh b/contrib/jenkins-build-common.sh index 9d856226..b8cafcf5 100644 --- a/contrib/jenkins-build-common.sh +++ b/contrib/jenkins-build-common.sh @@ -139,32 +139,42 @@ build_repo() { 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 73e71e5f..4081a00d 100755 --- a/contrib/jenkins-build-osmo-bsc.sh +++ b/contrib/jenkins-build-osmo-bsc.sh @@ -11,4 +11,4 @@ build_repo libosmo-sccp --enable-sanitize 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 b40c6136..e5fab5dd 100755 --- a/contrib/jenkins-build-osmo-bts.sh +++ b/contrib/jenkins-build-osmo-bts.sh @@ -10,4 +10,4 @@ build_repo libosmocore --enable-sanitize --disable-doxygen 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 d4ff0b9b..43473c69 100755 --- a/contrib/jenkins-build-osmo-mgw.sh +++ b/contrib/jenkins-build-osmo-mgw.sh @@ -9,4 +9,4 @@ build_repo libosmo-abis --enable-sanitize 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"