From: Stephen Rothwell Date: Fri, 27 Jul 2018 00:53:12 +0000 (+1000) Subject: import-akpm: use merge-files and merge-files for akpm-current X-Git-Url: https://git.ozlabs.org/?a=commitdiff_plain;h=d9d3527afacd995f686977255c871569e736bb70;p=next-scripts import-akpm: use merge-files and merge-files for akpm-current --- diff --git a/common.sh b/common.sh index 74a31c7..827015a 100644 --- a/common.sh +++ b/common.sh @@ -8,7 +8,7 @@ _next_common_included=1 bin_dir=$(dirname "$0") -LOG_FILE="../merge.log" +[ "$LOG_FILE" ] || LOG_FILE="../merge.log" SHA1_FILE="../SHA1s" CTRL_FILE="../etc/control" diff --git a/import-akpm b/import-akpm index 6f5c080..ef85f1f 100755 --- a/import-akpm +++ b/import-akpm @@ -1,17 +1,17 @@ #!/bin/bash -log_file=../akpm-import.log +export LOG_FILE=../akpm-import.log log() { - echo "$@" | tee -a $log_file + echo "$@" | tee -a $LOG_FILE } execute() { - log "$" $@ - "$@" 2>&1 | tee -a $log_file - [ ${PIPESTATUS[0]} -eq 0 ] || $SHELL -i || exit 1 + log '$' "$@" + "$@" 2>&1 | tee -a $LOG_FILE + return ${PIPESTATUS[0]} } mmotm="../mmotm" @@ -43,11 +43,13 @@ log "Importing akpm based on $db/$dnb" exit 1 } -execute git worktree add -b tmp-akpm/master ../tmp-akpm "$db" +execute git worktree add -b tmp-akpm/master ../tmp-akpm "$db" || + $SHELL -i || exit log '$' cd ../tmp-akpm cd ../tmp-akpm -execute git branch tmp-akpm/current-base +execute git branch tmp-akpm/current-base || + $SHELL -i || exit sed_exp=' /NEXT_PATCHES_START/,/NEXT_PATCHES_END/{ @@ -62,12 +64,32 @@ for f in $patches; do origin.patch) ;; linux-next.patch) - execute git branch tmp-akpm/current - execute git merge --no-edit --no-stat "$dnb" - execute git branch tmp-akpm/master-base + execute git branch tmp-akpm/current || + $SHELL -i || exit + execute git merge --no-edit --no-stat "$dnb" || { + umf=$(git diff 2>&1 | sed -n 's/^\* Unmerged path //p') + [ "$umf" ] && [ -f "../merge-files/akpm-current" ] && { + rmf=$(grep -F "$umf" "../merge-files/akpm-current") + [ "$rmf" ] && + "$bin_dir/do_rm" $rmf + } + git diff 2>&1 | grep -E -q '<<<<<|^\*' && { + $SHELL -i || exit + } + GIT_EDITOR=: execute git commit -v -a + } + [ -f "../merge-fixes/akpm-current" ] && { + for p in $(cat "../merge-fixes/akpm-current"); do + $(dirname $0)/merge_fix -n "$p" || + $SHELL -i || exit + done + } + execute git branch tmp-akpm/master-base || + $SHELL -i || exit ;; *) - execute git am -s --patch-format=mbox "$mmotm/broken-out/$f" + execute git am -s --patch-format=mbox "$mmotm/broken-out/$f" || + $SHELL -i || exit ;; esac done