6 url_http=https://beta.xonotic.org/autobuild-bsp/
7 url_ssh=xonotic-beta:./
8 build_cachedir="$HOME/xonotic-map-compiler.cache/"
9 screenshot_cachedir="$HOME/xonotic-map-screenshot.cache/"
10 build_override="-bsp_timeout 3600 -vis_timeout 10800 -light_timeout 18000 -minimap_timeout 900 -scale_timeout 900 -timeout_stealing 0.8"
11 screenshot_override="9 900 5 +g_ctf 1"
19 for F in `git show "${commithash}:maps/"`; do
28 blobhash=`git rev-parse --revs-only "${commithash}:maps/$M.map.options" || true`-`git rev-parse --revs-only "${commithash}:maps/$M.map" || true`
35 "$@" "$M" "$blobhash" "$commithash"
49 branch=${branch##refs/heads/}
50 branch=${branch##refs/remotes/}
51 branch=${branch##origin/}
52 hash=`echo "$hash" | cut -c 1-7`
54 echo -n "[<font color=\"#FF00FF\">$branch</font> $hash] starting map compile of $map"
55 if [ -n "$lasttime_formatted" ]; then
56 echo ", last time it took $lasttime_formatted"
70 branch=${branch##refs/heads/}
71 branch=${branch##refs/remotes/}
72 branch=${branch##origin/}
73 hash=`echo "$hash" | cut -c 1-7`
77 if [ "$status" -ne 0 ]; then
78 s_error="exited with status $status"
81 if [ -n "$s_error" ]; then
82 echo "[<font color=\"#FF00FF\">$branch</font> $hash] screenshots of $map <font color=\"#FF0000\">could not be taken: $s_error</font>"
84 echo "[<font color=\"#FF00FF\">$branch</font> $hash] screenshots of $map <a href=\"$url\">are available</a>"
97 hash=`echo "$hash" | cut -c 1-7`
99 branch=${branch##refs/heads/}
100 branch=${branch##refs/remotes/}
101 branch=${branch##origin/}
108 if [ "$status" -ne 0 ]; then
109 s_error="exited with status $status"
111 while IFS= read -r L; do
113 WARNING:\ surface\ at\ *\ too\ large\ for\ desired\ samplesize*)
115 if [ -z "$s_samplesize" ] || [ "$s" -gt "$s_samplesize" ]; then
119 WARNING:\ Couldn\'t\ find\ image\ for\ shader\ textures/NULL)
122 WARNING:\ Couldn\'t\ find\ image\ for\ shader\ *)
123 s_failshaders="$s_failshaders ${L##* }"
126 if [ -z "$s_error" ]; then
130 '******* leaked *******')
133 '************ ERROR ************')
138 s_failshaders=`echo "$s_failshaders" | sed "s, textures/, ,g"`
139 s_failshaders=${s_failshaders# }
140 if [ -n "$s_error" ]; then
141 echo -n "[<font color=\"#FF00FF\">$branch</font> $hash] <font color=\"#FF0000\">failed</font>"
143 echo -n "[<font color=\"#FF00FF\">$branch</font> $hash] <font color=\"#00FF00\">finished</font>"
145 printf " map compile of <a href=\"$url\">$map</a> in %d:%02d:%02d" $((time/3600)) $((time%3600/60)) $((time%60))
146 if [ -n "$s_samplesize" ]; then
147 echo -n "<br><font color=\"#FF0000\">FIX samplesize >= $s_samplesize</font>"
149 if [ -n "$s_failshaders" ]; then
150 if [ -n "`echo "$s_failshaders" | cut -d ' ' -f 4-`" ]; then
151 s_failshaders="`echo "$s_failshaders" | cut -d ' ' -f 1-3`..."
153 echo -n "<br><font color=\"#FF0000\">FIX shaders $s_failshaders</font>"
155 if [ -n "$s_leaked" ]; then
156 echo -n "<br><font color=\"#FF0000\">FIX LEAK</font>"
158 if [ -n "$s_error" ]; then
159 s_error=`echo "$s_error" | sed "s,$PWD/\?,,g"`
160 echo -n "<br><font color=\"#FF0000\">ERROR: $s_error</font>"
172 if lwp-request -m HEAD "$url$M-$blobhash.pk3"; then
179 git checkout -f "$commithash"
181 mkdir -p ~/.xonotic-map-compiler-autobuild/ # to store map compile times in
182 lasttime=`cat ~/.xonotic-map-compiler-autobuild/"${M##*/}".buildtime 2>/dev/null || true`
183 if [ -n "$lasttime" ] ; then
184 lasttime_formatted=$(printf '%d:%02d:%02d' $((lasttime/3600)) $((lasttime%3600/60)) $((lasttime%60)) )
185 echo "Previous build took $lasttime_formatted"
187 if [ -n "$IRCSPAM" ]; then
188 pre2spam "$M" "$url$M-$blobhash.pk3" "$REFNAME" "$commithash" "$lasttime_formatted" | $IRCSPAM || true
193 # It's sad that we must enforce this rule by code.
194 if grep -- '-nosRGB' "maps/$M.map.options" >/dev/null; then
202 master|refs/heads/master|origin/master|refs/remotes/origin/master)
203 if [ -n "$IRCSPAM" ]; then
204 echo "
\ 34ERROR: map $M uses -nosRGB. This is not acceptable in master. Please fix." | $IRCSPAM || true
209 if [ -n "$IRCSPAM" ]; then
210 echo "
\ 34WARNING:
\ f map $M uses -nosRGB. This is not acceptable in master. Please fix." | $IRCSPAM || true
219 misc/tools/xonotic-map-compiler-optionsfile "data/xonotic-maps.pk3dir/maps/$M" $build_override > "data/xonotic-maps.pk3dir/maps/$M.log" 2>&1
223 if ! [ -f "maps/$M.bsp" ]; then
224 echo >>"maps/$M.log" "ERROR: No BSP file"
228 if [ -n "$IRCSPAM" ]; then
229 cat "maps/$M.log" | log2spam "$M" "$url$M-$blobhash.pk3" "$REFNAME" "$commithash" "$status" "$dt" > "maps/$M.irc"
231 if [ $status -eq 0 ]; then
232 echo "$dt" > ~/.xonotic-map-compiler-autobuild/"${M##*/}".buildtime # save time in ~/.xonotic-map-compiler-autobuild/mapname
234 zip -9r "$M-$blobhash.pk3" "maps/$M.bsp" "maps/$M.log" "maps/$M.irc" "maps/$M/" "maps/$M.lin" "gfx/${M}_mini.tga"
235 ln -snf "../$M-$blobhash.pk3" "$M.pk3" # from ALL branches, so beware!
236 cp "$M-$blobhash.pk3" "$M-full-$blobhash.pk3"
237 zip -9r "$M-full-$blobhash.pk3" `git diff --name-only --diff-filter=ACMRTUXB master...HEAD` || true
238 ln -snf "../$M-full-$blobhash.pk3" "$M-full.pk3" # from ALL branches, so beware!
239 rsync -vaSHP "$M-$blobhash.pk3" "$M-full-$blobhash.pk3" "$url_ssh"
240 rsync -vaSHP "$M.pk3" "$M-full.pk3" "$url_ssh""latest/"
241 if [ -n "$IRCSPAM" ]; then
242 $IRCSPAM < "maps/$M.irc" || true
244 if [ -n "$BUILD_ONE" ]; then
256 if ! [ -f "$bspdir/$M-$blobhash.pk3" ]; then
261 if lwp-request -m HEAD "$url$M-$blobhash/$M-000000.jpg"; then
266 if ! unzip -l "$bspdir/$M-$blobhash.pk3" "maps/$M.bsp"; then
271 rm -rf ~/.xonotic/data
272 mkdir -p ~/.xonotic/data
275 if [ -n "$DISPLAY" ]; then
276 misc/tools/xonotic-map-screenshot "$M" $screenshot_override $DRIVERFLAGS +"scr_screenshot_name \"$M-\""
280 startx "$PWD/misc/tools/xonotic-map-screenshot" "$M" $screenshot_override $DRIVERFLAGS +"scr_screenshot_name \"$M-\"" -- :8
283 startx "$PWD/misc/tools/xonotic-map-screenshot" "$M" $screenshot_override +"vid_soft 1" $DRIVERFLAGS +"scr_screenshot_name \"$M-\"" -- /usr/bin/Xvfb :8 -screen 0 1024x768x24
287 ) 2>&1 | tee ~/.xonotic/data/autoscreenshot.log
289 if mv ~/.xonotic/data/screenshots "$M-$blobhash"; then
290 ss2spam "$M" "$url$M-$blobhash/" "$REFNAME" "$commithash" 0 > ~/.xonotic/data/"$M.ircss"
293 ss2spam "$M" "$url$M-$blobhash/" "$REFNAME" "$commithash" 1 > ~/.xonotic/data/"$M.ircss"
295 mv ~/.xonotic/data/"$M.ircss" "$M-$blobhash"/
296 mv ~/.xonotic/data/autoscreenshot.log "$M-$blobhash"/
297 chmod 1777 "$M-$blobhash"
298 ln -snf "../$M-$blobhash" "$M" # from ALL branches, so beware!
299 rsync -vaSHP "$M-$blobhash" "$url_ssh"
300 rsync -vaSHP "$M" "$url_ssh""latest/"
301 if [ -n "$IRCSPAM" ]; then
302 # It takes about 5 minutes for the server to update.
303 sleep 360 # Cut it one more minute of slack.
305 $IRCSPAM < "$M-$blobhash/$M.ircss" || true
307 if [ -n "$BUILD_ONE" ]; then
320 if mv "$bspdir_old/$M-$blobhash.pk3" "$bspdir/$M-$blobhash.pk3"; then
321 if unzip -l "$bspdir/$M-$blobhash.pk3" >/dev/null 2>&1; then
325 if ! wget -c -O "$bspdir/$M-$blobhash.pk3" "$url$M-$blobhash.pk3"; then
326 if ! curl -Lo "$bspdir/$M-$blobhash.pk3" "$url$M-$blobhash.pk3"; then
327 rm -f "$bspdir/$M-$blobhash.pk3"
328 echo "WARNING: could not download $url$M-$blobhash.pk3, maybe not ready yet"
333 if ! unzip -l "$bspdir/$M-$blobhash.pk3"; then
334 rm -f "$bspdir/$M-$blobhash.pk3"
335 echo "WARNING: could not download $url$M-$blobhash.pk3, invalid zip file"
347 echo "$M $blobhash $commithash $REFNAME"
352 mkdir -p "$bspdir" "$bspdir.old"
353 for b in "$bspdir"/*-????????????????????????????????????????-????????????????????????????????????????.pk3; do
355 mv "$b" "$bspdir.old"/
358 allmaps "HEAD" getthemap "$url_http" "$bspdir.old" "$bspdir"
363 git for-each-ref 'refs/remotes' | grep -vE ' refs/remotes/([^/]*/HEAD|.*/archived/.*)$'
368 cd data/xonotic-maps.pk3dir
369 branches | while read -r HASH TYPE REFNAME; do
370 allmaps "$HASH" indexthemap "$REFNAME"
377 cd data/xonotic-maps.pk3dir
378 branches | while read -r HASH TYPE REFNAME; do
379 if [ -f "$build_cachedir/$HASH" ]; then
382 allmaps "$HASH" buildthemap "$REFNAME" "$url_http"
383 touch "$build_cachedir/$HASH"
385 git checkout -f master
388 runmakeindex > "branches.idx.new"
389 rsync -vaSHP "branches.idx.new" "$url_ssh""branches.idx.new"
390 rm -f "branches.idx.new"
391 cd data/xonotic-maps.pk3dir
392 branches | while read -r HASH TYPE REFNAME; do
393 if [ -f "$screenshot_cachedir/$HASH" ]; then
399 git checkout -f "$HASH"
404 allmaps "$HASH" screenshotthemap "$REFNAME" "$url_http"
406 if $getthemap_fail; then
407 # If any map fetch failed, we've skipped them and thus need to try again later.
408 # Note that we're not going to re-screenshot maps because of this as we'll check for uploaded screenshots first.
412 touch "$screenshot_cachedir/$HASH"
414 git checkout -f master
420 if ! which unzip >/dev/null 2>&1; then
421 echo "Cannot find unzip, bailing out"
424 if ! cd data/xonotic-maps.pk3dir >/dev/null 2>&1; then
425 echo "data/xonotic-maps.pk3dir does not exist, not downloading"
430 echo "List of maps that got deleted (if any) and currently are in $bspdir.old:"
431 ls -l "$bspdir.old" || true
436 rm -f *-????????????????????????????????????????-????????????????????????????????????????.pk3
437 wget -r -l1 -A "*.pk3" -N --no-parent --no-directories "$url_http""latest"
440 log2spam "mapname" "http://mapurl" "branch" "commit" "0"