]> git.ozlabs.org Git - next-scripts/blobdiff - fetch_trees
do_build: use the native powerpc compiler
[next-scripts] / fetch_trees
index 3928469d2803e1affd391c228b847c26ec1c1874..87e1b6cca2ab0af600b4f83b07af0f4dece748a8 100755 (executable)
@@ -2,10 +2,25 @@
 
 . "$(dirname $0)/common.sh" ""
 
+[ "$1" = "-n" ] && {
+       shift
+       last=$(tail -n1 $SHA1_FILE | cut -f1 -d$'\t')
+       start_from=$(awk -F '\t' '/^[^#]/ && $3 == "'$last'" { do getline; while (/^#/ || $2 == "branch"); print $3; exit 0; }' $CTRL_FILE)
+}
+
+[ "$1" = "-s" ] && {
+       shift
+       start_from="$1"
+       [ -z "$start_from" ] && {
+               echo "-s requires a start tree" 1>&2
+               exit 1
+       }
+       shift
+}
+
 get_field()
 {
-       grep -v '^#' $CTRL_FILE |
-               awk -F '\t' '$3 == "'$1'" { print $'$2'; }'
+       awk -F '\t' '/^[^#]/ && $3 == "'$1'" { print $'$2'; }' $CTRL_FILE
 }
 
 fetch_git()
@@ -16,7 +31,7 @@ fetch_git()
 fetch_mmotm()
 {
        (
-               cd ../mmotm && {
+               cd ../mmotm || {
                        echo "Cannot chdir to ../mmotm" 1>&2
                        return
                }
@@ -75,14 +90,23 @@ fetch_quilt()
                }
                comm -23 .series.old .series.next | xargs -r rm -f
                rm -f .series.old .series.next
+               setfattr -x user.xdg.origin.url * >/dev/null 2>&1
        )
 }
 
 trees="$@"
 [ "$trees" ] ||
-       trees=$(grep -v '^#' $CTRL_FILE | awk -F '\t' '{ print $3 }')
+       trees=$(awk -F '\t' '/^[^#]/ && $2 != "branch" { print $3 }' $CTRL_FILE)
 
 for name in $trees; do
+       [ -n "$start_from" ] && {
+               if [ "$name" = "$start_from" ]; then
+                       start_from=""
+               else
+                       continue
+               fi
+       }
+
        type=$(get_field "$name" 2)
 
        echo $name: $type