]> git.ozlabs.org Git - next-scripts/blob - merge_cpuinit
make_tree_file: use the official name for kup.kernel.org
[next-scripts] / merge_cpuinit
1 #!/bin/bash
2
3 no_build=false
4
5 [ "$1" = "-n" ] && {
6         shift
7         no_build=true
8 }
9
10 . "$(dirname $0)/common.sh"
11
12 log()
13 {
14         echo "$@" | tee -a $LOG_FILE
15 }
16
17 execute()
18 {
19         log "$" $@
20         $@ 2>&1 | tee -a $LOG_FILE
21         return ${PIPESTATUS[0]}
22 }
23
24 cpwd=../next
25
26 execute git clone -s -l -n -q . ../rebase-tmp || {
27         echo Clone failed 1>&2
28         bash -i || exit
29 }
30 log '$' cd ../rebase-tmp
31 cd ../rebase-tmp
32 execute git checkout -b cpuinit remotes/origin/cpuinit/master || {
33         echo Checkout of remotes/origin/cpuinit/master failed 1>&2
34         bash -i || exit
35 }
36 execute git rebase --onto master remotes/origin/cpuinit/master-base || {
37         echo Rebase failed 1>&2
38         bash -i || exit
39 }
40 echo "fix up?"
41 bash -i
42 log '$' cd $cpwd
43 cd $cpwd
44 execute git fetch -f ../rebase-tmp cpuinit:cpuinit/master || {
45         echo Fetch of cpuinit/master failed 1>&2
46         bash -i || exit
47 }
48 execute rm -rf ../rebase-tmp
49
50 git branch -f cpuinit/master-base HEAD
51
52 old_head=$(git rev-parse HEAD)
53 log Merging cpuinit/master '('$(git log -1 --oneline cpuinit/master)')'
54 execute git merge --no-ff cpuinit/master || {
55         echo Merge failed 1>&2
56         bash -i || exit
57 }
58 printf "%s\t\t%s\n" cpuinit $(git show-ref --hash cpuinit/master) >> $SHA1_FILE
59
60 [ -f "../merge-fixes/cpuinit" ] && {
61         for p in $(cat "../merge-fixes/cpuinit"); do
62                 $(dirname $0)/merge_fix -n "$p" || {
63                         bash -i || exit
64                 }
65         done
66 }
67
68 new_head=$(git rev-parse HEAD)
69
70 $no_build ||
71         [ "$old_head" = "$new_head" ] ||
72         [ "$(git diff ${old_head}.. | wc -c)" -eq 0 ] || {
73
74         git push -f "$build_host":"$build_dir" master:refs/heads/next || {
75                 echo git push failed 1>&2
76                 bash -i || exit
77         }
78         "$bin_dir/do_build" || {
79                 echo Build failed 1>&2
80                 bash -i || exit
81         }
82 }
83
84 exit 0