X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=import-akpm;h=7416311d7449ff9aef4b54fc65baa295055775c9;hb=514eb77fc1fb6b7a806f7472ba2aa775af16c02b;hp=8b6d4c5c06f2b10b4bd4531ec8cc2dfe2a676b22;hpb=e25ccd56bc26214dab1ad640db443ca95cd5a5e3;p=next-scripts diff --git a/import-akpm b/import-akpm index 8b6d4c5..7416311 100755 --- a/import-akpm +++ b/import-akpm @@ -1,88 +1,101 @@ #!/bin/bash +log_file=../akpm-import.log + log() { - echo "$@" | tee -a ../akpm-import.log + echo "$@" | tee -a $log_file } execute() { log "$" $@ - "$@" 2>&1 | tee -a ../akpm-import.log - [ ${PIPESTATUS[0]} -eq 0 ] || $SHELL -i || { - [ -f "$sfile.orig" ] && - mv -f "$sfile.orig" "$sfile" - exit 1 - } + "$@" 2>&1 | tee -a $log_file + [ ${PIPESTATUS[0]} -eq 0 ] || $SHELL -i || exit 1 } -name="akpm" -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") -log "Importing $name based on $base/$nbase" git rev-parse --verify "$base" >/dev/null || { - log "Unknown origin BASE" + log "Unknown origin BASE $base" exit 1 } git rev-parse --verify "$nbase" >/dev/null || { - log "Unknown linux-next BASE" + log "Unknown linux-next BASE $nbase" exit 1 } - -mv -f "$sfile" "$sfile.orig" -do_echo=echo -grep -q NEXT_PATCHES "$sfile.orig" && do_echo=: -while read line; do - case $line in - *NEXT_PATCHES_START*) do_echo=echo - ;; - *NEXT_PATCHES_END*) do_echo=: - ;; - esac - $do_echo $line -done <"$sfile.orig" | - sed -e 's/[ ]*#.*$//' -e '/^[ ]*$/d' >"$sfile" - -git show-ref --quiet --verify "refs/heads/quilt/$name" || - execute git branch "quilt/$name" "$base" - -[ -s "$sfile" ] || { - log " quilt series is empty" - mv -f "$sfile.orig" "$sfile" - execute git update-ref "refs/heads/quilt/$name" "$nbase" - exit 0 -} +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 log '$' cd ../quilt-tmp cd ../quilt-tmp -execute git reset --hard "$base" -execute git merge --no-edit --no-stat "$nbase" || bash -i || exit 1 -git branch base +execute git checkout -b akpm/master "$db" +git branch akpm/current-base + +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 am --patch-format=mbox "$mmotm/broken-out/$f" + ;; + esac done +[ "$cbranch" ] && + [ "$cref" != "$(git rev-parse --verify HEAD)" ] && + git branch -f "akpm/$cbranch" + log '$' cd $cpwd cd $cpwd -execute git fetch -f ../quilt-tmp master:"quilt/$name" -execute git fetch -f ../quilt-tmp base:"quilt/${name}-base" - -mv -f "$sfile.orig" "$sfile" +execute git fetch --force --no-tags ../quilt-tmp \ + refs/heads/akpm/master:refs/heads/akpm/master \ + refs/heads/akpm/master-base:refs/heads/akpm/master-base \ + refs/heads/akpm/current:refs/heads/akpm/current \ + refs/heads/akpm/current-base:refs/heads/akpm/current-base -[ -d "../quilt-tmp" ] && - rm -rf ../quilt-tmp +rm -rf ../quilt-tmp exit 0