]> git.xonotic.org Git - xonotic/xonotic.git/blobdiff - misc/tools/xonotic-map-compiler-autobuild
handle a failcase better
[xonotic/xonotic.git] / misc / tools / xonotic-map-compiler-autobuild
index b87465b94e8a2e455bb5174f44f95be045baea55..bb4ddb403baf26fb452cfe2ab553bcfd422c32fb 100755 (executable)
@@ -7,9 +7,11 @@ url=http://beta.xonotic.org/autobuild-bsp/
 url_ssh=xonotic-beta:autobuild-bsp/
 build_cachedir="$HOME/xonotic-map-compiler.cache/"
 screenshot_cachedir="$HOME/xonotic-map-screenshot.cache/"
-override="-bsp_timeout 900 -vis_timeout 3600 -light_timeout 14400 -minimap_timeout 900 -scale_timeout 900"
+build_override="-bsp_timeout 900 -vis_timeout 3600 -light_timeout 14400 -minimap_timeout 900 -scale_timeout 900"
 screenshot_override="9 300"
 
+getthemap_fail=false
+
 allmaps()
 {
        for F in maps/*.map.options; do
@@ -47,13 +49,24 @@ ss2spam()
        url=$2
        branch=$3
        hash=$4
+       status=$5
 
        branch=${branch##refs/heads/}
        branch=${branch##refs/remotes/}
        branch=${branch##origin/}
        hash=`echo "$hash" | cut -c 1-7`
 
-       echo "[$branch $hash] screenshots of $map are available on $url"
+       s_error=
+
+       if [ "$status" -ne 0 ]; then
+               s_error="exited with status $status"
+       fi
+
+       if [ -n "$s_error" ]; then
+               echo "[$branch $hash] \ 34screenshots of $map could not be made: $s_error"
+       else
+               echo "[$branch $hash] screenshots of $map are available on $url"
+       fi
 }
 
 log2spam()
@@ -144,7 +157,7 @@ buildthemap()
        t0=`date +%s`
        (
                cd maps
-               ../../../misc/tools/xonotic-map-compiler "$M" `grep ^- "$M.map.options" | cut -d '#' -f 1` $override > "$M.log"
+               ../../../misc/tools/xonotic-map-compiler "$M" `grep ^- "$M.map.options" | cut -d '#' -f 1` $build_override > "$M.log"
        )
        t1=`date +%s`
        dt=$(($t1 - $t0))
@@ -176,11 +189,18 @@ screenshotthemap()
        fi
        rm -rf ~/.xonotic
        (
+               cd ../..
+               misc/tools/xonotic-map-screenshot "$M" $screenshot_override +"scr_screenshot_name \"$M-\""
        )
+       if ! mv ~/.xonotic/data/screenshots "$M-$blobhash"; then
+               if [ -n "$IRCSPAM" ]; then
+                       ss2spam "$M" "$url$M-$blobhash/" "$REFNAME" "$HASH" > "maps/$M.ircss"
+               fi
+               return 1
+       fi
        if [ -n "$IRCSPAM" ]; then
                ss2spam "$M" "$url$M-$blobhash/" "$REFNAME" "$HASH" > "maps/$M.ircss"
        fi
-       mv ~/.xonotic/data/screenshots "$M-$blobhash"
        ln -snf "../$M-$blobhash" "$M" # from ALL branches, so beware!
        rsync -vaSHP "$M-$blobhash" "$url_ssh"
        rsync -vaSHP "$M" "$url_ssh""latest/"
@@ -203,12 +223,14 @@ getthemap()
                if ! curl -o "$bspdir/$M-$blobhash.pk3" "$url$M-$blobhash.pk3"; then
                        rm -f "$bspdir/$M-$blobhash.pk3"
                        echo "WARNING: could not download $url$M-$blobhash.pk3, maybe not ready yet"
+                       getthemap_fail=true
                        return 0
                fi
        fi
        if ! unzip -l "$bspdir/$M-$blobhash.pk3"; then
                rm -f "$bspdir/$M-$blobhash.pk3"
                echo "WARNING: could not download $url$M-$blobhash.pk3, invalid zip file"
+               getthemap_fail=true
                return 0
        fi
 }
@@ -237,8 +259,11 @@ case "$1" in
                        git reset --hard
                        git clean -xfd
                        git checkout -f "$HASH"
-                       allmaps screenshotthemap "$REFNAME" "$HASH" "$url"
-                       touch "$screenshot_cachedir/$HASH"
+                       allmaps getthemap "$url" "$bspdir.old" "$bspdir"
+                       if ! $getthemap_fail; then
+                               allmaps screenshotthemap "$REFNAME" "$HASH" "$url"
+                               touch "$screenshot_cachedir/$HASH"
+                       fi
                done
                git checkout -f master
                ;;