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