]> git.xonotic.org Git - xonotic/xonotic.git/blobdiff - misc/tools/xonotic-map-compiler-autobuild
more chdir
[xonotic/xonotic.git] / misc / tools / xonotic-map-compiler-autobuild
index 066b055353049fea92125067d0110027d6dbd605..d19e79cde6f6f13950d46d865dde65c1ff54e6bd 100755 (executable)
@@ -16,10 +16,16 @@ allmaps()
 {
        commithash=$1
        shift
 {
        commithash=$1
        shift
-       for F in `git ls-files "$commithash" -- maps/\*.map.options`; do
-               M=${F#maps/}
-               M=${M%.map.options}
-               blobhash=`git rev-parse --revs-only "$commithash:maps/$M.map.options" || true`-`git rev-parse --revs-only "$commithash:maps/$M.map" || true`
+       for F in `git show "${commithash}:maps/"`; do
+               case "$F" in
+                       *.map.options)
+                               ;;
+                       *)
+                               continue
+                               ;;
+               esac
+               M=${F%.map.options}
+               blobhash=`git rev-parse --revs-only "${commithash}:maps/$M.map.options" || true`-`git rev-parse --revs-only "${commithash}:maps/$M.map" || true`
                case "$blobhash" in
                        -*)
                                ;;
                case "$blobhash" in
                        -*)
                                ;;
@@ -274,23 +280,27 @@ rundownload()
                        mv "$b" "$bspdir.old"/
                fi
        done
                        mv "$b" "$bspdir.old"/
                fi
        done
-       cd data/xonotic-maps.pk3dir
        allmaps "HEAD" getthemap "$url_http" "$bspdir.old" "$bspdir"
        allmaps "HEAD" getthemap "$url_http" "$bspdir.old" "$bspdir"
+}
+
+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
        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
                        if [ -f "$build_cachedir/$HASH" ]; then
                                continue
                        fi
@@ -300,16 +310,11 @@ case "$1" in
                git checkout -f master
                ;;
        screenshot)
                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
                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
                        if [ -f "$screenshot_cachedir/$HASH" ]; then
                                continue
                        fi
@@ -319,32 +324,21 @@ case "$1" in
                                continue
                        fi
 
                                continue
                        fi
 
-                       cd data/xonotic-maps.pk3dir
-
                        allmaps "$HASH" screenshotthemap "$REFNAME" "$url_http"
                        allmaps "$HASH" screenshotthemap "$REFNAME" "$url_http"
+
                        touch "$screenshot_cachedir/$HASH"
                done
                git checkout -f master
                ;;
        makeindex)
                        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)
                ;;
        download)
+               cd data/xonotic-maps.pk3dir
                rundownload
                rundownload
+               cd ../..
                echo "List of maps that got deleted (if any) and currently are in $bspdir.old:"
                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"
                ;;
        download-latest)
                mkdir -p "$bspdir"