]> git.ozlabs.org Git - next-scripts/commitdiff
Add update_trees
authorStephen Rothwell <sfr@canb.auug.org.au>
Fri, 15 Feb 2008 05:20:34 +0000 (16:20 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 15 Feb 2008 05:20:34 +0000 (16:20 +1100)
update_trees [new file with mode: 0755]

diff --git a/update_trees b/update_trees
new file mode 100755 (executable)
index 0000000..75333d0
--- /dev/null
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+(
+       IFS='   '
+
+       while read email type name url ref; do
+               echo $name: $type
+               if [ "$type" = "git" ]; then
+                       git fetch "$name"
+                       continue
+               fi
+               (
+                       cd ../quilt/"$name"
+                       wget -N --quiet --recursive --no-directories --no-parent "$url"
+               )
+       done <../real_control
+
+       (
+               cd ../quilt
+               git add .
+               git commit -v -a
+       )
+)
+
+quilters=$(awk -F '    ' '$2=="quilt" { print $3; }' ../real_control)
+
+for name in $quilters; do
+       sfile="../quilt/$name/series"
+       base=$(sed -n 's/^[#    ]*BASE[         ]*\(.*\)[       ]*$/\1/p' "$sfile")
+       case "$base" in
+       *-git[0-9]*)    base=$(wget -q -O - "http://www.kernel.org/pub/linux/kernel/v2.6/snapshots/patch-${base}.id")
+                       ;;
+       commit*)        base=$(expr "$base" : "commit[  ]*\(.*\)")
+                       ;;
+       [0-9]*.*)       base="v$base"
+                       ;;
+       esac
+       echo "$sfile": "$base"
+       grep -q NEXT_PATCHES "$sfile" && {
+               mv -f "$sfile" "$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" >"$sfile"
+       }
+
+       git branch -D "quilt/$name"
+       git checkout -b "quilt/$name" "$base" || sh -i
+       git quiltimport --patches "../quilt/$name" || sh -i
+
+       [ -f "$sfile.orig" ] &&
+               mv -f $sfile.orig $sfile
+done
+
+exit 0