X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=import-akpm;h=ef85f1f1ee9c305dba06b3d09bcee52abc9f2ab6;hb=e2b1ad956622c4b4b6d98e412013e433411c7aac;hp=d206e7a60e7d6634e3d35669254d3c4a2e0e7838;hpb=e182717c8e468a4bbf811bd7a5c253151ad85cae;p=next-scripts diff --git a/import-akpm b/import-akpm index d206e7a..ef85f1f 100755 --- a/import-akpm +++ b/import-akpm @@ -1,24 +1,30 @@ #!/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/text" +mmotm="../mmotm" sfile="$mmotm/series" cpwd=$(pwd) -base=$(sed -n '1s/^GIT *\([^ ]*\).*$/\1/p' "$mmotm/broken-out/origin.patch") +[ -f "$mmotm/broken-out/origin.patch" ] && + base=$(sed -n '1s/^GIT *\([^ ]*\).*$/\1/p' "$mmotm/broken-out/origin.patch") +[ "$base" ] || { + base=$(tail -n 1 "$mmotm/.DATE") + base=${base#v} + base="v${base}" +} nbase=$(sed -n '1s/^GIT *\([^ ]*\).*$/\1/p' "$mmotm/broken-out/linux-next.patch") git rev-parse --verify "$base" >/dev/null || { log "Unknown origin BASE $base" @@ -32,18 +38,21 @@ db=$(git describe "$base") dnb=$(git describe --contains "$nbase") log "Importing akpm based on $db/$dnb" -[ -d "../quilt-tmp" ] || - execute git clone -s -l -n -q . ../quilt-tmp +[ -d "../tmp-akpm" ] && { + log "akpm import directory already exists" + exit 1 +} -log '$' cd ../quilt-tmp -cd ../quilt-tmp -execute git checkout -b akpm/master "$db" -git branch akpm/current-base +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 || + $SHELL -i || exit sed_exp=' /NEXT_PATCHES_START/,/NEXT_PATCHES_END/{ - s/[ \t]*#.*NEXT_PATCHES_START[ \t]*\([^ \t]*\).*$/>\1/ - s/[ \t]*#.*NEXT_PATCHES_END.*$/*) - cbranch="${f#>}" - [ "$cbranch" ] && - cref="$(git rev-parse --verify HEAD)" - ;; - \<) - [ "$cbranch" ] && { - [ "$cref" != "$(git rev-parse --verify HEAD)" ] && - git branch -f "akpm/$cbranch" - cbranch="" + 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 --patch-format=mbox "$mmotm/broken-out/$f" + execute git am -s --patch-format=mbox "$mmotm/broken-out/$f" || + $SHELL -i || exit ;; esac done -[ "$cbranch" ] && - [ "$cref" != "$(git rev-parse --verify HEAD)" ] && - git branch -f "akpm/$cbranch" - log '$' cd $cpwd cd $cpwd -execute git fetch akpm +execute rm -rf ../tmp-akpm +execute git worktree prune -rm -rf ../quilt-tmp +for i in akpm/current akpm/current-base akpm/master akpm/master-base; do + execute git branch -f $i tmp-$i + execute git branch -D tmp-$i +done exit 0