]> git.ozlabs.org Git - next-scripts/blob - merge_akpm
rationalise akpm related branches
[next-scripts] / merge_akpm
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 today="$(date '+%Y%m%d')"
9
10 no_build=false
11 [ "$NEXT_BUILD_HOST" ] && build_host="$NEXT_BUILD_HOST"
12 [ "$NEXT_BUILD_DIR" ] && build_host="$NEXT_BUILD_DIR"
13
14 [ "$1" = "-n" ] && {
15         shift
16         no_build=true
17 }
18 [ -n "$1" ] && {
19         build_host="$1"
20         shift
21 }
22 [ -n "$1" ] && {
23         build_dir="$1"
24         shift
25 }
26
27 log()
28 {
29         echo "$@" | tee -a $LOG_FILE
30 }
31
32 execute()
33 {
34         log "$" $@
35         $@ 2>&1 | tee -a $LOG_FILE
36         return ${PIPESTATUS[0]}
37 }
38
39 cpwd=../next
40
41 execute git clone -s -l -n -q . ../rebase-tmp || {
42         echo Clone failed 1>&2
43         bash -i || exit
44 }
45 log '$' cd ../rebase-tmp
46 cd ../rebase-tmp
47 execute git fetch --no-tags $cpwd refs/heads/quilt/akpm:akpm || {
48         echo Fetch of top failed 1>&2
49         bash -i || exit
50 }
51 execute git fetch --no-tags $cpwd refs/heads/quilt/akpm-base:akpm-base || {
52         echo Fetch of base failed 1>&2
53         bash -i || exit
54 }
55 execute git checkout akpm || {
56         echo Checkout of top failed 1>&2
57         bash -i || exit
58 }
59 execute git rebase --onto master akpm-base || {
60         echo Rebase failed 1>&2
61         bash -i || exit
62 }
63 echo "fix up? use git rebase -i --onto master akpm-base"
64 bash -i
65 log '$' cd $cpwd
66 cd $cpwd
67 execute git fetch -f ../rebase-tmp akpm:quilt/akpm || {
68         echo Pull failed 1>&2
69         bash -i || exit
70 }
71 execute rm -rf ../rebase-tmp
72
73 git update-ref "refs/next/$today/akpm" quilt/akpm
74 git update-ref refs/heads/quilt/akpm-base HEAD
75
76 log Merging quilt/akpm '('$(git log -1 --oneline quilt/akpm)')'
77 execute git merge --no-ff quilt/akpm || {
78         echo Merge failed 1>&2
79         bash -i || exit
80 }
81
82 [ -f "../merge-fixes/akpm" ] && {
83         for p in $(cat "../merge-fixes/akpm"); do
84                 ../tools/merge_fix -n "$p" || {
85                         bash -i || exit
86                 }
87         done
88 }
89 [ -x "../pre-build/akpm" ] && {
90         "../pre-build/akpm" || bash -i || exit
91 }
92
93 $no_build && exit 0
94
95 git push -f "$build_host":"$build_dir" master:refs/heads/next || {
96         echo git push failed 1>&2
97         bash -i || exit
98 }
99 ssh "$build_host" "$build_cmd" || {
100         echo Build failed 1>&2
101         bash -i || exit
102 }
103
104 exit 0