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
This commit is contained in:
Pau Espin 2018-05-17 18:06:15 +02:00
parent 7043996847
commit 1828d352c1
4 changed files with 31 additions and 21 deletions

View File

@ -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)}"

View File

@ -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"

View File

@ -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"

View File

@ -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"