]> git.ozlabs.org Git - next-scripts/blob - merge_akpm
update to_build_host a bit
[next-scripts] / merge_akpm
1 #!/bin/bash
2
3 today="$(date '+%Y%m%d')"
4
5 no_build=false
6
7 [ "$1" = "-n" ] && {
8         shift
9         no_build=true
10 }
11
12 . "$(dirname $0)/common.sh"
13
14 log()
15 {
16         echo "$@" | tee -a $LOG_FILE
17 }
18
19 execute()
20 {
21         log "$" $@
22         $@ 2>&1 | tee -a $LOG_FILE
23         return ${PIPESTATUS[0]}
24 }
25
26 cpwd=../next
27
28 git branch -f akpm-current/current akpm/current
29
30 git branch -f akpm/base HEAD
31
32 old_head=$(git rev-parse HEAD)
33 hlog=$(git log -1 --oneline akpm-current/current) 2>/dev/null
34 log Merging akpm-current/current "($hlog)"
35 execute git merge --no-ff akpm-current/current || {
36         echo Merge failed 1>&2
37         echo $h >>../merge.debug
38         git diff >>../merge.debug 2>&1
39
40         check_unmerged_files akpm-current
41
42         git diff 2>&1 | egrep -q '<<<<<|^\*' && {
43                 bash -i || exit
44         }
45         GIT_EDITOR=: execute git commit -v -a
46         execute git diff -M --stat --summary 'HEAD^..'
47 }
48 printf "%s\t%s\n" akpm-current $(git show-ref --hash akpm-current/current) >> $SHA1_FILE
49
50 [ -f "../merge-fixes/akpm-current" ] && {
51         for p in $(cat "../merge-fixes/akpm-current"); do
52                 $(dirname $0)/merge_fix -n "$p" || {
53                         bash -i || exit
54                 }
55         done
56 }
57
58 new_head=$(git rev-parse HEAD)
59
60 $no_build ||
61         [ "$old_head" = "$new_head" ] ||
62         [ "$(git diff ${old_head}.. | wc -c)" -eq 0 ] || {
63
64         git push -f "${build_host}${build_host:+:}${build_dir}" master:refs/heads/next || {
65                 echo git push failed 1>&2
66                 bash -i || exit
67         }
68         "$bin_dir/do_build" akpm-current || {
69                 echo Build failed 1>&2
70                 bash -i || exit
71         }
72 }
73
74 execute git clone -s -l -n -q . ../rebase-tmp || {
75         echo Clone failed 1>&2
76         bash -i || exit
77 }
78 log '$' cd ../rebase-tmp
79 cd ../rebase-tmp
80 execute git checkout -b akpm remotes/origin/akpm/master || {
81         echo Checkout of remotes/origin/akpm/master failed 1>&2
82         bash -i || exit
83 }
84 execute git rebase --onto master remotes/origin/akpm/master-base || {
85         echo Rebase failed 1>&2
86         bash -i || exit
87 }
88 echo "fix up?"
89 linux-next-notify "Waiting for akpm fix up"
90 bash -i
91 log '$' cd $cpwd
92 cd $cpwd
93 execute git fetch -f ../rebase-tmp akpm:akpm/master || {
94         echo Fetch of akpm/master failed 1>&2
95         bash -i || exit
96 }
97 execute rm -rf ../rebase-tmp
98
99 git branch -f akpm/master-base HEAD
100
101 old_head=$(git rev-parse HEAD)
102 log Merging akpm/master '('$(git log -1 --oneline akpm/master)')'
103 execute git merge --no-ff akpm/master || {
104         echo Merge failed 1>&2
105         bash -i || exit
106 }
107 printf "%s\t\t%s\n" akpm $(git show-ref --hash akpm/master) >> $SHA1_FILE
108
109 [ -f "../merge-fixes/akpm" ] && {
110         for p in $(cat "../merge-fixes/akpm"); do
111                 $(dirname $0)/merge_fix -n "$p" || {
112                         bash -i || exit
113                 }
114         done
115 }
116
117 new_head=$(git rev-parse HEAD)
118
119 $no_build ||
120         [ "$old_head" = "$new_head" ] ||
121         [ "$(git diff ${old_head}.. | wc -c)" -eq 0 ] || {
122
123         git push -f "${build_host}${build_host:+:}${build_dir}" master:refs/heads/next || {
124                 echo git push failed 1>&2
125                 bash -i || exit
126         }
127         "$bin_dir/do_build" akpm || {
128                 echo Build failed 1>&2
129                 bash -i || exit
130         }
131 }
132
133 exit 0