#!/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 } log() { echo "$@" | tee -a $LOG_FILE } execute() { log "$" $@ $@ 2>&1 | tee -a $LOG_FILE return ${PIPESTATUS[0]} } 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 hlog=$(git log -1 --oneline akpm-current/current) 2>/dev/null log Merging akpm-current/current "($hlog)" execute git merge akpm-current/current || { echo Merge failed 1>&2 echo $h >>../merge.debug git diff >>../merge.debug 2>&1 git diff 2>&1 | egrep -q '<<<<<|^\*' && { bash -i || exit } GIT_EDITOR=: execute git commit -v -a execute git diff -M --stat --summary 'HEAD^..' } execute git clone -s -l -n -q . ../rebase-tmp || { echo Clone failed 1>&2 bash -i || exit } log '$' cd ../rebase-tmp cd ../rebase-tmp execute git fetch --no-tags $cpwd refs/heads/akpm/master:akpm || { echo Fetch of akpm/master failed 1>&2 bash -i || exit } execute git fetch --no-tags $cpwd refs/heads/akpm/master-base:akpm-base || { echo Fetch of akpm/master-base failed 1>&2 bash -i || exit } execute git checkout akpm || { echo Checkout of top failed 1>&2 bash -i || exit } execute git rebase --onto master akpm-base || { echo Rebase failed 1>&2 bash -i || exit } echo "fix up?" bash -i log '$' cd $cpwd cd $cpwd execute git fetch -f ../rebase-tmp akpm:akpm/master || { echo Pull failed 1>&2 bash -i || exit } execute rm -rf ../rebase-tmp git update-ref "refs/next/$today/akpm" akpm/master git branch -f akpm/master-base 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 } [ -f "../merge-fixes/akpm" ] && { for p in $(cat "../merge-fixes/akpm"); do ../tools/merge_fix -n "$p" || { bash -i || exit } done } [ -x "../pre-build/akpm" ] && { "../pre-build/akpm" || bash -i || exit } $no_build && exit 0 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 } exit 0