]> git.ozlabs.org Git - next-scripts/blobdiff - merge_akpm
update to_build_host a bit
[next-scripts] / merge_akpm
index 2c9ff502b12f886d45fd1be48edfd3f8deb97090..4b9be3adcb2aa61b3045e61e81933036daf3a29f 100755 (executable)
@@ -1,28 +1,15 @@
 #!/bin/bash
 
-LOG_FILE="../merge.log"
-build_host="ka2"
-build_dir="/scratch/sfr/next"
-build_cmd="bin/build_next"
-
 today="$(date '+%Y%m%d')"
 
 no_build=false
-[ "$NEXT_BUILD_HOST" ] && build_host="$NEXT_BUILD_HOST"
-[ "$NEXT_BUILD_DIR" ] && build_host="$NEXT_BUILD_DIR"
 
 [ "$1" = "-n" ] && {
        shift
        no_build=true
 }
-[ -n "$1" ] && {
-       build_host="$1"
-       shift
-}
-[ -n "$1" ] && {
-       build_dir="$1"
-       shift
-}
+
+. "$(dirname $0)/common.sh"
 
 log()
 {
@@ -38,23 +25,51 @@ execute()
 
 cpwd=../next
 
-git update-ref "refs/next/$today/akpm-current" akpm/current
 git branch -f akpm-current/current akpm/current
 
 git branch -f akpm/base HEAD
 
+old_head=$(git rev-parse HEAD)
 hlog=$(git log -1 --oneline akpm-current/current) 2>/dev/null
 log Merging akpm-current/current "($hlog)"
-execute git merge akpm-current/current || {
+execute git merge --no-ff akpm-current/current || {
        echo Merge failed 1>&2
        echo $h >>../merge.debug
        git diff >>../merge.debug 2>&1
+
+       check_unmerged_files akpm-current
+
        git diff 2>&1 | egrep -q '<<<<<|^\*' && {
                bash -i || exit
        }
        GIT_EDITOR=: execute git commit -v -a
        execute git diff -M --stat --summary 'HEAD^..'
 }
+printf "%s\t%s\n" akpm-current $(git show-ref --hash akpm-current/current) >> $SHA1_FILE
+
+[ -f "../merge-fixes/akpm-current" ] && {
+       for p in $(cat "../merge-fixes/akpm-current"); do
+               $(dirname $0)/merge_fix -n "$p" || {
+                       bash -i || exit
+               }
+       done
+}
+
+new_head=$(git rev-parse HEAD)
+
+$no_build ||
+       [ "$old_head" = "$new_head" ] ||
+       [ "$(git diff ${old_head}.. | wc -c)" -eq 0 ] || {
+
+       git push -f "${build_host}${build_host:+:}${build_dir}" master:refs/heads/next || {
+               echo git push failed 1>&2
+               bash -i || exit
+       }
+       "$bin_dir/do_build" akpm-current || {
+               echo Build failed 1>&2
+               bash -i || exit
+       }
+}
 
 execute git clone -s -l -n -q . ../rebase-tmp || {
        echo Clone failed 1>&2
@@ -71,6 +86,7 @@ execute git rebase --onto master remotes/origin/akpm/master-base || {
        bash -i || exit
 }
 echo "fix up?"
+linux-next-notify "Waiting for akpm fix up"
 bash -i
 log '$' cd $cpwd
 cd $cpwd
@@ -80,15 +96,15 @@ execute git fetch -f ../rebase-tmp akpm:akpm/master || {
 }
 execute rm -rf ../rebase-tmp
 
-git update-ref "refs/next/$today/akpm" akpm/master
-
 git branch -f akpm/master-base HEAD
 
+old_head=$(git rev-parse HEAD)
 log Merging akpm/master '('$(git log -1 --oneline akpm/master)')'
 execute git merge --no-ff akpm/master || {
        echo Merge failed 1>&2
        bash -i || exit
 }
+printf "%s\t\t%s\n" akpm $(git show-ref --hash akpm/master) >> $SHA1_FILE
 
 [ -f "../merge-fixes/akpm" ] && {
        for p in $(cat "../merge-fixes/akpm"); do
@@ -97,19 +113,21 @@ execute git merge --no-ff akpm/master || {
                }
        done
 }
-[ -x "../pre-build/akpm" ] && {
-       "../pre-build/akpm" || bash -i || exit
-}
 
-$no_build && exit 0
+new_head=$(git rev-parse HEAD)
 
-git push -f "$build_host":"$build_dir" master:refs/heads/next || {
-       echo git push failed 1>&2
-       bash -i || exit
-}
-ssh "$build_host" "$build_cmd" || {
-       echo Build failed 1>&2
-       bash -i || exit
+$no_build ||
+       [ "$old_head" = "$new_head" ] ||
+       [ "$(git diff ${old_head}.. | wc -c)" -eq 0 ] || {
+
+       git push -f "${build_host}${build_host:+:}${build_dir}" master:refs/heads/next || {
+               echo git push failed 1>&2
+               bash -i || exit
+       }
+       "$bin_dir/do_build" akpm || {
+               echo Build failed 1>&2
+               bash -i || exit
+       }
 }
 
 exit 0