Change in osmo-ci[master]: Add osmocom-build-old-tags-against-master.sh

osmith gerrit-no-reply at lists.osmocom.org
Tue Mar 26 09:49:00 UTC 2019


osmith has uploaded this change for review. ( https://gerrit.osmocom.org/13415


Change subject: Add osmocom-build-old-tags-against-master.sh
......................................................................

Add osmocom-build-old-tags-against-master.sh

Build old releases of Osmocom programs and libraries against
"master of the day" to detect breakage.

This initial configuration builds the last three release tags of the
Osmocom repositories against master, but specific tags could be
configured as well if needed.

Related: OS#3765
Change-Id: I7cb45cc40c9930840a3d4e6a86f39e1400478ed3
---
M .gitignore
A scripts/osmocom-build-old-tags-against-master.sh
2 files changed, 138 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/15/13415/1

diff --git a/.gitignore b/.gitignore
index 1717928..00fe73d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,5 @@
 jenkins_jobs.ini
 jenkins-jobs.ini
 __pycache__/
+_temp/
+_deps/
diff --git a/scripts/osmocom-build-old-tags-against-master.sh b/scripts/osmocom-build-old-tags-against-master.sh
new file mode 100755
index 0000000..a94156e
--- /dev/null
+++ b/scripts/osmocom-build-old-tags-against-master.sh
@@ -0,0 +1,136 @@
+#!/bin/sh -e
+
+cd "$(dirname "$0")"
+. ./common.sh
+PARALLEL_MAKE="${PARALLEL_MAKE:--j5}"
+
+REPOS_MASTER="
+	libosmocore
+	libosmo-abis
+	libosmo-netif
+	libosmo-sccp
+	libsmpp34
+	libasn1c
+	osmo-ggsn
+	osmo-iuh
+	osmo-hlr
+	osmo-mgw
+"
+
+REPOS_TAGS="
+	libosmo-abis
+	libosmocore
+	libosmo-netif
+	libosmo-sccp
+	openbsc
+	osmo-bsc
+	osmo-bts
+	osmo-ggsn
+	osmo-hlr
+	osmo-iuh
+	osmo-mgw
+	osmo-msc
+	osmo-pcu
+	osmo-sgsn
+	osmo-sip-connector
+	osmo-trx
+"
+
+# Print which tags should be built for a specific repository.
+# This function is part of the configuration, do not insert functions above.
+# $1: repository
+tags_to_build() {
+	case "$1" in
+		# Add repository specific tag listings here:
+		# libosmocore)
+		#	echo "0.1.0"
+		#	osmo_git_last_tags "$1" 3
+		#	;;
+		*)
+			osmo_git_last_tags "$1" 3
+			;;
+	esac
+
+}
+
+# Delete existing temp dir and create a new one, output the path.
+prepare_temp_dir() {
+	TEMP="$(cd ..; pwd)/_temp"
+	if [ -d "$TEMP" ]; then
+		rm -r "$TEMP"
+	fi
+	mkdir -p "$TEMP/log"
+	echo "Temp dir (with build logs): $TEMP"
+}
+
+# Build a repository either from master or from a specific tag against master.
+# The build output is redirected to a file, and partially shown on error.
+# $1: installation path (either $TEMP/inst_master or $TEMP/inst)
+# $2: repository
+# $3: branch, tag or commit
+build_repo() {
+	local log="$TEMP/log/$2-$3.txt"
+
+	if ! PATH="$PWD:$PATH"\
+		PKG_CONFIG_PATH="$TEMP/inst_master/lib/pkgconfig:$PKG_CONFIG_PATH" \
+		LD_LIBRARY_PATH="$TEMP/inst_master/lib:$LD_LIBRARY_PATH" \
+		MAKE="make" \
+		PARALLEL_MAKE="$PARALLEL_MAKE" \
+		CHECK="1" \
+		deps="../_deps" \
+		inst="$1" \
+		./osmo-build-dep.sh "$2" "$3" \
+		> "$log" 2>&1
+	then
+		printf "\n"
+		echo "BUILD FAILED!"
+		echo "Showing last lines of build log below, full log (see jenkins artifacts):"
+		echo "$log"
+		echo "---"
+		tail -n 20 "$log"
+		exit 1
+	fi
+}
+
+# Build all configured repositories from master and install to $TEMP/inst_master.
+build_repos_master() {
+	local repo_master
+
+	echo "Building libraries from current master..."
+	for repo_master in $REPOS_MASTER; do
+		local commit="$(osmo_git_head_commit "$repo_master")"
+		printf "%-21s %s" " * $repo_master" "$commit"
+		build_repo "$TEMP/inst_master" "$repo_master" "$commit"
+		printf "\n"
+	done
+}
+
+# Build all configured repositories on specific tags against master. The result is installed to $TEMP/inst, but deleted
+# after each build.
+build_repos_tags() {
+	local repo
+
+	echo "Building old tags against libraries from current master..."
+	for repo in $REPOS_TAGS; do
+		local tags="$(tags_to_build "$repo" | sort -V | tr '\n' ' ')"
+		if [ -z "$tags" ]; then
+			echo "ERROR: no tags configured for: $repo"
+			exit 1
+		fi
+		printf "%-21s" " * $repo"
+
+		local tag
+		for tag in $tags; do
+			printf "%10s" " $tag"
+			if [ -d "$TEMP/inst" ]; then
+				rm -r "$TEMP/inst"
+			fi
+			build_repo "$TEMP/inst" "$repo" "$tag"
+		done
+		printf "\n"
+	done
+}
+
+prepare_temp_dir
+build_repos_master
+build_repos_tags

-- 
To view, visit https://gerrit.osmocom.org/13415
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7cb45cc40c9930840a3d4e6a86f39e1400478ed3
Gerrit-Change-Number: 13415
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190326/88682e22/attachment.html>


More information about the gerrit-log mailing list