]> git.ozlabs.org Git - next-scripts/blob - update_trees
Add update_trees
[next-scripts] / update_trees
1 #!/bin/sh
2
3 (
4         IFS='   '
5
6         while read email type name url ref; do
7                 echo $name: $type
8                 if [ "$type" = "git" ]; then
9                         git fetch "$name"
10                         continue
11                 fi
12                 (
13                         cd ../quilt/"$name"
14                         wget -N --quiet --recursive --no-directories --no-parent "$url"
15                 )
16         done <../real_control
17
18         (
19                 cd ../quilt
20                 git add .
21                 git commit -v -a
22         )
23 )
24
25 quilters=$(awk -F '     ' '$2=="quilt" { print $3; }' ../real_control)
26
27 for name in $quilters; do
28         sfile="../quilt/$name/series"
29         base=$(sed -n 's/^[#    ]*BASE[         ]*\(.*\)[       ]*$/\1/p' "$sfile")
30         case "$base" in
31         *-git[0-9]*)    base=$(wget -q -O - "http://www.kernel.org/pub/linux/kernel/v2.6/snapshots/patch-${base}.id")
32                         ;;
33         commit*)        base=$(expr "$base" : "commit[  ]*\(.*\)")
34                         ;;
35         [0-9]*.*)       base="v$base"
36                         ;;
37         esac
38         echo "$sfile": "$base"
39         grep -q NEXT_PATCHES "$sfile" && {
40                 mv -f "$sfile" "$sfile.orig"
41                 do_echo=:
42                 while read line; do
43                         case $line in
44                         *NEXT_PATCHES_START*)   do_echo=echo
45                                                 ;;
46                         *NEXT_PATCHES_END*)     do_echo=:
47                                                 ;;
48                         esac
49                         $do_echo $line
50                 done <"$sfile.orig" >"$sfile"
51         }
52
53         git branch -D "quilt/$name"
54         git checkout -b "quilt/$name" "$base" || sh -i
55         git quiltimport --patches "../quilt/$name" || sh -i
56
57         [ -f "$sfile.orig" ] &&
58                 mv -f $sfile.orig $sfile
59 done
60
61 exit 0