summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2019-03-20 14:17:15 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2019-03-20 14:17:15 +0100
commita108c978ae5f7db4a4bf8fd8dd672a6464d52312 (patch)
tree96d926ec262a25df6e24a568ba5d5658c5c41015
parentc00743a3a63d5d834929bcd84cfd0f7fe5cedf86 (diff)
-rwxr-xr-xscripts/pespin-latest.sh160
-rwxr-xr-xscripts/pespin-packages.sh322
2 files changed, 482 insertions, 0 deletions
diff --git a/scripts/pespin-latest.sh b/scripts/pespin-latest.sh
new file mode 100755
index 0000000..e493f81
--- /dev/null
+++ b/scripts/pespin-latest.sh
@@ -0,0 +1,160 @@
+#!/bin/sh
+
+# requirements
+# apt install git-buildpackage osc git
+
+set -e
+set -x
+
+# OBS project name
+PROJ=home:pespin:branches:network:osmocom:nightly
+
+DT=$(date +%Y%m%d)
+TOP=$(pwd)
+DEBSRCDIR="$TOP/debsrc"
+
+if ! which osc >/dev/null 2>/dev/null ; then
+ echo "osc binary not found"
+ exit 1
+fi
+
+prepare() {
+ # start with a checkout of the project
+ if [ -d $PROJ ]; then
+ (cd $PROJ && osc up)
+ else
+ osc co $PROJ
+ fi
+ [ -d "$DEBSRCDIR" ] && rm -rf "$DEBSRCDIR"
+ mkdir "$DEBSRCDIR"
+}
+
+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 "${TOP}/${project}" tag -l --sort=v:refname | grep "$ver_regexp" | tail -n 1)
+ echo "${VER}"
+}
+
+checkout() {
+ project=$1
+ gitbpargs=""
+ echo
+ echo "====> Checking out $project"
+ cd "$TOP"
+ if [ "$project" = "limesuite" ]; then
+ [ -d "$project" ] || git clone "https://github.com/myriadrf/LimeSuite" "$project"
+ else
+ [ -d "$project" ] || git clone "git://git.osmocom.org/$project"
+ fi
+ cd "$project"
+ git fetch
+ VER=$(get_last_tag "$project")
+ git checkout -f -B "$VER" "refs/tags/$VER"
+}
+
+build() {
+ project=$1
+ gitbpargs="$2"
+ output="$DEBSRCDIR/$project"
+ echo
+ echo "====> Building $project"
+ cd "$TOP/$project"
+ VER=$(get_last_tag "$project")
+ git checkout -f -B "$VER" "refs/tags/$VER"
+ if [ -x ./git-version-gen ]; then
+ ./git-version-gen . > .tarball-version 2>/dev/null
+ gbp buildpackage -S -uc -us -d --git-ignore-branch "--git-export-dir=$output" \
+ "--git-debian-branch=$VER" --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=$output" \
+ "--git-debian-branch=$VER" --git-ignore-new $gitbpargs
+ fi
+
+ if [ ! -d "$TOP/$PROJ/$project" ] ; then
+ # creating a new package is different from using old ones
+ mkdir "$TOP/$PROJ/$project"
+ mv "$output/"*.dsc "$TOP/$PROJ/$project/"
+ mv "$output/"*.tar* "$TOP/$PROJ/$project/"
+ cd "$TOP/$PROJ"
+ osc add "$project"
+ else
+ cd "$TOP/$PROJ/$project"
+
+ # update OBS only if the filename doesn't match
+ file=$(cd "$output/" ; ls ./*.dsc)
+ if [ ! -e "$file" ] ; then
+ osc rm ./* || true
+ mv "$output/"*.dsc .
+ mv "$output/"*.tar* .
+ osc add ./*
+ fi
+ fi
+ cd "$TOP"
+}
+
+# add those two once they have tagged any versions that include the 'debian' sub-dir:
+#rtl-sdr
+#osmo-fl2k
+
+build_osmocom() {
+ prepare
+
+ checkout limesuite
+ checkout libosmocore
+ #checkout libosmo-sccp
+ #checkout libosmo-abis
+ #checkout libosmo-netif
+ #checkout libsmpp34
+ #checkout libasn1c
+ #checkout libgtpnl
+ #checkout libusrp
+ #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
+ #checkout simtrace2
+
+ build limesuite --git-upstream-tree="$(get_last_tag limesuite)"
+ build libosmocore
+ #build libosmo-sccp
+ #build libosmo-abis
+ #build libosmo-netif
+ #build libsmpp34
+ #build libasn1c
+ #build libgtpnl
+ #build libusrp
+ #build osmo-iuh
+ #build osmo-ggsn
+ #build osmo-sgsn
+ #build openbsc
+ #build osmo-pcap
+ build osmo-trx
+ #build osmo-sip-connector
+ #build osmo-bts
+ #build osmo-pcu
+ #build osmo-hlr
+ #build osmo-mgw
+ #build osmo-msc
+ #build osmo-bsc
+ #build simtrace2
+
+ cd "$TOP/$PROJ"
+ osc ci -m "Latest Tagged versions of $DT"
+}
+
+build_osmocom
diff --git a/scripts/pespin-packages.sh b/scripts/pespin-packages.sh
new file mode 100755
index 0000000..5d78ec5
--- /dev/null
+++ b/scripts/pespin-packages.sh
@@ -0,0 +1,322 @@
+#!/bin/bash
+# requirements
+# apt install devscripts git-buildpackage osc git
+
+set -e
+set -x
+
+if ! which osc >/dev/null 2>/dev/null ; then
+ echo "osc binary not found"
+ exit 1
+fi
+DT=$(date +%Y%m%d)
+PROJ=home:pespin:branches:network:osmocom:nightly
+
+### common
+checkout() {
+ local name=$1
+ local branch=$2
+ local url="git://git.osmocom.org"
+
+ cd "$REPO"
+
+ if [ -n "$branch" ] ; then
+ git clone "$url/$name" -b "$branch"
+ else
+ git clone "$url/$name"
+ fi
+
+ cd -
+}
+
+### OBS build
+prepare() {
+ # clean up the whole space
+ mkdir -p "$REPO/osc/"
+ cd "$REPO/osc"
+ osc co "$PROJ"
+}
+
+get_commit_version() {
+ # return a version based on the commit
+ local version
+ local date
+
+ # 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)
+ # 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"
+}
+
+build() {
+ 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
+ VER=$(get_commit_version)
+ dch -b -v "$VER" -m "Snapshot build"
+ git commit -m "$VER snapshot" debian/
+ fi
+
+ mkdir -p "$DATA/$name"
+ # source code build without dependency checks and unsigned source and unsigned change log
+ 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
+
+ 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() {
+ TAG="v18.10.0"
+
+ cd "$REPO"
+ git clone https://github.com/myriadrf/LimeSuite limesuite
+ cd limesuite
+ git checkout "$TAG"
+}
+
+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 ..
+}
+
+build_osmocom() {
+ BASE=$PWD
+ DATA=$BASE/data
+ REPO=$BASE/repo
+
+ # rather than including a dangerous 'rm -rf *' here, lets delegate to the user:
+ if [ -n "$(ls)" ]; then
+ echo "ERROR: I need to run in an empty directory."
+ exit 1
+ fi
+
+ prepare
+
+ checkout_limesuite
+ checkout libosmocore
+ checkout libosmo-sccp
+ checkout libosmo-abis
+ checkout libosmo-netif
+ checkout libsmpp34
+ checkout libasn1c
+ checkout libgtpnl
+ checkout libusrp
+ 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
+ checkout python/osmo-python-tests
+ checkout rtl-sdr
+ checkout osmo-fl2k
+ checkout simtrace2
+
+ create_osmo_trx_debian8_jessie
+
+ build limesuite no_commit --git-upstream-tree=v18.10.0
+ build libosmocore
+ build libosmo-sccp
+ build libosmo-abis
+ build libosmo-netif
+ build libsmpp34
+ build libasn1c
+ build libgtpnl
+ build libusrp
+ build osmo-iuh
+ build osmo-ggsn
+ build osmo-sgsn
+ build openbsc
+ build osmo-pcap
+ build osmo-trx
+ build osmo-trx-debian8-jessie
+ build osmo-sip-connector
+ build osmo-bts
+ build osmo-pcu
+ build osmo-hlr
+ build osmo-mgw
+ build osmo-msc
+ build osmo-bsc
+ build osmo-python-tests
+ build rtl-sdr
+ build osmo-fl2k
+ build simtrace2
+
+ download_bumpversion
+
+ post
+}
+
+build_pespin() {
+ BASE=$PWD
+ DATA=$BASE/data
+ REPO=$BASE/repo
+
+ # rather than including a dangerous 'rm -rf *' here, lets delegate to the user:
+ if [ -n "$(ls)" ]; then
+ echo "ERROR: I need to run in an empty directory."
+ exit 1
+ fi
+
+ prepare
+
+ checkout_limesuite
+ checkout libosmocore
+ checkout libosmo-abis
+ checkout libosmo-netif
+ checkout libosmo-sccp pespin/systemd
+ checkout libsmpp34
+ checkout libasn1c
+ checkout libgtpnl
+ checkout libusrp
+ checkout osmo-iuh pespin/systemd
+ checkout osmo-ggsn pespin/systemd
+ checkout osmo-sgsn pespin/systemd
+ checkout openbsc pespin/systemd
+ checkout osmo-trx pespin/systemd
+ checkout osmo-sip-connector pespin/systemd
+ checkout osmo-bts pespin/systemd
+ checkout osmo-pcu pespin/systemd
+ checkout osmo-hlr pespin/systemd
+ checkout osmo-mgw pespin/systemd
+ checkout osmo-msc pespin/systemd
+ checkout osmo-bsc pespin/systemd
+
+ create_osmo_trx_debian8_jessie
+
+ build limesuite no_commit --git-upstream-tree=v18.10.0
+ build libosmocore
+ build libosmo-sccp
+ build libosmo-abis
+ build libosmo-netif
+ build libsmpp34
+ build libasn1c
+ build libgtpnl
+ build libusrp
+ build osmo-iuh
+ build osmo-ggsn
+ build osmo-sgsn
+ build openbsc
+ build osmo-trx
+ build osmo-trx-debian8-jessie
+ build osmo-sip-connector
+ build osmo-bts
+ build osmo-pcu
+ build osmo-hlr
+ build osmo-mgw
+ build osmo-msc
+ build osmo-bsc
+
+ download_bumpversion
+
+ post
+}
+
+build_pespin2() {
+ BASE=$PWD
+ DATA=$BASE/data
+ REPO=$BASE/repo
+
+ # rather than including a dangerous 'rm -rf *' here, lets delegate to the user:
+ if [ -n "$(ls)" ]; then
+ echo "ERROR: I need to run in an empty directory."
+ exit 1
+ fi
+
+ prepare
+
+ checkout libosmocore
+ checkout libosmo-abis
+ checkout libosmo-netif
+ checkout osmo-sysmon
+
+ build libosmocore
+ build libosmo-abis
+ build libosmo-netif
+ build osmo-sysmon
+
+ download_bumpversion
+
+ post
+}
+
+if ! which osc >/dev/null 2>/dev/null ; then
+ echo "osc binary is not installed"
+ exit 1
+fi
+
+TMPDIR=$(mktemp -d nightly-3g_XXXXXX)
+cd "$TMPDIR"
+build_pespin2