enter()
{
- $2 cd "$1"
+ $2 cd "$1" || exit 1
check_mergeconflict "$1"
}
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
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=
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
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
;;
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/}"
--- /dev/null
+#!/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
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 = '';
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';
{
$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')
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!/[^/]*(?:$)!!;
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/"
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=
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
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
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!
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
}