]> git.xonotic.org Git - xonotic/xonotic.git/commitdiff
Merge remote branch 'origin/master' into divVerent/crypto2
authorRudolf Polzer <divverent@alientrap.org>
Fri, 23 Jul 2010 06:44:40 +0000 (08:44 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Fri, 23 Jul 2010 06:44:40 +0000 (08:44 +0200)
all
copy-gitattributes-to-branches.sh [new file with mode: 0755]
misc/tools/xonotic-map-compiler
misc/tools/xonotic-map-compiler-autobuild

diff --git a/all b/all
index d85c09701ec77e6c6f76fb28d4c6098e383693b8..f841911a6cec2c635ab47101f1dc6a2c4112abd0 100755 (executable)
--- a/all
+++ b/all
@@ -104,7 +104,7 @@ yesno()
 
 enter()
 {
-       $2 cd "$1"
+       $2 cd "$1" || exit 1
        check_mergeconflict "$1"
 }
 
@@ -200,6 +200,8 @@ case "$cmd" in
                                        verbose git config remote.origin.url "$url"
                                        verbose git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
 
+                                       verbose git config remote.origin.autocrlf input
+
                                        r=`git symbolic-ref HEAD`
                                        r=${r#refs/heads/}
                                        if git config branch.$r.remote >/dev/null 2>&1; then
@@ -320,7 +322,7 @@ case "$cmd" in
        branches)
                for d in $repos; do
                        cd "$d0/$d" # am in a pipe, shouldn't use enter
-                       git branch -a -v -v | cut -c 3- | sed "s,^,$d ,"
+                       git branch -a -v -v | cut -c 3- | sed "s/^(no branch)/(no_branch)/" | sed "s,^,$d ,"
                        cd "$d0"
                done | {
                        branches_list=
@@ -461,22 +463,37 @@ case "$cmd" in
                                cleanqc=true # version info
                                ;;
                esac
-               if [ -n "$1" ]; then
+               if [ $# -gt 0 ] && [ x"$1" = x"" ]; then
+                       # if we give the command make the arg "", it will surely fail (invalid filename),
+                       # so better handle it as an empty client option
+                       BAD_TARGETS=" "
+                       shift
+               elif [ -n "$1" ]; then
+                       BAD_TARGETS=
+                       TARGETS_SAVE=$TARGETS
                        TARGETS=
                        for X in $1; do
                                case "$X" in
                                        sdl)
-                                               TARGETS="sdl-debug $TARGETS"
+                                               TARGETS="$TARGETS sdl-debug"
                                                ;;
                                        glx|agl|wgl)
-                                               TARGETS="cl-debug $TARGETS"
+                                               TARGETS="$TARGETS cl-debug"
                                                ;;
                                        dedicated)
-                                               TARGETS="sv-debug $TARGETS"
+                                               TARGETS="$TARGETS sv-debug"
+                                               ;;
+                                       *)
+                                               BAD_TARGETS="$BAD_TARGETS $X"
                                                ;;
                                esac
                        done
-                       shift
+                       if [ -n "$TARGETS" ]; then # at least a valid client
+                               shift
+                       else # no valid client, let's assume this option is not meant to be a client then
+                               TARGETS=$TARGETS_SAVE
+                               BAD_TARGETS=
+                       fi
                fi
                if [ -z "$MAKEFLAGS" ]; then
                        if [ -f /proc/cpuinfo ]; then
@@ -518,12 +535,18 @@ case "$cmd" in
                verbose make FTEQCC="$d0/fteqcc/fteqcc.bin" "$@" $MAKEFLAGS
 
                enter "$d0/darkplaces" verbose
+               if [ x"$BAD_TARGETS" = x" " ]; then
+                       echo "Warning: invalid empty client, default clients will be used."
+               fi
                if $cleandp; then
                        verbose make $MAKEFLAGS clean
                fi
                for T in $TARGETS; do
                        verbose make $MAKEFLAGS "$@" "$T"
                done
+               for T in $BAD_TARGETS; do
+                       echo "Warning: discarded invalid client $T."
+               done
 
                verbose "$SELF" update-maps
                ;;
@@ -742,7 +765,7 @@ case "$cmd" in
                                                        reportecho4 "--> compile failed"
                                                elif ! yesno "Still merge \"$ref\" into `git symbolic-ref HEAD` of $d? Maybe you want to test first."; then
                                                        git reset --hard "$org"
-                                                       git notes edit "$ref"
+                                                       GIT_NOTES_REF=refs/notes/admin-merge git notes edit "$ref"
                                                        note=`GIT_NOTES_REF=refs/notes/admin-merge git notes show "$ref" 2>/dev/null || true`
                                                        if [ x"$note" = x"del" ]; then
                                                                git push origin :"${ref#refs/remotes/origin/}"
diff --git a/copy-gitattributes-to-branches.sh b/copy-gitattributes-to-branches.sh
new file mode 100755 (executable)
index 0000000..dd6c51e
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+case "$0" in
+       /*)
+               me=$0
+               ;;
+       *)
+               me="$PWD/$0"
+               ;;
+esac
+export me
+
+case "$1" in
+       inner)
+               git config core.autocrlf input
+               git reset --hard
+               git for-each-ref 'refs/remotes/origin' | while read -r HASH TYPE REFNAME; do
+                       case "$REFNAME" in
+                               refs/remotes/origin/HEAD)
+                                       continue
+                                       ;;
+                       esac
+                       git checkout -t "${REFNAME#refs/remotes/}" || git checkout "${REFNAME#refs/remotes/origin/}"
+                       git reset --hard "$REFNAME"
+                       echo "$attr" > ".gitattributes"
+                       find . -type f -exec touch {} \+
+                       git update-index --refresh
+                       git add .gitattributes
+                       git commit -a -m"CRLF fixes, .gitattributes file updated"
+               done
+               git checkout master
+               true
+               ;;
+       *)
+               attr=`cat .gitattributes`
+               export attr
+               ./all each "$me" inner
+               ./all checkout
+               ;;
+esac
index e86fd887096f4de1a7338853c81286f4b3c55013..427ee97103200293a248bcd4f57ebb6a6271a207 100755 (executable)
@@ -25,7 +25,7 @@ use File::Temp;
        our $VISFLAGS    = '';
 
        # Default flags for the -light stage
-       our $LIGHTFLAGS  = '-deluxe -patchshadows -samples 3 -lightmapsize 512';
+       our $LIGHTFLAGS  = '-deluxe -patchshadows -samples 3 -lightmapsize 512 -fast -fastbounce -dirty';
 
        # Default flags for the -minimap stage
        our $MINIMAPFLAGS = '';
@@ -55,7 +55,12 @@ my $options =
        scale => [], # can't have defaults atm
        order => [split /\s*,\s*/, $ORDER],
        maps => [],
-       scale => 1
+       scale => 1,
+       bsp_timeout => 0,
+       vis_timeout => 0,
+       light_timeout => 0,
+       minimap_timeout => 0,
+       scale_timeout => 0
 };
 
 my $curmode = 'maps';
@@ -105,10 +110,40 @@ while(@ARGV)
        {
                $options->{noshaderlist} = 1;
        }
+       elsif($_ eq '-bsp_timeout')
+       {
+               $options->{bsp_timeout} = shift @ARGV;
+       }
+       elsif($_ eq '-vis_timeout')
+       {
+               $options->{vis_timeout} = shift @ARGV;
+       }
+       elsif($_ eq '-light_timeout')
+       {
+               $options->{light_timeout} = shift @ARGV;
+       }
+       elsif($_ eq '-minimap_timeout')
+       {
+               $options->{minimap_timeout} = shift @ARGV;
+       }
+       elsif($_ eq '-scale_timeout')
+       {
+               $options->{minimap_timeout} = shift @ARGV;
+       }
        elsif($_ eq '-order')
        {
                $options->{order} = [split /\s*,\s*/, shift @ARGV];
        }
+       elsif($_ =~ /^--no(-.*)/)
+       {
+               if($curmode eq 'maps')
+               {
+                       $curmode = 'bsp';
+               }
+               my $flag = $1;
+               @{$options->{$curmode}} = grep { (($_ eq $flag) ... /^-/) !~ /^[0-9]+$/ } @{$options->{$curmode}};
+                       # so, e.g. --no-samplesize removes "-samplesize" and a following "3"
+       }
        elsif($_ =~ /^-(-.*)/)
        {
                if($curmode eq 'maps')
@@ -144,9 +179,35 @@ my $linkdir = File::Temp::tempdir("xonotic-map-compiler.XXXXXX", TMPDIR => 1, CL
 
 sub q3map2(@)
 {
+       my $mode = $_[0];
+       my $timeout = undef;
+       $timeout = $options->{bsp_timeout} if $mode eq '-bsp';
+       $timeout = $options->{vis_timeout} if $mode eq '-vis';
+       $timeout = $options->{light_timeout} if $mode eq '-light';
+       $timeout = $options->{minimap_timeout} if $mode eq '-minimap';
+       $timeout = $options->{scale_timeout} if $mode eq '-scale';
+       die "Invalid call: not a standard q3map2 stage" if not defined $timeout;
        my @args = ($Q3MAP2, split(/\s+/, $Q3MAP2FLAGS), '-game', 'xonotic', '-fs_basepath', $XONOTICDIR, '-fs_basepath', $linkdir, '-v', @_);
        print "\$ @args\n";
-       return !system @args;
+       defined(my $pid = fork())
+               or die "fork: $!";
+       if($pid) # parent
+       {
+               local $SIG{ALRM} = sub { warn "SIGALRM caught\n"; kill TERM => $pid; };
+               alarm $timeout
+                       if $timeout;
+               if(waitpid($pid, 0) != $pid)
+               {
+                       die "waitpid: did not return our child process $pid: $!";
+               }
+               alarm 0;
+               return ($? == 0);
+       }
+       else # child
+       {
+               exec @args
+                       or die "exec: $!";
+       }
 }
 
 (my $mapdir = getcwd()) =~ s!/[^/]*(?:$)!!;
index 212d0a9656cdd6137a23e13d0826bc9cbdeebc19..dcce6abc577abc4bf2381b103f96f43753b284c1 100755 (executable)
@@ -4,6 +4,7 @@ set -e
 
 bspdir="$PWD/data"
 url=http://141.2.16.23/~xonotic/bsp-autobuilds/
+override="-bsp_timeout 900 -vis_timeout 3600 -light_timeout 14400 -minimap_timeout 900 -scale_timeout 900"
 
 bspoutdir="$HOME/public_html/bsp-autobuilds/"
 
@@ -45,12 +46,14 @@ log2spam()
        branch=$3
        hash=$4
        status=$5
+       time=$6
+
+       hash=`echo "$hash" | cut -c 1-7`
 
        branch=${branch##refs/heads/}
        branch=${branch##refs/remotes/}
        branch=${branch##origin/}
 
-       s_time=
        s_samplesize=
        s_failshaders=
        s_leaked=
@@ -61,9 +64,6 @@ log2spam()
        fi
        while IFS= read -r L; do
                case "$L" in
-                       *\ seconds\ elapsed)
-                               s_time=$(($s_time + ${L%% seconds elapsed}))
-                               ;;
                        WARNING:\ surface\ at\ *\ too\ large\ for\ desired\ samplesize*)
                                s=${L##* }
                                if [ -z "$s_samplesize" ] || [ "$s" -gt "$s_samplesize" ]; then
@@ -91,7 +91,7 @@ log2spam()
        else
                echo -n "[$branch $hash] finished"
        fi
-       echo -n " map compile of $map ($url): $s_time sec"
+       echo -n " map compile of $map ($url): $time sec"
        if [ -n "$s_samplesize" ]; then
                echo -n ", FIX samplesize >= $s_samplesize"
        fi
@@ -125,13 +125,16 @@ buildthemap()
        if [ -n "$IRCSPAM" ]; then
                pre2spam "$M" "$url$M-$blobhash.pk3" "$REFNAME" "$HASH" | $IRCSPAM
        fi
+       t0=`date +%s`
        (
                cd maps
-               ../../../misc/tools/xonotic-map-compiler "$M" `grep ^- "$M.map.options" | cut -d '#' -f 1` 2>&1 | tee "$M.log"
+               ../../../misc/tools/xonotic-map-compiler "$M" `grep ^- "$M.map.options" | cut -d '#' -f 1` $override > "$M.log"
        )
+       t1=`date +%s`
+       dt=$(($t1 - $t0))
        status=$?
        if [ -n "$IRCSPAM" ]; then
-               cat "maps/$M.log" | log2spam "$M" "$url$M-$blobhash.pk3" "$REFNAME" "$HASH" "$status" > "maps/$M.irc"
+               cat "maps/$M.log" | log2spam "$M" "$url$M-$blobhash.pk3" "$REFNAME" "$HASH" "$status" "$dt" > "maps/$M.irc"
        fi
        zip -9r "$bspdir/$M-$blobhash.pk3" "maps/$M.bsp" "maps/$M.log" "maps/$M.irc" "maps/$M/" "maps/$M.lin" "gfx/${M}_mini.tga"
        ln -snf "../$M-$blobhash.pk3" "$bspdir/latest/$M.pk3" # from ALL branches, so beware!
@@ -153,12 +156,12 @@ getthemap()
        if ! wget -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"
-               return 1
+               return 0
        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"
-               return 1
+               return 0
        fi
 }