]> git.xonotic.org Git - xonotic/xonotic.git/blobdiff - misc/tools/xonotic-map-compiler-autobuild
another chdir
[xonotic/xonotic.git] / misc / tools / xonotic-map-compiler-autobuild
index 066b055353049fea92125067d0110027d6dbd605..23c7dca547a7ace6dfcd407b6dd0a47d694d3a6a 100755 (executable)
@@ -279,18 +279,24 @@ rundownload()
        cd ../..
 }
 
+branches()
+{
+       git for-each-ref 'refs/remotes' | grep -vE '    refs/remotes/([^/]*/HEAD|.*/archived/.*)$'
+}
+
+runmakeindex()
+{
+       cd data/xonotic-maps.pk3dir
+       branches | while read -r HASH TYPE REFNAME; do
+               allmaps "$HASH" indexthemap "$REFNAME"
+       done
+       cd ../..
+}
+
 case "$1" in
        build)
                cd data/xonotic-maps.pk3dir
-               git for-each-ref 'refs/remotes' | while read -r HASH TYPE REFNAME; do
-                       case "$REFNAME" in
-                               */HEAD)
-                                       continue
-                                       ;;
-                               */archived/*)
-                                       continue
-                                       ;;
-                       esac
+               branches | while read -r HASH TYPE REFNAME; do
                        if [ -f "$build_cachedir/$HASH" ]; then
                                continue
                        fi
@@ -300,16 +306,11 @@ case "$1" in
                git checkout -f master
                ;;
        screenshot)
+               runmakeindex > branches.idx.new
+               rsync -vaSHP "$branches.idx.new" "$url_ssh""branches.idx.new"
+               rm -f branches.idx.new
                cd data/xonotic-maps.pk3dir
-               git for-each-ref 'refs/remotes' | while read -r HASH TYPE REFNAME; do
-                       case "$REFNAME" in
-                               */HEAD)
-                                       continue
-                                       ;;
-                               */archived/*)
-                                       continue
-                                       ;;
-                       esac
+               branches | while read -r HASH TYPE REFNAME; do
                        if [ -f "$screenshot_cachedir/$HASH" ]; then
                                continue
                        fi
@@ -320,31 +321,20 @@ case "$1" in
                        fi
 
                        cd data/xonotic-maps.pk3dir
-
                        allmaps "$HASH" screenshotthemap "$REFNAME" "$url_http"
+                       cd ../..
+
                        touch "$screenshot_cachedir/$HASH"
                done
                git checkout -f master
                ;;
        makeindex)
-               cd data/xonotic-maps.pk3dir
-               git for-each-ref 'refs/remotes' | while read -r HASH TYPE REFNAME; do
-                       case "$REFNAME" in
-                               */HEAD)
-                                       continue
-                                       ;;
-                               */archived/*)
-                                       continue
-                                       ;;
-                       esac
-                       allmaps "$HASH" indexthemap "$REFNAME"
-               done
-               git checkout -f master
+               runmakeindex
                ;;
        download)
                rundownload
                echo "List of maps that got deleted (if any) and currently are in $bspdir.old:"
-               ls -l "$bspdir.old"
+               ls -l "$bspdir.old" || true
                ;;
        download-latest)
                mkdir -p "$bspdir"