2017-12-05 15:53:01 +00:00
|
|
|
#!/bin/bash
|
2019-04-11 12:48:17 +00:00
|
|
|
|
2017-12-05 11:12:27 +00:00
|
|
|
# requirements
|
|
|
|
# apt install devscripts git-buildpackage osc git
|
|
|
|
|
2017-12-05 15:53:01 +00:00
|
|
|
set -e
|
|
|
|
set -x
|
2017-03-14 14:11:54 +00:00
|
|
|
|
2019-04-11 12:48:17 +00:00
|
|
|
# OBS project name
|
|
|
|
PROJ=network:osmocom:nightly
|
|
|
|
|
|
|
|
DT=$(date +%Y%m%d)
|
|
|
|
TOP=$(pwd)/$(mktemp -d nightly-3g_XXXXXX)
|
|
|
|
|
2017-12-05 11:05:09 +00:00
|
|
|
if ! which osc >/dev/null 2>/dev/null ; then
|
|
|
|
echo "osc binary not found"
|
|
|
|
exit 1
|
|
|
|
fi
|
2017-03-14 14:11:54 +00:00
|
|
|
|
2017-12-05 15:53:01 +00:00
|
|
|
### OBS build
|
|
|
|
prepare() {
|
|
|
|
# clean up the whole space
|
|
|
|
mkdir -p "$REPO/osc/"
|
|
|
|
cd "$REPO/osc"
|
|
|
|
osc co "$PROJ"
|
|
|
|
}
|
2017-03-14 14:11:54 +00:00
|
|
|
|
2019-04-11 13:29:30 +00:00
|
|
|
get_last_tag() {
|
|
|
|
project="$1"
|
|
|
|
if [ "$project" = "limesuite" ]; then
|
|
|
|
ver_regexp="^v[0-9]*.[0-9]*.[0-9]*$"
|
|
|
|
else
|
|
|
|
ver_regexp="^[0-9]*.[0-9]*.[0-9]*$"
|
|
|
|
fi
|
|
|
|
VER=$(git -C "${REPO}/${project}" tag -l --sort=v:refname | grep "$ver_regexp" | tail -n 1)
|
|
|
|
echo "${VER}"
|
|
|
|
}
|
|
|
|
|
2018-05-02 13:57:31 +00:00
|
|
|
get_commit_version() {
|
|
|
|
# return a version based on the commit
|
|
|
|
local version
|
|
|
|
|
2018-08-06 08:58:30 +00:00
|
|
|
# determine git version *and generate the .tarball-version file*
|
|
|
|
test -x ./git-version-gen && ./git-version-gen . > .tarball-version 2>/dev/null
|
|
|
|
version=$(cat .tarball-version)
|
2018-05-02 13:57:31 +00:00
|
|
|
# debian doesn't allow '-' in version.
|
|
|
|
version=$(echo "$version" | sed 's/-/./g' )
|
|
|
|
|
|
|
|
# deb version
|
|
|
|
if [ -z "$version" ] ; then
|
|
|
|
version=$(head -1 debian/changelog | cut -d ' ' -f 2 | sed 's,(,,' | sed 's,),,')
|
|
|
|
version="$version.$DT"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo -n "$version"
|
|
|
|
}
|
|
|
|
|
2019-04-11 12:48:17 +00:00
|
|
|
### common
|
|
|
|
checkout() {
|
|
|
|
local name=$1
|
|
|
|
local branch=$2
|
|
|
|
local url="https://git.osmocom.org"
|
|
|
|
|
|
|
|
cd "$REPO"
|
|
|
|
|
|
|
|
if [ -n "$branch" ] ; then
|
|
|
|
git clone "$url/$name" -b "$branch"
|
|
|
|
else
|
|
|
|
git clone "$url/$name"
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd -
|
|
|
|
}
|
|
|
|
|
2017-03-14 14:11:54 +00:00
|
|
|
build() {
|
2017-12-05 15:53:01 +00:00
|
|
|
local name=$1
|
|
|
|
local changelog=$2
|
|
|
|
local gitbpargs=$3
|
|
|
|
local repodir=$REPO/$name
|
|
|
|
local oscdir=$REPO/osc/$PROJ/$name
|
|
|
|
|
|
|
|
if [ -z "$changelog" ] ; then
|
|
|
|
changelog=commit
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d "$oscdir" ] ; then
|
|
|
|
# remove earlier version
|
|
|
|
cd "$oscdir"
|
|
|
|
osc rm -- * || true
|
|
|
|
else
|
|
|
|
# new package
|
|
|
|
mkdir -p "$oscdir/"
|
|
|
|
cd "$REPO/osc/$PROJ/"
|
|
|
|
osc add "$name"
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd "$repodir"
|
|
|
|
|
|
|
|
if [ "$changelog" = "commit" ] ; then
|
2018-05-02 13:57:31 +00:00
|
|
|
VER=$(get_commit_version)
|
|
|
|
dch -b -v "$VER" -m "Snapshot build"
|
|
|
|
git commit -m "$VER snapshot" debian/
|
2017-12-05 15:53:01 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p "$DATA/$name"
|
|
|
|
# source code build without dependency checks and unsigned source and unsigned change log
|
2018-08-06 15:00:55 +00:00
|
|
|
if [ -f .tarball-version ]; then
|
|
|
|
gbp buildpackage -S -uc -us -d --git-ignore-branch "--git-export-dir=$DATA/$name" \
|
|
|
|
--git-ignore-new $gitbpargs \
|
|
|
|
--git-postexport='cp $GBP_GIT_DIR/../.tarball-version $GBP_TMP_DIR/'
|
|
|
|
else
|
|
|
|
gbp buildpackage -S -uc -us -d --git-ignore-branch "--git-export-dir=$DATA/$name" \
|
|
|
|
--git-ignore-new $gitbpargs
|
|
|
|
fi
|
2017-12-05 15:53:01 +00:00
|
|
|
|
|
|
|
mv "$DATA/$name/"*.tar* "$DATA/$name/"*.dsc "$oscdir/"
|
|
|
|
|
|
|
|
cd "$oscdir"
|
|
|
|
osc add -- *.tar* *.dsc
|
|
|
|
osc ci -m "Snapshot $name $DT"
|
|
|
|
}
|
|
|
|
|
|
|
|
post() {
|
|
|
|
cd "$REPO/osc/$PROJ/"
|
|
|
|
osc status
|
|
|
|
}
|
|
|
|
|
|
|
|
download_bumpversion() {
|
|
|
|
# bumpversion is required for debian < 9/stretch
|
|
|
|
local oscdir=$REPO/osc/$PROJ/bumpversion
|
|
|
|
local version=0.5.3
|
|
|
|
local release=3
|
|
|
|
|
|
|
|
if [ ! -d "$oscdir" ] ; then
|
|
|
|
mkdir "$oscdir"
|
|
|
|
cd "$oscdir"
|
|
|
|
wget "http://http.debian.net/debian/pool/main/b/bumpversion/bumpversion_$version-$release.dsc"
|
|
|
|
wget "http://http.debian.net/debian/pool/main/b/bumpversion/bumpversion_$version.orig.tar.gz"
|
|
|
|
wget "http://http.debian.net/debian/pool/main/b/bumpversion/bumpversion_$version-$release.debian.tar.xz"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
checkout_limesuite() {
|
|
|
|
cd "$REPO"
|
|
|
|
git clone https://github.com/myriadrf/LimeSuite limesuite
|
2019-04-18 11:00:55 +00:00
|
|
|
TAG="357ad5dd0d71304179d476b38e67240527d917df"
|
2017-12-05 15:53:01 +00:00
|
|
|
cd limesuite
|
|
|
|
git checkout "$TAG"
|
2017-03-14 14:11:54 +00:00
|
|
|
}
|
|
|
|
|
2018-07-31 16:12:32 +00:00
|
|
|
create_osmo_trx_debian8_jessie() {
|
|
|
|
# The package must be already checked out via `checkout osmo-trx`
|
|
|
|
cd "$REPO"
|
|
|
|
cp -a osmo-trx osmo-trx-debian8-jessie
|
|
|
|
cd osmo-trx-debian8-jessie/
|
|
|
|
patch -p1 < debian/patches/build-for-debian8.patch
|
|
|
|
git commit -m 'auto-commit: allow debian8 to build' debian/
|
|
|
|
cd ..
|
|
|
|
}
|
|
|
|
|
2017-12-05 15:53:01 +00:00
|
|
|
build_osmocom() {
|
2019-04-11 12:48:17 +00:00
|
|
|
DATA=$TOP/data
|
|
|
|
REPO=$TOP/repo
|
2017-12-05 15:53:01 +00:00
|
|
|
|
|
|
|
# rather than including a dangerous 'rm -rf *' here, lets delegate to the user:
|
2019-04-11 12:48:17 +00:00
|
|
|
if [ -n "$(ls $TOP)" ]; then
|
2017-12-05 15:53:01 +00:00
|
|
|
echo "ERROR: I need to run in an empty directory."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
prepare
|
|
|
|
|
2018-06-25 15:05:38 +00:00
|
|
|
checkout_limesuite
|
2019-04-11 08:41:34 +00:00
|
|
|
checkout osmo-gsm-manuals
|
2017-12-05 15:53:01 +00:00
|
|
|
checkout libosmocore
|
|
|
|
checkout libosmo-sccp
|
|
|
|
checkout libosmo-abis
|
|
|
|
checkout libosmo-netif
|
|
|
|
checkout libsmpp34
|
|
|
|
checkout libasn1c
|
|
|
|
checkout libgtpnl
|
2018-04-26 17:49:37 +00:00
|
|
|
checkout libusrp
|
2017-12-05 15:53:01 +00:00
|
|
|
checkout osmo-iuh
|
|
|
|
checkout osmo-ggsn
|
|
|
|
checkout osmo-sgsn
|
|
|
|
checkout openbsc
|
|
|
|
checkout osmo-pcap
|
|
|
|
checkout osmo-trx
|
|
|
|
checkout osmo-sip-connector
|
|
|
|
checkout osmo-bts
|
|
|
|
checkout osmo-pcu
|
|
|
|
checkout osmo-hlr
|
|
|
|
checkout osmo-mgw
|
|
|
|
checkout osmo-msc
|
|
|
|
checkout osmo-bsc
|
2018-06-26 14:13:46 +00:00
|
|
|
checkout python/osmo-python-tests
|
2018-06-03 13:37:06 +00:00
|
|
|
checkout rtl-sdr
|
2018-06-03 14:27:10 +00:00
|
|
|
checkout osmo-fl2k
|
2018-08-26 08:13:51 +00:00
|
|
|
checkout simtrace2
|
2019-01-17 16:55:10 +00:00
|
|
|
checkout libosmo-dsp
|
2019-03-19 19:52:42 +00:00
|
|
|
checkout osmo-sysmon
|
2019-04-03 07:54:12 +00:00
|
|
|
checkout osmo-remsim
|
2017-12-05 15:53:01 +00:00
|
|
|
|
2018-07-31 16:12:32 +00:00
|
|
|
create_osmo_trx_debian8_jessie
|
|
|
|
|
2019-04-18 11:00:55 +00:00
|
|
|
build limesuite no_commit --git-upstream-tree="357ad5dd0d71304179d476b38e67240527d917df"
|
2019-04-11 08:41:34 +00:00
|
|
|
build osmo-gsm-manuals
|
2017-12-05 15:53:01 +00:00
|
|
|
build libosmocore
|
|
|
|
build libosmo-sccp
|
|
|
|
build libosmo-abis
|
|
|
|
build libosmo-netif
|
|
|
|
build libsmpp34
|
|
|
|
build libasn1c
|
|
|
|
build libgtpnl
|
2018-04-26 17:49:37 +00:00
|
|
|
build libusrp
|
2017-12-05 15:53:01 +00:00
|
|
|
build osmo-iuh
|
|
|
|
build osmo-ggsn
|
|
|
|
build osmo-sgsn
|
|
|
|
build openbsc
|
|
|
|
build osmo-pcap
|
|
|
|
build osmo-trx
|
2018-07-31 16:12:32 +00:00
|
|
|
build osmo-trx-debian8-jessie
|
2017-12-05 15:53:01 +00:00
|
|
|
build osmo-sip-connector
|
|
|
|
build osmo-bts
|
|
|
|
build osmo-pcu
|
|
|
|
build osmo-hlr
|
|
|
|
build osmo-mgw
|
|
|
|
build osmo-msc
|
|
|
|
build osmo-bsc
|
2018-06-26 14:13:46 +00:00
|
|
|
build osmo-python-tests
|
2018-06-03 13:37:06 +00:00
|
|
|
build rtl-sdr
|
2018-06-03 14:27:10 +00:00
|
|
|
build osmo-fl2k
|
2018-08-26 08:13:51 +00:00
|
|
|
build simtrace2
|
2019-01-17 16:55:10 +00:00
|
|
|
build libosmo-dsp
|
2019-03-19 19:52:42 +00:00
|
|
|
build osmo-sysmon
|
2019-04-03 07:54:12 +00:00
|
|
|
build osmo-remsim
|
2017-12-05 15:53:01 +00:00
|
|
|
|
|
|
|
download_bumpversion
|
|
|
|
|
|
|
|
post
|
|
|
|
}
|
|
|
|
|
|
|
|
build_osmocom
|