]> git.ozlabs.org Git - next-scripts/blobdiff - import-akpm
various updates
[next-scripts] / import-akpm
index 8b6d4c5c06f2b10b4bd4531ec8cc2dfe2a676b22..be33c6634f0cad62cfab099594ffa06631457c98 100755 (executable)
@@ -1,19 +1,17 @@
 #!/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"
@@ -33,56 +31,36 @@ git rev-parse --verify "$nbase" >/dev/null || {
        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
-}
-
 [ -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
+git branch current-base
+
+sed_exp='/NEXT_PATCHES_START/,/NEXT_PATCHES_END/{s/[ \t]*#.*$//;/^[ \t]*$/!p;};/^linux-next.patch/p'
+patches=$(sed -n "$sed_exp" "$sfile")
 
-for f in $(cat "$mmotm/series"); do
+for f in $patches; do
        [ "$f" = "origin.patch" ] && continue
-       [ "$f" = "linux-next.patch" ] && continue
-       execute git am "$mmotm/broken-out/$f" ||
-               bash -i ||
-               break
+       [ "$f" = "linux-next.patch" ] && {
+               git branch current
+               execute git merge --no-edit --no-stat "$nbase"
+               git branch master-base
+               continue
+       }
+       execute git am --patch-format=mbox "$mmotm/broken-out/$f"
 done
 
 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 -f ../quilt-tmp current:"$name/current"
+execute git fetch -f ../quilt-tmp current-base:"$name/current-base"
+execute git fetch -f ../quilt-tmp master:"$name/master"
+execute git fetch -f ../quilt-tmp master-base:"$name/master-base"
 
-[ -d "../quilt-tmp" ] &&
-       rm -rf ../quilt-tmp
+rm -rf ../quilt-tmp
 
 exit 0