]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Add script for build testing patches
authorTravis Cross <tc@traviscross.com>
Thu, 9 Jan 2014 14:51:20 +0000 (14:51 +0000)
committerTravis Cross <tc@traviscross.com>
Thu, 9 Jan 2014 16:10:50 +0000 (16:10 +0000)
This is intended to make it easier to describe to users on JIRA how
they should test build patches in a standardized manner and how to
collect a full build log that includes the exact git commit they are
building.

build/build_patch.sh [new file with mode: 0755]

diff --git a/build/build_patch.sh b/build/build_patch.sh
new file mode 100755 (executable)
index 0000000..fc91b00
--- /dev/null
@@ -0,0 +1,44 @@
+#!/bin/bash
+set -e -o pipefail
+
+usage () {
+  printf "usage: %s [-u <remote>] [-r <ref>] [<patch-urls> ...]\n" "$0" >&2
+}
+
+err () {
+  printf "error: %s\n" "$1" >&2
+  exit 1
+}
+
+remote=origin
+ref=origin/master
+dopull=true
+while getopts "hnr:u:" o; do
+  case "$o" in
+    h) usage; exit 0 ;;
+    n) dopull=false ;;
+    r) ref="$OPTARG" ;;
+    u) remote="$OPTARG" ;;
+  esac
+done
+shift $(($OPTIND-1))
+
+if ! which git >/dev/null; then
+  printf "error: please install git\n">&2
+  exit 1; fi
+if ! which wget >/dev/null; then
+  printf "error: please install wget\n">&2
+  exit 1; fi
+
+now=$(date -u +%Y%m%dT%H%M%SZ)
+git clean -fdx || err "failed"
+git reset --hard "$ref" \
+  || err "reset failed"
+$dopull && (git pull "$remote" || err "failed to pull")
+for patch in "$@"; do
+  wget -O - "$patch" | git am
+done
+printf '# Building FreeSWITCH %s\n' "$(git describe HEAD)" \
+  > ${now}-fsbuild.log
+(./bootstrap.sh && ./configure -C && make VERBOSE=1) 2>&1 \
+  | tee -a ${now}-fsbuild.log