]> git.ozlabs.org Git - next-scripts/blob - merge_akpm
fetch_trees: explicitly stop wget from storing the URL in an xattr
[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         um_files=$(git diff 2>&1 | sed -n 's/^\* Unmerged path //p')
40         [ "$um_files" ] && [ -f "../merge-files/akpm-current" ] && {
41                 rm_files=$(grep -F "$um_files" "../merge-files/akpm-current")
42                 [ "$rm_files" ] &&
43                         "$bin_dir/do_rm" $rm_files
44         }
45         git diff 2>&1 | egrep -q '<<<<<|^\*' && {
46                 bash -i || exit
47         }
48         GIT_EDITOR=: execute git commit -v -a
49         execute git diff -M --stat --summary 'HEAD^..'
50 }
51 printf "%s\t%s\n" akpm-current $(git show-ref --hash akpm-current/current) >> $SHA1_FILE
52
53 [ -f "../merge-fixes/akpm-current" ] && {
54         for p in $(cat "../merge-fixes/akpm-current"); do
55                 $(dirname $0)/merge_fix -n "$p" || {
56                         bash -i || exit
57                 }
58         done
59 }
60
61 new_head=$(git rev-parse HEAD)
62
63 $no_build ||
64         [ "$old_head" = "$new_head" ] ||
65         [ "$(git diff ${old_head}.. | wc -c)" -eq 0 ] || {
66
67         git push -f "${build_host}${build_host:+:}${build_dir}" master:refs/heads/next || {
68                 echo git push failed 1>&2
69                 bash -i || exit
70         }
71         "$bin_dir/do_build" akpm-current || {
72                 echo Build failed 1>&2
73                 bash -i || exit
74         }
75 }
76
77 execute git clone -s -l -n -q . ../rebase-tmp || {
78         echo Clone failed 1>&2
79         bash -i || exit
80 }
81 log '$' cd ../rebase-tmp
82 cd ../rebase-tmp
83 execute git checkout -b akpm remotes/origin/akpm/master || {
84         echo Checkout of remotes/origin/akpm/master failed 1>&2
85         bash -i || exit
86 }
87 execute git rebase --onto master remotes/origin/akpm/master-base || {
88         echo Rebase failed 1>&2
89         bash -i || exit
90 }
91 echo "fix up?"
92 linux-next-notify "Waiting for akpm fix up"
93 bash -i
94 log '$' cd $cpwd
95 cd $cpwd
96 execute git fetch -f ../rebase-tmp akpm:akpm/master || {
97         echo Fetch of akpm/master failed 1>&2
98         bash -i || exit
99 }
100 execute rm -rf ../rebase-tmp
101
102 git branch -f akpm/master-base HEAD
103
104 old_head=$(git rev-parse HEAD)
105 log Merging akpm/master '('$(git log -1 --oneline akpm/master)')'
106 execute git merge --no-ff akpm/master || {
107         echo Merge failed 1>&2
108         bash -i || exit
109 }
110 printf "%s\t\t%s\n" akpm $(git show-ref --hash akpm/master) >> $SHA1_FILE
111
112 [ -f "../merge-fixes/akpm" ] && {
113         for p in $(cat "../merge-fixes/akpm"); do
114                 $(dirname $0)/merge_fix -n "$p" || {
115                         bash -i || exit
116                 }
117         done
118 }
119
120 new_head=$(git rev-parse HEAD)
121
122 $no_build ||
123         [ "$old_head" = "$new_head" ] ||
124         [ "$(git diff ${old_head}.. | wc -c)" -eq 0 ] || {
125
126         git push -f "${build_host}${build_host:+:}${build_dir}" master:refs/heads/next || {
127                 echo git push failed 1>&2
128                 bash -i || exit
129         }
130         "$bin_dir/do_build" akpm || {
131                 echo Build failed 1>&2
132                 bash -i || exit
133         }
134 }
135
136 exit 0