]> git.ozlabs.org Git - next-scripts/blob - do_patch
use the local do_build script
[next-scripts] / do_patch
1 #!/bin/bash
2
3 bin_dir="$(dirname $0)"
4
5 LOG_FILE="../merge.log"
6 build_host="ka2"
7 build_dir="/scratch/sfr/next"
8 [ "$NEXT_BUILD_HOST" ] && build_host="$NEXT_BUILD_HOST"
9 [ "$NEXT_BUILD_DIR" ] && build_dir="$NEXT_BUILD_DIR"
10
11 no_build=false
12 [ "$1" = "-n" ] && {
13         shift
14         no_build=true
15 }
16
17 patch="$1"
18 shift
19
20 [ -n "$1" ] && {
21         build_host="$1"
22         shift
23 }
24 [ -n "$1" ] && {
25         build_dir="$1"
26         shift
27 }
28
29 export NEXT_BUILD_HOST="$build_host"
30 export NEXT_BUILD_DIR="$build_dir"
31
32 log()
33 {
34         echo "$@" | tee -a $LOG_FILE
35 }
36
37 execute()
38 {
39         log "$" $@
40         $@ 2>&1 | tee -a $LOG_FILE
41         return ${PIPESTATUS[0]}
42 }
43
44 GIT_EDITOR=: execute git am -3 "$patch" || exit 1
45
46 $no_build && exit 0
47
48 git push -f "$build_host":"$build_dir" master:refs/heads/next || {
49         echo git push failed 1>&2
50         bash -i || exit
51 }
52 "$bin_dir/do_build" || {
53         echo Build failed 1>&2
54         bash -i || exit
55 }
56
57 exit 0