2010-03-18 15:46:07 +00:00
#!/bin/sh
2010-04-16 17:41:05 +00:00
# vim: filetype=zsh
2010-03-18 15:46:07 +00:00
set -e
2010-05-15 20:53:45 +00:00
# I use this in EVERY shell script ;)
LF="
"
2010-10-15 10:49:37 +00:00
ESC=" "
2010-05-15 20:53:45 +00:00
2010-04-02 18:34:05 +00:00
d00=`pwd`
while ! [ -f ./all ]; do
if [ x"`pwd`" = x"/" ]; then
echo "Cannot find myself."
echo "Please run this script with the working directory inside a Xonotic checkout."
exit 1
fi
cd ..
done
2010-08-05 04:11:40 +00:00
export d0=`pwd`
2010-04-02 18:34:05 +00:00
SELF="$d0/all"
# If we are on WINDOWS:
case "$0" in
all|*/all)
case "`uname`" in
2010-04-11 10:23:32 +00:00
MINGW*|Win*)
2010-04-02 18:34:05 +00:00
# Windows hates users. So this script has to copy itself elsewhere first...
2010-04-02 18:35:19 +00:00
cp "$SELF" ../all.xonotic.sh
2010-04-25 18:21:54 +00:00
export WE_HATE_OUR_USERS=1
2010-04-02 18:34:05 +00:00
exec ../all.xonotic.sh "$@"
;;
esac
;;
esac
2010-03-29 13:21:24 +00:00
msg()
{
2010-10-15 10:49:37 +00:00
echo >&2 "$ESC[1m$*$ESC[m"
2010-03-29 13:21:24 +00:00
}
2010-06-22 15:05:06 +00:00
self=`git hash-object "$SELF"`
2010-03-29 13:21:24 +00:00
checkself()
{
2010-06-22 15:05:06 +00:00
self_new=`git hash-object "$SELF"`
2010-03-29 13:21:24 +00:00
if [ x"$self" != x"$self_new" ]; then
msg "./all has changed."
if [ -z "$XONOTIC_FORBID_RERUN_ALL" ]; then
msg "Rerunning the requested operation to make sure."
export XONOTIC_FORBID_RERUN_ALL=1
2010-04-02 18:34:05 +00:00
exec "$SELF" "$@"
2010-03-29 13:21:24 +00:00
else
2010-04-02 18:34:05 +00:00
msg "Please try $SELF update, and then retry your requested operation."
2010-03-29 13:21:24 +00:00
exit 1
fi
fi
2010-03-29 13:24:49 +00:00
return 0
2010-03-29 13:21:24 +00:00
}
2010-03-29 13:17:50 +00:00
2010-03-26 08:18:04 +00:00
verbose()
{
2010-03-29 13:21:24 +00:00
msg "+ $*"
2010-03-26 08:18:04 +00:00
"$@"
}
2010-04-02 19:25:08 +00:00
visible_repo_name()
{
case "$1" in
.)
echo "the root directory"
;;
*)
echo "\"$1\""
;;
esac
}
2010-04-02 19:11:17 +00:00
check_mergeconflict()
{
if git ls-files -u | grep ' 1 '; then
echo
echo "MERGE CONFLICT."
echo "change into the \"$1\" project directory, and then:"
echo "- edit the files mentioned above with your favorite editor,"
echo " and fix the conflicts (marked with <<<<<<< blocks)"
echo "- for binary files, you can select the files using"
echo " git checkout --ours or git checkout --theirs"
echo "- when done with a file, 'git add' the file"
echo "- when done, 'git commit'"
echo
exit 1
fi
}
2010-05-09 17:40:25 +00:00
yesno()
{
yesno=
while [ x"$yesno" != x"y" -a x"$yesno" != x"n" ]; do
2010-05-15 18:11:23 +00:00
eval "$2"
2010-05-09 17:40:25 +00:00
echo "$1"
IFS= read -r yesno
done
[ x"$yesno" = x"y" ]
}
2010-04-02 19:11:17 +00:00
enter()
{
2010-07-18 15:18:15 +00:00
$2 cd "$1" || exit 1
2010-04-02 19:11:17 +00:00
check_mergeconflict "$1"
}
2010-03-26 07:59:06 +00:00
repos_urls="
2010-05-15 20:24:38 +00:00
. | | master |
data/xonotic-data.pk3dir | | master |
data/xonotic-music.pk3dir | | master |
2010-08-25 04:59:52 +00:00
data/xonotic-nexcompat.pk3dir | | master | no
2010-05-15 20:24:38 +00:00
darkplaces | | div0-stable | svn
netradiant | | master |
2010-09-25 08:15:37 +00:00
div0-gittools | | master | no
2010-10-16 09:08:38 +00:00
d0_blind_id | http://github.com/divVerent/d0_blind_id.git | master |
2010-09-25 08:15:37 +00:00
data/xonotic-maps.pk3dir | | master |
mediasource | | master | no
2010-10-16 09:08:38 +00:00
fteqcc | http://github.com/Blub/qclib.git | master |
2010-03-18 15:46:07 +00:00
"
2010-05-02 11:06:36 +00:00
# todo: in darkplaces, change repobranch to div0-stable
2010-03-18 15:46:07 +00:00
2010-05-02 11:06:36 +00:00
repos=`echo "$repos_urls" | grep . | cut -d '|' -f 1 | tr -d ' '`
base=`git config remote.origin.url`
2010-05-10 06:39:45 +00:00
case "$base" in
*/xonotic.git)
base=${base%xonotic.git}
;;
*)
echo "The main repo is not xonotic.git, what have you done?"
exit 1
;;
esac
2010-10-04 10:13:01 +00:00
pushbase=`git config remote.origin.pushurl || true`
case "$pushbase" in
*/xonotic.git)
pushbase=${pushbase%xonotic.git}
;;
'')
;;
*)
echo "The main repo is not xonotic.git, what have you done?"
exit 1
;;
esac
2010-05-02 11:06:36 +00:00
repourl()
{
2010-07-04 19:37:09 +00:00
repo_t=`echo "$repos_urls" | grep "^$1 " | cut -d '|' -f 2 | tr -d ' '`
if [ -n "$repo_t" ]; then
case "$repo_t" in
2010-05-08 16:45:50 +00:00
*://*)
2010-07-04 19:37:09 +00:00
echo "$repo_t"
2010-05-08 16:45:50 +00:00
;;
*)
2010-07-04 19:37:09 +00:00
echo "$base$repo_t"
2010-05-08 16:45:50 +00:00
;;
esac
2010-05-02 11:06:36 +00:00
else
if [ x"$1" = x"." ]; then
echo "$base""xonotic.git"
else
echo "$base${1##*/}.git"
2010-04-26 12:10:54 +00:00
fi
2010-05-02 11:06:36 +00:00
fi
}
2010-04-26 12:10:54 +00:00
2010-10-04 10:13:01 +00:00
repopushurl()
{
[ -n "$pushbase" ] || return 0
repo_t=`echo "$repos_urls" | grep "^$1 " | cut -d '|' -f 2 | tr -d ' '`
if [ -n "$repo_t" ]; then
case "$repo_t" in
*://*)
;;
*)
echo "$pushbase$repo_t"
;;
esac
else
if [ x"$1" = x"." ]; then
echo "$pushbase""xonotic.git"
else
echo "$pushbase${1##*/}.git"
fi
fi
}
2010-05-02 11:06:36 +00:00
repobranch()
{
2010-07-04 19:37:09 +00:00
repo_t=`echo "$repos_urls" | grep "^$1 " | cut -d '|' -f 3 | tr -d ' '`
if [ -n "$repo_t" ]; then
echo "$repo_t"
2010-05-02 11:06:36 +00:00
else
echo "master"
fi
}
2010-05-15 20:24:38 +00:00
repoflags()
{
echo "$repos_urls" | grep "^$1 " | cut -d '|' -f 4 | tr -d ' '
}
2010-08-25 04:59:52 +00:00
listrepos()
{
for d in $repos; do
p="${d%dir}"
f="`repoflags "$d"`"
# if we have the dir, always keep it
if [ -d "$d" ]; then
msg "Repository $d enabled because it already exists"
echo "$d"
continue
fi
# if .yes file exists, always keep it
if [ -f "$d.yes" ]; then
msg "Repository $d enabled by a .yes file"
echo "$d"
continue
fi
# if we have .no file, skip
if [ -f "$d.no" ]; then
msg "Repository $d disabled by a .no file, delete $p.no to enable"
continue
fi
# if we have matching pk3, skip
if [ x"$p" != x"$d" ] && [ -f "$p" ]; then
msg "Repository $d disabled by matching .pk3 file, delete $p or create $d.yes to enable"
continue
fi
# if "no" flag is set, skip
case ",$f," in
*,no,*)
msg "Repository $d disabled by default, create $d.yes to enable"
continue
;;
esac
2010-08-25 05:56:00 +00:00
# default: enable
msg "Repository $d enabled by default"
2010-05-02 11:06:36 +00:00
echo "$d"
2010-08-25 04:59:52 +00:00
done
}
repos=`listrepos`
2010-03-26 07:59:06 +00:00
2010-03-18 15:57:21 +00:00
if [ "$#" = 0 ]; then
set -- help
fi
2010-03-18 15:46:07 +00:00
cmd=$1
shift
2010-08-04 10:26:57 +00:00
fix_upstream_rebase()
{
if [ -z "$r_me" ] || [ -z "$r_other" ]; then
return
fi
r_base=`git merge-base "$r_me" "$r_other"`
# no merge-base? upstream did filter-branch
if [ -n "$r_base" ]; then
# otherwise, check if the two histories are "similar"
2010-08-04 10:40:57 +00:00
r_l_me=`git log --pretty="format:%s" "$r_other".."$r_me" | grep -v "^Merge" | sort -u`
r_l_other=`git log --pretty="format:%s" "$r_me".."$r_other" | grep -v "^Merge" | sort -u`
2010-08-04 10:26:57 +00:00
# heuristics: upstream rebase/filter-branch if more than 50% of the commits of one of the sides are in the other too
r_lc_me=`echo "$r_l_me" | wc -l`
r_lc_other=`echo "$r_l_other" | wc -l`
r_lc_together=`{ echo "$r_l_me"; echo "$r_l_other"; } | sort -u | wc -l`
r_lc_same=$(($r_lc_me + $r_lc_other - $r_lc_together))
2010-08-04 10:39:44 +00:00
if [ $(( $r_lc_same * 2 )) -gt $(( $r_lc_me )) ] || [ $(( $r_lc_same * 2 )) -gt $(( $r_lc_other )) ]; then
if yesno "Probable upstream rebase detected, automatically fix?" 'git log --oneline --graph --date-order --left-right "$r_other"..."$r_me"'; then
2010-08-04 10:26:57 +00:00
git reset --hard "$r_me"
git pull --rebase
return 1
fi
fi
fi
return 0
}
fix_upstream_rebase_mergeok()
{
r_me=`git rev-parse --revs-only HEAD^1 2>/dev/null || true`
r_other=`git rev-parse --revs-only HEAD^2 2>/dev/null || true`
fix_upstream_rebase
}
fix_upstream_rebase_mergefail()
{
r_me=`git rev-parse --revs-only HEAD 2>/dev/null || true`
r_other=`git rev-parse --revs-only MERGE_HEAD 2>/dev/null || true`
fix_upstream_rebase
}
2010-08-25 05:02:39 +00:00
fix_git_config()
{
2010-10-04 13:05:47 +00:00
verbose git config remote.origin.url "$1"
if [ -n "$2" ]; then
verbose git config remote.origin.pushurl "$2"
else
verbose git config --unset remote.origin.pushurl || true
fi
verbose git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
2010-08-25 05:02:39 +00:00
verbose git config core.autocrlf input
2010-10-21 18:22:10 +00:00
if [ -z "`git config push.default || true`" ]; then
2010-08-25 05:02:39 +00:00
verbose git config push.default current # or is tracking better?
fi
2010-10-23 15:34:37 +00:00
verbose git config filter.mapclean.clean "tr -d '\r' | grep '^[^/]'"
2010-10-21 18:22:35 +00:00
verbose git config filter.mapclean.smudge "cat"
2010-08-25 05:02:39 +00:00
}
2010-09-16 06:41:57 +00:00
mkzip()
{
archive=$1
shift
ziplist=`mktemp`
2010-09-16 07:04:52 +00:00
find "$@" -xtype f \( -executable -or -type l \) -print > "$ziplist"
2010-09-16 08:48:26 +00:00
7za a -tzip -mx=9 -x@"$ziplist" "$archive" "$@" || true
zip -9y -@<"$ziplist" "$archive" || true
2010-09-16 06:41:57 +00:00
rm -f "$ziplist"
}
mkzip0()
{
zip -0y "$@"
}
2010-03-18 15:46:07 +00:00
case "$cmd" in
2010-08-04 10:26:57 +00:00
fix_upstream_rebase)
for d in $repos; do
2010-08-04 10:34:36 +00:00
enter "$d0/$d" verbose
verbose fix_upstream_rebase_mergefail && verbose fix_upstream_rebase_mergeok
2010-08-04 10:26:57 +00:00
done
;;
2010-10-04 13:30:03 +00:00
fix_config)
for d in $repos; do
url=`repourl "$d"`
pushurl=`repopushurl "$d"`
branch=`repobranch "$d"`
if [ -d "$d0/$d" ]; then
2010-10-06 10:10:42 +00:00
verbose cd "$d0/$d"
2010-10-04 13:30:03 +00:00
fix_git_config "$url" "$pushurl"
cd "$d0"
fi
done
;;
2010-10-16 09:27:14 +00:00
keygen)
# enable the ssh URL for pushing
"$SELF" update -N -p
if [ -f ~/.ssh/id_rsa.pub ]; then
msg ""
msg "A key already exists and no new one will be generated. If you"
msg "already have done the procedure for getting your key approved, you"
msg "can skip the following paragraph and already use the repository."
msg ""
msg "To get access, your key has to be approved first. For that, visit"
msg "http://dev.xonotic.org/, then log in, create a \"New Issue\" on"
msg "the \"Support\" tracker in the \"Repository\" category where you"
2010-10-16 09:29:42 +00:00
msg "apply for access and paste the following output into the issue:"
2010-10-16 09:27:14 +00:00
msg ""
msg "`cat ~/.ssh/id_rsa.pub`"
2010-10-16 09:27:59 +00:00
msg ""
msg "Note that you will only have write access to branches that start"
msg "with your user name."
2010-10-16 09:27:14 +00:00
elif [ -f ~/.ssh/id_dsa.pub ]; then
msg ""
msg "A key already exists and no new one will be generated. If you"
msg "already have done the procedure for getting your key approved, you"
msg "can skip the following paragraph and already use the repository."
msg ""
msg "To get access, your key has to be approved first. For that, visit"
msg "http://dev.xonotic.org/, then log in, create a \"New Issue\" on"
msg "the \"Support\" tracker in the \"Repository\" category where you"
2010-10-16 09:29:42 +00:00
msg "apply for access and paste the following output into the issue:"
2010-10-16 09:27:14 +00:00
msg ""
msg "`cat ~/.ssh/id_dsa.pub`"
2010-10-16 09:27:59 +00:00
msg ""
msg "Note that you will only have write access to branches that start"
msg "with your user name."
2010-10-16 09:27:14 +00:00
else
msg ""
msg "No key has been generated yet. One will be generated now."
msg "If other people are using your computer, it is recommended"
2010-10-16 09:28:41 +00:00
msg "to specify a passphrase. Otherwise you can simply hit ENTER"
msg "when asked for a passphrase."
2010-10-16 09:27:14 +00:00
msg ""
2010-10-16 09:31:28 +00:00
ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa
2010-10-16 09:27:14 +00:00
msg ""
msg "To get access, your key has to be approved first. For that, visit"
msg "http://dev.xonotic.org/, then log in, create a \"New Issue\" on"
msg "the \"Support\" tracker in the \"Repository\" category where you"
2010-10-16 09:29:42 +00:00
msg "apply for access and paste the following output into the issue:"
2010-10-16 09:27:14 +00:00
msg ""
msg "`cat ~/.ssh/id_rsa.pub`"
2010-10-16 09:27:59 +00:00
msg ""
msg "Note that you will only have write access to branches that start"
msg "with your user name."
2010-10-16 09:27:14 +00:00
fi
;;
2010-03-20 13:20:07 +00:00
update|pull)
2010-05-09 13:46:17 +00:00
allow_pull=true
2010-10-16 09:14:35 +00:00
fix_config=false
2010-10-18 15:48:50 +00:00
location=current
2010-10-16 09:14:35 +00:00
while :; do
if [ x"$1" = x"-N" ]; then
allow_pull=false
elif [ x"$1" = x"-p" ]; then
fix_config=true
2010-10-16 09:27:14 +00:00
if [ x"$base" != x"ssh://xonotic@git.xonotic.org/" ]; then
pushbase=ssh://xonotic@git.xonotic.org/
fi
2010-10-16 09:14:35 +00:00
elif [ x"$1" = x"-s" ]; then
fix_config=true
base=ssh://xonotic@git.xonotic.org/
pushbase=
elif [ x"$1" = x"-g" ]; then
fix_config=true
base=git://git.xonotic.org/xonotic/
elif [ x"$1" = x"-h" ]; then
fix_config=true
base=http://git.xonotic.org/xonotic/
2010-10-18 15:48:50 +00:00
elif [ x"$1" = x"-l" ]; then
case "$2" in
nl) ;;
2010-10-18 16:11:00 +00:00
de) ;;
default) ;;
2010-10-18 15:48:50 +00:00
*)
msg "Invalid location!"
msg "Possible locations for the -l option:"
msg " nl (Netherlands, run by merlijn)"
2010-10-18 16:11:00 +00:00
msg " de (Germany, run by divVerent)"
msg " default (currently nl)"
2010-10-18 15:48:50 +00:00
exit 1
;;
esac
fix_config=true
location=$2
shift
2010-10-16 09:14:35 +00:00
else
break
fi
shift
done
2010-10-18 15:48:50 +00:00
case "$location" in
2010-10-18 16:11:00 +00:00
default)
2010-10-18 15:48:50 +00:00
location=
;;
current)
case "$base" in
*://*.git.xonotic.org/*)
location=${base%%.git.xonotic.org/*}
location=${location##*://}
;;
*)
location=
;;
esac
;;
esac
if [ -n "$location" ]; then
base=`echo "$base" | sed "s,://\(.*\.\)\?git.xonotic.org/,://$location.git.xonotic.org/,"`
pushbase=`echo "$pushbase" | sed "s,://\(.*\.\)\?git.xonotic.org/,://$location.git.xonotic.org/,"`
else
base=`echo "$base" | sed "s,://\(.*\.\)\?git.xonotic.org/,://git.xonotic.org/,"`
pushbase=`echo "$pushbase" | sed "s,://\(.*\.\)\?git.xonotic.org/,://git.xonotic.org/,"`
fi
2010-10-16 09:14:35 +00:00
if $fix_config; then
url=`repourl .`
pushurl=`repopushurl .`
fix_git_config "$url" "$pushurl"
2010-05-09 13:46:17 +00:00
fi
2010-10-16 09:14:35 +00:00
if $allow_pull || $fix_config; then
2010-10-04 13:30:03 +00:00
"$SELF" fix_config
fi
2010-05-02 11:06:36 +00:00
for d in $repos; do
url=`repourl "$d"`
2010-10-04 10:13:01 +00:00
pushurl=`repopushurl "$d"`
2010-05-02 11:06:36 +00:00
branch=`repobranch "$d"`
2010-03-18 15:46:07 +00:00
if [ -d "$d0/$d" ]; then
2010-05-09 13:46:17 +00:00
if $allow_pull; then
enter "$d0/$d" verbose
r=`git symbolic-ref HEAD`
r=${r#refs/heads/}
if git config branch.$r.remote >/dev/null 2>&1; then
if ! verbose git pull; then
2010-08-04 19:33:55 +00:00
fix_upstream_rebase_mergefail || true
2010-05-09 13:46:17 +00:00
check_mergeconflict "$d"
echo "Pulling failed. Press ENTER to continue, or Ctrl-C to abort."
read -r DUMMY
2010-08-04 10:26:57 +00:00
else
fix_upstream_rebase_mergeok || true
2010-05-09 13:46:17 +00:00
fi
2010-04-10 16:05:46 +00:00
fi
2010-05-09 13:46:17 +00:00
cd "$d00"
checkself "$cmd" "$@"
cd "$d0/$d"
verbose git remote prune origin
cd "$d0"
fi
2010-03-18 15:46:07 +00:00
else
2010-03-26 08:18:04 +00:00
verbose git clone "$url" "$d0/$d"
2010-05-02 11:06:36 +00:00
enter "$d0/$d" verbose
2010-10-04 13:05:47 +00:00
fix_git_config "$url" "$pushurl"
2010-06-05 13:08:10 +00:00
if [ "$branch" != "master" ]; then
verbose git checkout --track -b "$branch" origin/"$branch"
fi
2010-05-02 11:06:36 +00:00
cd "$d0"
2010-03-18 15:46:07 +00:00
fi
done
;;
2010-06-17 12:08:38 +00:00
update-maps)
misc/tools/xonotic-map-compiler-autobuild download
;;
2010-03-24 14:09:55 +00:00
checkout|switch)
2010-08-14 00:46:07 +00:00
checkoutflags=
if [ x"$1" = x"-f" ]; then
checkoutflags=-f
shift
fi
2010-03-18 15:46:07 +00:00
remote=$1
branch=$2
if [ -z "$branch" ]; then
2010-06-17 12:26:24 +00:00
case "$remote" in
origin/*)
branch=${remote#origin/}
remote=origin
;;
*)
branch=$remote
remote=origin
;;
esac
2010-03-18 15:46:07 +00:00
fi
exists=false
for d in $repos; do
2010-04-15 09:38:55 +00:00
enter "$d0/$d" verbose
2010-06-17 07:20:26 +00:00
b=$branch
if [ -n "$b" ] && git rev-parse "refs/heads/$b" >/dev/null 2>&1; then
2010-03-18 15:46:07 +00:00
exists=true
2010-08-14 00:46:07 +00:00
verbose git checkout $checkoutflags "$b"
2010-06-17 07:20:26 +00:00
elif [ -n "$b" ] && git rev-parse "refs/remotes/$remote/$b" >/dev/null 2>&1; then
2010-03-18 15:46:07 +00:00
exists=true
2010-08-14 00:46:07 +00:00
verbose git checkout $checkoutflags --track -b "$b" "$remote/$b"
2010-03-18 15:46:07 +00:00
else
2010-06-17 07:20:26 +00:00
b=`repobranch "$d"`
if git rev-parse "refs/heads/$b" >/dev/null 2>&1; then
exists=true
2010-08-14 00:46:07 +00:00
verbose git checkout $checkoutflags "$b"
2010-06-17 07:20:26 +00:00
elif git rev-parse "refs/remotes/$remote/$b" >/dev/null 2>&1; then
exists=true
2010-08-14 00:46:07 +00:00
verbose git checkout $checkoutflags --track -b "$b" "$remote/$b"
2010-06-17 07:20:26 +00:00
else
echo "WTF? Not even branch $b doesn't exist in $d"
exit 1
fi
2010-03-18 15:46:07 +00:00
fi
2010-04-02 18:14:19 +00:00
cd "$d00"
2010-04-02 21:14:58 +00:00
checkself "$cmd" "$@"
2010-04-02 18:14:19 +00:00
cd "$d0"
2010-03-18 15:46:07 +00:00
done
2010-03-26 08:18:04 +00:00
if ! $exists; then
echo "The requested branch was not found in any repository."
fi
2010-04-02 18:34:05 +00:00
exec "$SELF" branch
2010-03-18 15:46:07 +00:00
;;
branch)
2010-03-20 13:23:39 +00:00
remote=$1
branch=$2
2010-04-05 11:48:23 +00:00
srcbranch=$3
2010-03-20 13:23:39 +00:00
if [ -z "$branch" ]; then
branch=$remote
remote=origin
fi
if [ -z "$branch" ]; then
2010-03-20 13:14:50 +00:00
for d in $repos; do
2010-04-02 19:11:17 +00:00
enter "$d0/$d"
2010-03-20 13:14:50 +00:00
r=`git symbolic-ref HEAD`
r=${r#refs/heads/}
echo "$d is at $r"
cd "$d0"
done
else
for d in $repos; do
2010-04-02 19:25:08 +00:00
dv=`visible_repo_name "$d"`
2010-04-15 09:38:55 +00:00
enter "$d0/$d" verbose
2010-04-26 09:10:04 +00:00
if git rev-parse "refs/heads/$branch" >/dev/null 2>&1; then
echo "Already having this branch in $dv."
else
2010-05-09 17:40:25 +00:00
if yesno "Branch in $dv?"; then
2010-05-02 11:06:36 +00:00
if [ -n "$srcbranch" ]; then
b=$srcbranch
else
2010-05-23 12:12:54 +00:00
b=origin/"`repobranch "$d"`"
verbose git fetch origin || true
2010-05-02 11:06:36 +00:00
fi
2010-05-04 05:31:37 +00:00
# TODO do this without pushing
2010-05-23 12:51:44 +00:00
verbose git checkout -b "$branch" "$b"
verbose git config "branch.$branch.remote" "$remote"
2010-05-25 11:01:32 +00:00
verbose git config "branch.$branch.merge" "refs/heads/$branch"
2010-04-26 09:10:04 +00:00
fi
2010-03-20 13:14:50 +00:00
fi
cd "$d0"
done
2010-04-02 18:34:05 +00:00
"$SELF" branch
2010-03-20 13:14:50 +00:00
fi
2010-03-18 15:46:07 +00:00
;;
branches)
2010-05-04 05:31:37 +00:00
for d in $repos; do
cd "$d0/$d" # am in a pipe, shouldn't use enter
2010-09-18 11:03:28 +00:00
git branch -r -v -v | cut -c 3- | sed "s/^(no branch)/(no_branch)/" | sed "s,^,$d ,"
2010-05-04 05:31:37 +00:00
cd "$d0"
done | {
branches_list=
# branches_repos_*=
2010-09-18 11:03:28 +00:00
while read -r d BRANCH REV TEXT; do
2010-06-17 12:26:24 +00:00
if [ x"$BRANCH" = x"`repobranch "$d"`" ]; then
continue
fi
2010-05-04 05:31:37 +00:00
if [ x"$REV" = x"->" ]; then
continue
fi
BRANCH=${BRANCH#remotes/}
ID=`echo "$BRANCH" | tr -c "A-Za-z0-9." "_"`
branches_list="$branches_list $BRANCH" # TEH SORT MAKEZ IT UNIEQ
eval "r=\$branches_repos_$ID"
2010-09-18 11:03:28 +00:00
r="$r $d"
2010-05-04 05:31:37 +00:00
eval "branches_repos_$ID=\$r"
done
echo -n "$branches_list" | xargs -n 1 echo | sort -u | while IFS= read -r BRANCH; do
ID=`echo "$BRANCH" | tr -c "A-Za-z0-9." "_"`
eval "r=\$branches_repos_$ID"
2010-06-17 12:26:24 +00:00
printf "%-60s %s\n" "$BRANCH" "$r"
#echo "$BRANCH: $r"
2010-05-04 05:31:37 +00:00
done
}
;;
2010-04-02 18:49:48 +00:00
merge)
for d in $repos; do
2010-04-02 19:25:08 +00:00
dv=`visible_repo_name "$d"`
2010-04-15 09:38:55 +00:00
enter "$d0/$d" verbose
2010-04-02 18:49:48 +00:00
r=`git symbolic-ref HEAD`
r=${r#refs/heads/}
2010-05-02 11:06:36 +00:00
if git log HEAD..origin/"`repobranch "$d"`" | grep .; then
2010-04-02 18:49:48 +00:00
# we have uncommitted changes
2010-05-09 17:40:25 +00:00
if yesno "Could merge from \"`repobranch "$d"`\" into \"$r\" in $dv. Do it?"; then
2010-05-02 11:06:36 +00:00
if ! verbose git merge origin/"`repobranch "$d"`"; then
2010-04-02 19:11:17 +00:00
check_mergeconflict "$d"
exit 1 # this should ALWAYS be fatal
2010-04-02 18:49:48 +00:00
fi
fi
fi
cd "$d0"
done
;;
2010-04-11 19:09:32 +00:00
push|commit)
2010-04-16 17:41:05 +00:00
submit=$1
2010-03-20 13:20:07 +00:00
for d in $repos; do
2010-04-02 19:25:08 +00:00
dv=`visible_repo_name "$d"`
2010-04-15 09:38:55 +00:00
enter "$d0/$d" verbose
2010-03-20 13:20:07 +00:00
r=`git symbolic-ref HEAD`
r=${r#refs/heads/}
2010-06-22 15:32:43 +00:00
diffdata=`git diff --color HEAD`
if [ -n "$diffdata" ]; then
2010-04-02 18:09:03 +00:00
# we have uncommitted changes
2010-06-22 15:32:43 +00:00
if yesno "Uncommitted changes in \"$r\" in $dv. Commit?" 'echo "$diffdata" | less -r'; then
2010-04-02 18:09:03 +00:00
verbose git commit -a
fi
fi
2010-04-16 17:36:41 +00:00
rem=`git config "branch.$r.remote" || echo origin`
2010-05-25 14:28:12 +00:00
bra=`git config "branch.$r.merge" || echo "$r"`
2010-07-09 20:54:58 +00:00
upstream="$rem/${bra#refs/heads/}"
2010-06-22 15:28:25 +00:00
if ! git rev-parse "$upstream" >/dev/null 2>&1; then
2010-06-22 15:34:51 +00:00
upstream="origin/`repobranch "$d"`"
2010-05-25 14:28:12 +00:00
fi
2010-06-22 15:35:05 +00:00
logdata=`git log --color "$upstream".."$r"`
2010-06-22 15:33:56 +00:00
if [ -n "$logdata" ]; then
if yesno "Push \"$r\" in $dv?" 'echo "$logdata" | less -r'; then
verbose git push "$rem" HEAD
fi
2010-03-20 13:20:07 +00:00
fi
2010-04-16 17:41:05 +00:00
if [ x"$submit" = x"-s" ]; then
case "$r" in
*/*)
2010-05-25 14:28:12 +00:00
verbose git push "$rem" HEAD:"${bra%%/*}/finished/${bra#*/}"
2010-04-16 17:41:05 +00:00
;;
esac
fi
2010-03-20 13:20:07 +00:00
cd "$d0"
done
;;
2010-03-24 12:11:30 +00:00
compile)
2010-10-08 19:45:54 +00:00
cleand0=false
2010-10-07 12:16:55 +00:00
cleandp=false
cleanqcc=false
cleanqc=false
2010-10-15 14:07:03 +00:00
compiled0=false
2010-10-07 12:16:55 +00:00
debug=debug
2010-10-13 19:42:31 +00:00
if [ -z "$CC" ]; then
export CC="gcc -DSUPPORTIPV6"
fi
2010-10-07 12:16:55 +00:00
while :; do
case "$1" in
2010-10-15 14:07:03 +00:00
-0)
compiled0=true
;;
2010-10-07 12:16:55 +00:00
-c)
2010-10-08 19:45:54 +00:00
cleand0=true
2010-10-07 12:16:55 +00:00
cleandp=true
cleanqcc=true
cleanqc=true
shift
;;
-r)
debug=release
2010-10-14 16:18:34 +00:00
export CC="$CC -g -mtune=native -march=native"
2010-10-07 12:16:55 +00:00
shift
;;
*)
break
;;
esac
done
2010-04-26 20:48:14 +00:00
if [ -n "$WE_HATE_OUR_USERS" ]; then
2010-10-07 12:16:55 +00:00
TARGETS="sv-$debug cl-$debug"
2010-07-09 20:48:47 +00:00
elif [ x"`uname`" = x"Darwin" ]; then
case "`uname -r`" in
?.*)
2010-10-07 12:16:55 +00:00
TARGETS="sv-$debug cl-$debug sdl-$debug"
2010-07-09 20:48:47 +00:00
;;
*)
# AGL cannot be compiled on systems with a kernel > 10.x (Snow Leopard)
2010-10-07 12:16:55 +00:00
TARGETS="sv-$debug sdl-$debug"
2010-07-09 20:48:47 +00:00
;;
esac
2010-10-03 12:56:22 +00:00
export CC="$CC -I$PWD/misc/buildfiles/osx/Xonotic-SDL.app/Contents/Frameworks/SDL.framework/Headers -F$PWD/misc/buildfiles/osx/Xonotic-SDL.app/Contents/Frameworks"
2010-04-26 20:48:14 +00:00
else
2010-10-07 12:16:55 +00:00
TARGETS="sv-$debug cl-$debug sdl-$debug"
2010-04-26 20:48:14 +00:00
fi
2010-07-17 15:02:06 +00:00
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
2010-07-04 16:28:02 +00:00
TARGETS=
for X in $1; do
case "$X" in
sdl)
2010-07-17 15:02:06 +00:00
TARGETS="$TARGETS sdl-debug"
2010-07-04 16:28:02 +00:00
;;
glx|agl|wgl)
2010-07-17 15:02:06 +00:00
TARGETS="$TARGETS cl-debug"
2010-07-04 16:28:02 +00:00
;;
dedicated)
2010-07-17 15:02:06 +00:00
TARGETS="$TARGETS sv-debug"
;;
*)
BAD_TARGETS="$BAD_TARGETS $X"
2010-07-04 16:28:02 +00:00
;;
esac
done
2010-07-21 18:01:32 +00:00
if [ -n "$TARGETS" ]; then # at least a valid client
2010-07-17 15:02:06 +00:00
shift
else # no valid client, let's assume this option is not meant to be a client then
TARGETS=$TARGETS_SAVE
BAD_TARGETS=
fi
2010-07-04 16:28:02 +00:00
fi
2010-03-26 08:18:04 +00:00
if [ -z "$MAKEFLAGS" ]; then
if [ -f /proc/cpuinfo ]; then
ncpus=$((`grep -c '^processor :' /proc/cpuinfo`+0))
if [ $ncpus -gt 1 ]; then
MAKEFLAGS=-j$ncpus
2010-03-25 08:18:19 +00:00
fi
fi
2010-05-08 18:54:22 +00:00
if [ -n "$WE_HATE_OUR_USERS" ]; then
2010-08-20 12:22:56 +00:00
MAKEFLAGS="$MAKEFLAGS DP_MAKE_TARGET=mingw LIB_JPEG= CFLAGS_LIBJPEG="
2010-05-08 18:54:22 +00:00
fi
2010-03-26 08:18:04 +00:00
fi
2010-07-02 12:01:07 +00:00
2010-07-14 07:08:52 +00:00
enter "$d0/d0_blind_id" verbose
2010-10-15 14:07:03 +00:00
if ! $compiled0; then
2010-10-15 13:59:05 +00:00
# compilation of crypto library failed
# use binaries then, if we can...
mkdir -p .libs
if [ -n "$WE_HATE_OUR_USERS" ]; then
2010-10-15 14:07:03 +00:00
verbose cp "$d0/misc/buildfiles/win32/libd0_blind_id"-* .libs/
verbose cp "$d0/misc/buildfiles/win32/libgmp"-* .libs/
2010-10-15 13:59:05 +00:00
else
case "`uname`" in
Linux)
case `uname -m` in
x86_64)
2010-10-15 14:07:03 +00:00
verbose cp "$d0/misc/builddeps/dp.linux64/lib/libd0_blind_id".* .libs/
verbose cp "$d0/misc/builddeps/dp.linux64/lib/libgmp".* .libs/
MAKEFLAGS="$MAKEFLAGS DP_CRYPTO_STATIC_LIBDIR=../misc/builddeps/dp.linux64/lib/"
2010-10-15 13:59:05 +00:00
;;
*86)
2010-10-15 14:07:03 +00:00
verbose cp "$d0/misc/builddeps/dp.linux32/lib/libd0_blind_id".* .libs/
verbose cp "$d0/misc/builddeps/dp.linux32/lib/libgmp".* .libs/
MAKEFLAGS="$MAKEFLAGS DP_CRYPTO_STATIC_LIBDIR=../misc/builddeps/dp.linux32/lib/"
2010-10-15 13:59:05 +00:00
;;
*)
2010-10-15 14:07:03 +00:00
compiled0=true
2010-10-15 13:59:05 +00:00
;;
esac
;;
Darwin)
2010-10-15 14:07:03 +00:00
verbose cp "$d0/misc/buildfiles/osx/Xonotic.app/Contents/MacOS/libd0_blind_id".* .libs/
2010-10-15 13:59:05 +00:00
;;
*)
2010-10-15 14:07:03 +00:00
compiled0=true
2010-10-15 13:59:05 +00:00
;;
esac
fi
2010-07-14 07:08:52 +00:00
fi
2010-10-15 14:07:03 +00:00
if $compiled0; then
if $cleand0; then
if [ -f Makefile ]; then
verbose make $MAKEFLAGS distclean
fi
fi
if ! [ -f Makefile ]; then
verbose sh autogen.sh
verbose ./configure
fi
verbose make $MAKEFLAGS
fi
2010-07-14 07:08:52 +00:00
2010-04-15 09:38:55 +00:00
enter "$d0/fteqcc" verbose
2010-07-02 12:01:07 +00:00
if $cleanqcc; then
2010-05-06 18:16:46 +00:00
verbose make $MAKEFLAGS clean
fi
2010-03-26 08:18:04 +00:00
verbose make $MAKEFLAGS
2010-07-02 12:01:07 +00:00
2010-04-15 09:38:55 +00:00
enter "$d0/data/xonotic-data.pk3dir" verbose
2010-07-02 12:01:07 +00:00
if $cleanqc; then
2010-10-18 14:33:53 +00:00
verbose make FTEQCC="../../../../fteqcc/fteqcc.bin" "$@" $MAKEFLAGS clean
2010-05-06 18:16:46 +00:00
fi
2010-10-18 14:33:53 +00:00
verbose make FTEQCC="../../../../fteqcc/fteqcc.bin" "$@" $MAKEFLAGS
# 4 levels up: data, xonotic-data, qcsrc, server
2010-07-02 12:01:07 +00:00
2010-04-15 09:38:55 +00:00
enter "$d0/darkplaces" verbose
2010-07-17 15:02:06 +00:00
if [ x"$BAD_TARGETS" = x" " ]; then
echo "Warning: invalid empty client, default clients will be used."
fi
2010-07-02 12:01:07 +00:00
if $cleandp; then
2010-05-06 18:16:46 +00:00
verbose make $MAKEFLAGS clean
fi
2010-04-26 20:48:14 +00:00
for T in $TARGETS; do
2010-10-14 16:18:34 +00:00
verbose make $MAKEFLAGS STRIP=: "$@" "$T"
2010-04-26 20:48:14 +00:00
done
2010-07-17 15:02:06 +00:00
for T in $BAD_TARGETS; do
echo "Warning: discarded invalid client $T."
2010-04-26 20:48:14 +00:00
done
2010-07-02 12:01:07 +00:00
2010-06-17 12:08:38 +00:00
verbose "$SELF" update-maps
2010-03-25 08:18:19 +00:00
;;
run)
2010-04-25 18:21:54 +00:00
if [ -n "$WE_HATE_OUR_USERS" ]; then
client=
2010-08-20 12:23:54 +00:00
export PATH="$d0/misc/buildfiles/win32:$d0/d0_blind_id/.libs:$PATH"
2010-05-07 07:40:03 +00:00
elif [ x"`uname`" = x"Darwin" ]; then
2010-07-14 07:08:52 +00:00
export DYLD_LIBRARY_PATH="$d0/misc/buildfiles/osx/Xonotic-SDL.app/Contents/MacOS:$d0/d0_blind_id/.libs"
2010-07-08 20:12:54 +00:00
export DYLD_FRAMEWORK_PATH="$d0/misc/buildfiles/osx/Xonotic-SDL.app/Contents/Frameworks"
2010-05-07 07:40:03 +00:00
client=-sdl
2010-04-25 18:21:54 +00:00
else
2010-07-14 07:08:52 +00:00
export LD_LIBRARY_PATH="$d0/d0_blind_id/.libs"
2010-04-25 18:21:54 +00:00
client=-sdl
fi
2010-03-25 08:18:19 +00:00
case "$1" in
sdl|glx|agl|dedicated)
client=-$1
shift
;;
wgl)
client=
shift
;;
esac
if ! [ -x "darkplaces/darkplaces$client" ]; then
if [ -x "darkplaces/darkplaces$client.exe" ]; then
client=$client.exe
else
echo "Client darkplaces/darkplaces$client not found, aborting"
exit 1
fi
fi
2010-10-02 18:00:23 +00:00
set -- "darkplaces/darkplaces$client" -xonotic -mygames "$@"
2010-05-10 19:12:07 +00:00
# if pulseaudio is running: USE IT
2010-06-06 14:07:50 +00:00
if [ -z "$SDL_AUDIODRIVER" ] && ! [ -n "$WE_HATE_OUR_USERS" ] && ! [ x"`uname`" = x"Darwin" ]; then
2010-05-20 07:30:32 +00:00
if ps -C pulseaudio >/dev/null; then
if ldd /usr/lib/libSDL.so 2>/dev/null | grep pulse >/dev/null; then
export SDL_AUDIODRIVER=pulse
fi
2010-05-10 19:12:07 +00:00
fi
fi
2010-10-01 05:16:04 +00:00
binary=$1
2010-05-02 11:06:36 +00:00
if [ -n "$USE_GDB" ]; then
set -- gdb --args "$@"
2010-10-01 05:16:04 +00:00
elif which gdb >/dev/null 2>&1; then
set -- gdb --batch -x savecore.gdb --args "$@"
2010-09-26 11:52:57 +00:00
elif which catchsegv >/dev/null 2>&1; then
2010-09-26 06:51:27 +00:00
set -- catchsegv "$@"
2010-05-02 11:06:36 +00:00
fi
2010-10-01 05:16:04 +00:00
rm -f xonotic.core
2010-10-01 21:36:03 +00:00
"$@" || true
2010-10-01 05:16:04 +00:00
if [ -f xonotic.core ]; then
2010-10-01 05:23:11 +00:00
if yesno "The program has CRASHED. Do you want to examine the core dump?"; then
gdb "$binary" xonotic.core
#elif yesno "You did not want to examine the core dump. Do you want to provide it - including your DarkPlaces checkout - to the Xonotic developers?"; then
# tar cvzf xonotic.core.tar.gz xonotic.core darkplaces/*.c darkplaces/*.h
# # somehow send it
# rm -f xonotic.core.tar.gz
else
echo "The core dump can be examined later by"
echo " gdb $binary xonotic.core"
fi
2010-05-02 11:06:36 +00:00
fi
2010-03-24 12:11:30 +00:00
;;
2010-03-25 14:40:42 +00:00
each|foreach)
2010-06-17 12:28:54 +00:00
keep_going=false
if [ x"$1" = x"-k" ]; then
keep_going=true
shift
fi
2010-03-25 14:37:47 +00:00
for d in $repos; do
2010-05-09 13:46:17 +00:00
if verbose cd "$d0/$d"; then
2010-06-17 12:28:54 +00:00
if $keep_going; then
verbose "$@" || true
else
verbose "$@"
fi
2010-05-09 13:46:17 +00:00
cd "$d0"
fi
2010-03-25 14:37:47 +00:00
done
;;
2010-04-15 09:38:55 +00:00
save-patches)
outfile=$1
patchdir=`mktemp -d -t save-patches.XXXXXX`
for d in $repos; do
enter "$d0/$d" verbose
git branch -v -v | cut -c 3- | {
i=0
while read -r BRANCH REV UPSTREAM TEXT; do
case "$UPSTREAM" in
\[*)
UPSTREAM=${UPSTREAM#\[}
UPSTREAM=${UPSTREAM%\]}
UPSTREAM=${UPSTREAM%:*}
TRACK=true
;;
*)
2010-05-02 11:06:36 +00:00
UPSTREAM=origin/"`repobranch "$d"`"
2010-04-15 09:38:55 +00:00
TRACK=false
;;
esac
if [ x"$REV" = x"->" ]; then
continue
fi
2010-04-15 09:43:03 +00:00
if git format-patch -o "$patchdir/$i" "$UPSTREAM".."$BRANCH"; then
2010-04-15 09:38:55 +00:00
echo "$d" > "$patchdir/$i/info.txt"
2010-04-15 09:43:03 +00:00
echo "$BRANCH" >> "$patchdir/$i/info.txt"
2010-04-15 09:38:55 +00:00
echo "$UPSTREAM" >> "$patchdir/$i/info.txt"
echo "$TRACK" >> "$patchdir/$i/info.txt"
i=$(($i+1))
else
rm -rf "$patchdir/$i"
fi
done
}
done
( cd "$patchdir" && tar cvzf - . ) > "$outfile"
rm -rf "$patchdir"
;;
restore-patches)
infile=$1
patchdir=`mktemp -d -t restore-patches.XXXXXX`
( cd "$patchdir" && tar xvzf - ) < "$infile"
# detach the head
for P in "$patchdir"/*/info.txt; do
D=${P%/info.txt}
exec 3<"$P"
read -r d <&3
read -r BRANCH <&3
read -r UPSTREAM <&3
read -r TRACK <&3
verbose git checkout HEAD^0
verbose git branch -D "$BRANCH"
if [ x"$TRACK" = x"true" ]; then
verbose git checkout --track -b "$BRANCH" "$UPSTREAM"
else
verbose git branch -b "$BRANCH" "$UPSTREAM"
fi
verbose git am "$D"
done
rm -rf "$patchdir"
;;
2010-04-22 13:56:16 +00:00
admin-merge)
2010-06-23 19:27:43 +00:00
branch=$1
2010-05-09 17:40:25 +00:00
t=`mktemp`
2010-05-15 20:53:45 +00:00
report=""
reportecho()
{
report=$report"$*$LF"
echo "$*"
}
reportecho4()
{
report=$report" $*$LF"
echo " $*"
}
reportdo4()
{
o=`"$@" | sed 's/^/ /' || true`
reportecho "$o"
}
2010-05-09 17:40:25 +00:00
for d in $repos; do
enter "$d0/$d" verbose
2010-05-25 14:28:12 +00:00
base="`repobranch "$d"`"
2010-05-15 20:53:45 +00:00
reportecho "In $d:"
2010-05-09 17:40:25 +00:00
for ref in `git for-each-ref --format='%(refname)' refs/remotes/origin/`; do
case "${ref#refs/remotes/origin/}" in
2010-05-25 14:28:12 +00:00
"$base")
2010-05-09 17:40:25 +00:00
continue
;;
HEAD|master)
continue
;;
2010-06-24 08:12:48 +00:00
*/*)
2010-07-02 12:01:07 +00:00
;;
2010-06-24 08:12:48 +00:00
*)
continue
;;
2010-05-09 17:40:25 +00:00
esac
2010-06-23 19:27:43 +00:00
if [ -n "$branch" ]; then
if [ x"$branch" != x"${ref#refs/remotes/origin/}" ]; then
continue
fi
fi
2010-07-02 12:01:07 +00:00
case "$base" in
master)
realbase=$base
;;
*)
2010-07-02 12:04:00 +00:00
l0=`git rev-list "$base".."$ref" | wc -l`
l1=`git rev-list master.."$ref" | wc -l`
2010-07-02 12:01:07 +00:00
if [ $l0 -gt $l1 ]; then
realbase=master
else
realbase=$base
fi
;;
esac
2010-05-15 20:53:45 +00:00
reportecho " Branch $ref:"
2010-06-15 07:04:29 +00:00
note=`GIT_NOTES_REF=refs/notes/admin-merge git notes show "$ref" 2>/dev/null || true`
2010-07-02 12:01:07 +00:00
logdata=`git log --color "$realbase".."$ref"`
2010-06-15 07:15:50 +00:00
if [ -z "$logdata" ]; then
reportecho4 "--> not merging, no changes vs master"
2010-06-24 08:12:48 +00:00
if yesno "Branch \"$ref\" probably should get deleted. Do it?" ''; then
2010-06-15 07:15:50 +00:00
git push origin :"${ref#refs/remotes/origin/}"
reportecho4 "--> branch deleted"
fi
2010-06-24 08:12:48 +00:00
else
2010-07-02 12:01:07 +00:00
diffdata=`git diff --color --find-copies-harder --ignore-space-change "$realbase"..."$ref"`
2010-06-24 08:12:48 +00:00
if [ -z "$diffdata" ]; then
reportecho4 "--> not merging, no changes vs master, branch contains redundant history"
if yesno "Branch \"$ref\" probably should get deleted. Do it?" '{ echo "$logdata"; } | less -r'; then
2010-05-15 18:11:23 +00:00
git push origin :"${ref#refs/remotes/origin/}"
2010-05-15 20:53:45 +00:00
reportecho4 "--> branch deleted"
2010-05-15 18:11:23 +00:00
fi
2010-07-17 13:18:14 +00:00
elif [ -z "$branch" ] && [ -n "$note" ]; then
2010-05-15 20:53:45 +00:00
reportdo4 echo "$note"
2010-06-24 08:12:48 +00:00
reportecho4 "--> not merging, already had this one rejected before"
elif yesno "Branch \"$ref\" may want to get merged. Do it?" '{ echo "$logdata"; echo "$diffdata"; } | less -r'; then
2010-07-02 12:01:07 +00:00
git checkout "$realbase"
2010-06-24 08:12:48 +00:00
org=`git rev-parse HEAD`
2010-08-19 04:17:10 +00:00
if ! git merge --no-ff "$ref" 2>&1 | tee "$t" && ! { git ls-files -u | grep ' 1 ' >/dev/null; }; then
2010-06-24 08:12:48 +00:00
git reset --hard "$org"
GIT_NOTES_REF=refs/notes/admin-merge git notes edit -m "Merge failed:$LF`cat "$t"`" "$ref"
reportdo4 cat "$t"
reportecho4 "--> merge failed"
2010-09-25 08:23:10 +00:00
elif ! "$SELF" compile 2>&1 | tee "$t"; then
2010-06-24 08:12:48 +00:00
git reset --hard "$org"
GIT_NOTES_REF=refs/notes/admin-merge git notes edit -m "Compile failed:$LF`cat "$t"`" "$ref"
reportdo4 cat "$t"
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"
2010-07-21 18:13:54 +00:00
GIT_NOTES_REF=refs/notes/admin-merge git notes edit "$ref"
2010-06-24 08:12:48 +00:00
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/}"
reportecho4 "--> test failed, branch deleted"
elif [ -n "$note" ]; then
reportdo4 echo "$note"
reportecho4 "--> test failed"
else
reportecho4 "--> test failed, postponed"
fi
else
2010-07-04 19:37:09 +00:00
echo "MERGING"
2010-06-24 08:12:48 +00:00
case ",`repoflags "$d"`," in
*,svn,*)
# we do quite a mess here... luckily we know $org
git fetch # svn needs to be current
git rebase -i --onto origin/master "$org"
git svn dcommit --add-author-from
git reset --hard "$org"
;;
*)
git push origin HEAD
;;
esac
reportecho4 "--> MERGED"
if yesno "Delete original branch \"$ref\"?"; then
git push origin :"${ref#refs/remotes/origin/}"
reportecho4 "--> branch deleted"
fi
fi
2010-05-15 20:53:45 +00:00
else
2010-06-24 08:12:48 +00:00
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/}"
reportecho4 "--> branch deleted"
elif [ -n "$note" ]; then
reportdo4 echo "$note"
reportecho4 "--> rejected"
else
reportecho4 "--> postponed"
fi
2010-05-15 20:53:45 +00:00
fi
2010-05-09 17:40:25 +00:00
fi
2010-05-15 20:53:45 +00:00
reportecho ""
2010-05-09 17:40:25 +00:00
done
2010-05-15 20:53:45 +00:00
reportecho ""
2010-05-09 17:40:25 +00:00
done
rm -f "$t"
2010-05-15 20:53:45 +00:00
echo "$report" | ssh nexuiz@rm.endoftheinternet.org cat '>>' public_html/xonotic-merge-notes.txt
2010-05-09 17:40:25 +00:00
;;
2010-08-09 11:59:42 +00:00
clean)
2010-10-04 13:30:03 +00:00
"$SELF" fix_config
"$SELF" update -N
2010-08-09 12:01:18 +00:00
force=false
2010-09-18 11:03:28 +00:00
gotoupstream=false
2010-09-18 11:13:43 +00:00
fetchupstream=false
2010-09-18 11:03:28 +00:00
gotomaster=false
rmuntracked=false
killbranches=false
# usage:
2010-09-18 11:13:43 +00:00
# ./all clean [-m] [-f | -fu | -fU] [-r] [-D]
2010-09-18 11:09:46 +00:00
# ./all clean --reclone
2010-09-18 11:17:46 +00:00
found=false
2010-10-22 06:51:11 +00:00
for X in "$@"; do
if [ x"$X" = x"--reclone" ]; then
2010-09-18 11:09:46 +00:00
force=true
2010-09-18 11:13:43 +00:00
fetchupstream=true
2010-09-18 11:09:46 +00:00
gotoupstream=true
gotomaster=true
rmuntracked=true
killbranches=true
2010-10-22 06:51:11 +00:00
elif [ x"$X" = x"-f" ]; then
2010-09-18 11:03:28 +00:00
force=true
2010-10-22 06:51:11 +00:00
elif [ x"$X" = x"-u" ]; then
2010-09-18 11:03:28 +00:00
gotoupstream=true
2010-10-22 06:51:11 +00:00
elif [ x"$X" = x"-U" ]; then
2010-09-18 11:13:43 +00:00
gotoupstream=true
fetchupstream=true
2010-10-22 06:51:11 +00:00
elif [ x"$X" = x"-fu" ]; then
2010-09-18 11:03:28 +00:00
force=true
gotoupstream=true
2010-10-22 06:51:11 +00:00
elif [ x"$X" = x"-fU" ]; then
2010-09-18 11:13:43 +00:00
force=true
gotoupstream=true
fetchupstream=true
2010-10-22 06:51:11 +00:00
elif [ x"$X" = x"-m" ]; then
2010-09-18 11:03:28 +00:00
gotomaster=true
2010-10-22 06:51:11 +00:00
elif [ x"$X" = x"-r" ]; then
2010-09-18 11:03:28 +00:00
rmuntracked=true
2010-10-22 06:51:11 +00:00
elif [ x"$X" = x"-D" ]; then
2010-09-18 11:03:28 +00:00
killbranches=true
else
break
fi
2010-09-18 11:17:46 +00:00
found=true
2010-09-18 11:03:28 +00:00
shift
done
2010-09-18 11:17:46 +00:00
if ! $found; then
rmuntracked=true
2010-08-09 12:01:18 +00:00
fi
2010-08-09 11:59:42 +00:00
for d in $repos; do
2010-08-27 07:44:58 +00:00
verbose cd "$d0/$d"
2010-09-18 11:03:28 +00:00
if $gotoupstream; then
if ! $force; then
msg "Must also use -f (delete local changes) when using -u"
exit 1
fi
if $gotomaster; then
2010-09-18 11:13:43 +00:00
if $fetchupstream; then
verbose git fetch origin
2010-09-25 09:06:44 +00:00
verbose git remote prune origin
2010-09-18 11:13:43 +00:00
fi
2010-09-18 11:03:28 +00:00
verbose git checkout -f "`repobranch "$d"`"
2010-09-18 11:07:46 +00:00
verbose git reset --hard origin/"`repobranch "$d"`"
2010-09-18 11:03:28 +00:00
else
r=`git symbolic-ref HEAD`
r=${r#refs/heads/}
rem=`git config "branch.$r.remote" || echo origin`
bra=`git config "branch.$r.merge" || echo "$r"`
upstream="$rem/${bra#refs/heads/}"
2010-09-18 11:13:43 +00:00
if $fetchupstream; then
verbose git fetch "$rem"
2010-09-25 09:06:44 +00:00
verbose git remote prune "$rem"
2010-09-18 11:13:43 +00:00
fi
2010-09-18 11:03:28 +00:00
if ! git rev-parse "$upstream" >/dev/null 2>&1; then
upstream="origin/`repobranch "$d"`"
fi
verbose git reset --hard "$upstream"
fi
elif $gotomaster; then
if $force; then
verbose git checkout -f "`repobranch "$d"`"
2010-09-18 14:58:48 +00:00
verbose git reset --hard
2010-09-18 11:03:28 +00:00
else
verbose git checkout "`repobranch "$d"`"
fi
elif $force; then
2010-08-27 07:44:58 +00:00
verbose git reset --hard
2010-08-09 12:01:18 +00:00
fi
2010-09-18 11:03:28 +00:00
if $rmuntracked; then
case "$d" in
.)
verbose git clean -df
;;
*)
verbose git clean -xdf
;;
esac
fi
if $killbranches; then
git for-each-ref --format='%(refname)' refs/heads/ | while IFS= read -r B; do
2010-09-18 11:07:46 +00:00
if [ x"$B" != x"`git symbolic-ref HEAD`" ]; then
verbose git branch -D "${B#refs/heads/}"
fi
2010-09-18 11:03:28 +00:00
done
2010-10-13 09:47:59 +00:00
git rev-parse refs/heads/master >/dev/null 2>&1 || verbose git branch -t master origin/master || true
git rev-parse "refs/heads/`repobranch "$d"`" >/dev/null 2>&1 || verbose git branch -t "`repobranch "$d"`" origin/"`repobranch "$d"`" || true
2010-09-18 11:03:28 +00:00
fi
2010-10-22 06:51:11 +00:00
checkself "$cmd" "$@"
2010-08-09 11:59:42 +00:00
done
;;
2010-06-17 12:53:28 +00:00
# release building goes here
release-prepare)
2010-08-02 14:01:58 +00:00
#"$SELF" each git clean -fxd
2010-08-06 09:49:18 +00:00
case "$RELEASETYPE" in
beta)
msg "Building a BETA"
;;
release)
msg "Building a RELEASE"
;;
*)
2010-10-15 10:49:37 +00:00
echo >&2 -n "$ESC[2J$ESC[H"
msg ""
msg ""
msg ""
msg ""
msg ""
msg ""
msg " +---------------------------------------------------------.---+"
msg " | NOTE | X |"
msg " +---------------------------------------------------------^---+"
msg " | ____ |"
msg " | / \ This is the official release build system. |"
2010-10-15 10:58:41 +00:00
msg " | | | If you are not a member of the Xonotic Core Team, |"
2010-10-15 10:49:37 +00:00
msg " | | STOP | you are not supposed to use this script and should |"
msg " | | | instead use ./all compile to compile the engine |"
msg " | \____/ and game code. |"
msg " | |"
msg " | [ I understand ] |"
msg " +-------------------------------------------------------------+"
sleep 10
# A LOT of build infrastructure is required:
# - vorbis-tools
# - ImageMagick
# - .ssh/config must be configured so the following
# host names are reachable and have a compile
# infrastructure set up:
# - xonotic-build-linux32 (with gcc on x86)
# - xonotic-build-linux64 (with gcc on x86_64)
# - xonotic-build-win32 (with i586-mingw32msvc-g++)
# - xonotic-build-win64 (with amd64-mingw32msvc-g++
# and x86_64-w64-mingw32-g++)
# - xonotic-build-osx (with Xcode and SDL.framework)
# - AMD Compressonator installed in WINE
# - ResEdit installed in WINE
# - a lot of other requirements you will figure out
# while reading the error messages
# - environment variable RELEASETYPE set
# - optionally, environment variable RELEASEDATE set
# (YYYYMMDD)
2010-08-06 09:49:18 +00:00
exit 1
;;
esac
2010-08-06 09:48:00 +00:00
verbose rm -rf Xonotic Xonotic*.zip
verbose mkdir -p Xonotic
2010-09-03 07:07:26 +00:00
if [ -n "$RELEASEDATE" ]; then
verbose echo "$RELEASEDATE" > Xonotic/stamp.txt
else
verbose date +%Y%m%d > Xonotic/stamp.txt
fi
2010-08-12 14:22:33 +00:00
verbose git archive --format=tar HEAD -- Docs misc server xonotic-linux-glx.sh xonotic-linux-sdl.sh misc/buildfiles key_0.d0pk | {
2010-08-06 09:48:00 +00:00
verbose cd Xonotic
verbose mkdir data fteqcc source source/darkplaces source/fteqcc
verbose tar xvf -
verbose rm -rf misc/builddeps
verbose mv misc/buildfiles/win32/* . || true
2010-08-11 04:36:32 +00:00
verbose mv misc/buildfiles/win64 bin64 || true
2010-08-06 09:48:00 +00:00
verbose mv misc/buildfiles/osx/* . || true
verbose rm -rf misc/buildfiles
2010-08-12 14:22:53 +00:00
verbose rm -rf misc/pki
2010-08-02 14:01:58 +00:00
}
2010-08-05 08:41:10 +00:00
{
2010-08-06 09:48:00 +00:00
verbose cd darkplaces
verbose git archive --format=tar HEAD
2010-08-05 08:41:10 +00:00
} | {
2010-08-06 09:48:00 +00:00
verbose cd Xonotic/source/darkplaces
verbose tar xvf -
2010-08-05 08:41:10 +00:00
}
{
2010-08-06 09:48:00 +00:00
verbose cd fteqcc
verbose git archive --format=tar HEAD
2010-08-05 08:41:10 +00:00
} | {
2010-08-06 09:48:00 +00:00
verbose cd Xonotic/source/fteqcc
verbose tar xvf -
2010-08-06 07:27:05 +00:00
}
{
2010-08-06 09:48:00 +00:00
verbose cd data/xonotic-data.pk3dir
verbose git archive --format=tar HEAD -- qcsrc Makefile
2010-08-06 07:27:05 +00:00
} | {
2010-08-06 09:48:00 +00:00
verbose cd Xonotic/source
verbose tar xvf -
2010-08-02 14:01:58 +00:00
}
2010-08-12 14:22:53 +00:00
rm -f Xonotic/key_15.d0pk
2010-06-17 12:53:28 +00:00
;;
2010-06-17 14:19:01 +00:00
release-compile-run)
host=$1
buildpath=$2
maketargets=$3
makeflags=$4
srcdir=$5
2010-09-13 07:59:12 +00:00
depsdir=$6
targetfiles=$7
2010-09-15 11:21:13 +00:00
set -x
2010-08-21 11:57:53 +00:00
if [ -n "$targetfiles" ]; then
2010-09-15 11:14:23 +00:00
case " $HOSTS_THAT_ARE_DISABLED " in
*\ $host\ *)
2010-09-15 11:19:50 +00:00
exit
2010-09-15 11:14:23 +00:00
;;
esac
2010-08-21 11:57:53 +00:00
case " $HOSTS_THAT_ARE_MYSELF " in
*\ $host\ *)
2010-09-13 07:59:12 +00:00
verbose rsync --delete -zLvaSHP "$srcdir"/ "$buildpath/"
verbose rsync --delete -zLvaSHP "$depsdir"/ "$buildpath.deps/"
verbose ln -snf "$buildpath.deps" "$buildpath/.deps"
2010-08-21 11:57:53 +00:00
verbose eval make -C "$buildpath" clean $maketargets $makeflags
for f in $targetfiles; do
verbose mv "$buildpath/${f%:*}" "${f##*:}" || true
done
;;
*)
2010-09-13 07:59:12 +00:00
verbose rsync --delete -zLvaSHP "$srcdir"/ "$host:$buildpath/"
verbose rsync --delete -zLvaSHP "$depsdir"/ "$host:$buildpath.deps/"
2010-09-15 19:27:23 +00:00
verbose ssh "$host" "ln -snf $buildpath.deps $buildpath/.deps && cd $buildpath && nice -`nice` make clean $maketargets $makeflags"
2010-08-21 11:57:53 +00:00
for f in $targetfiles; do
verbose rsync -zvaSHP "$host:$buildpath/${f%:*}" "${f##*:}" || true
done
;;
esac
# now rebrand the binaries...
for f in $targetfiles; do
2010-09-04 14:56:33 +00:00
#verbose "$d0/misc/tools/rebrand-darkplaces-engine.sh" "${XONOTIC_BRAND:-$d0/misc/tools/xonotic.brand}" "${f##*:}" || true
2010-10-25 07:02:03 +00:00
case "${f##*:}" in
2010-09-04 14:56:33 +00:00
xonotic*.exe)
2010-10-25 07:02:03 +00:00
verbose "$d0/misc/tools/change-icon-of-exe.sh" "$d0/misc/logos/icons_ico/xonotic.ico" "${f##*:}"
2010-09-04 14:56:33 +00:00
(
d=`mktemp -d -t rebrand.XXXXXX`
cd "$d"
echo "-mygames" > darkplaces.opt
zip -9r darkplaces.zip darkplaces.opt
cat darkplaces.zip
cd "$d0"
rm -rf "$d"
2010-10-25 07:02:03 +00:00
) >> "${f##*:}"
2010-09-04 14:56:33 +00:00
;;
esac
2010-08-21 11:57:53 +00:00
done
fi
2010-06-17 14:19:01 +00:00
;;
release-compile)
suffix=$1
makeflags=$2
fteqcc_maketargets=$3
fteqcc_files=$4
darkplaces_maketargets=$5
darkplaces_files=$6
2010-09-13 07:59:12 +00:00
host=xonotic-build-$suffix
verbose "$SELF" release-compile-run "$host" /tmp/fteqcc.build."$suffix" "$fteqcc_maketargets" "$makeflags" "Xonotic/source/fteqcc" "$d0/misc/builddeps/dp.$suffix" "$fteqcc_files"
verbose "$SELF" release-compile-run "$host" /tmp/Darkplaces.build."$suffix" "$darkplaces_maketargets" "$makeflags" "Xonotic/source/darkplaces" "$d0/misc/builddeps/dp.$suffix" "$darkplaces_files"
2010-06-17 14:19:01 +00:00
;;
2010-06-17 13:20:57 +00:00
release-engine-win32)
2010-08-06 09:48:00 +00:00
verbose "$SELF" release-compile win32 \
2010-10-14 07:59:37 +00:00
'STRIP=: DP_MAKE_TARGET=mingw CC="i586-mingw32msvc-gcc -march=i686 -g -Wl,--dynamicbase -Wl,--nxcompat -I.deps/include -L.deps/lib -DUSE_WSPIAPI_H -DSUPPORTIPV6" WINDRES="i586-mingw32msvc-windres" SDL_CONFIG=".deps/bin/sdl-config" LIB_JPEG= CFLAGS_LIBJPEG= WIN32RELEASE=1 D3D=0' \
2010-06-17 14:19:01 +00:00
win 'fteqcc.exe:Xonotic/fteqcc/fteqcc.exe' \
2010-09-24 10:41:18 +00:00
'' ''
verbose "$SELF" release-compile win32 \
2010-10-02 19:24:02 +00:00
'STRIP=: DP_MAKE_TARGET=mingw CC="i586-mingw32msvc-gcc -g -Wl,--dynamicbase -Wl,--nxcompat -I.deps/include -L.deps/lib -DUSE_WSPIAPI_H -DSUPPORTIPV6" WINDRES="i586-mingw32msvc-windres" SDL_CONFIG=".deps/bin/sdl-config" LIB_JPEG= CFLAGS_LIBJPEG= WIN32RELEASE=1 D3D=0' \
2010-09-24 10:41:18 +00:00
'' '' \
2010-08-11 04:36:32 +00:00
release 'darkplaces.exe:Xonotic/xonotic.exe darkplaces-sdl.exe:Xonotic/xonotic-sdl.exe darkplaces-dedicated.exe:Xonotic/xonotic-dedicated.exe'
2010-06-17 12:53:28 +00:00
;;
2010-07-02 12:44:22 +00:00
release-engine-win64)
2010-08-06 09:48:00 +00:00
verbose "$SELF" release-compile win64 \
2010-10-02 19:24:02 +00:00
'STRIP=: DP_MAKE_TARGET=mingw CC="amd64-mingw32msvc-gcc -g -Wl,--dynamicbase -Wl,--nxcompat -I.deps/include -L.deps/lib -DSUPPORTIPV6" WINDRES="amd64-mingw32msvc-windres" SDL_CONFIG=".deps/bin/sdl-config" LIB_JPEG= CFLAGS_LIBJPEG= WIN64RELEASE=1 D3D=0' \
2010-08-09 13:23:19 +00:00
win 'fteqcc.exe:Xonotic/fteqcc/fteqcc-x64.exe' \
2010-09-24 11:05:32 +00:00
'sv-release sdl-release' 'darkplaces-sdl.exe:Xonotic/xonotic-x64-sdl.exe darkplaces-dedicated.exe:Xonotic/xonotic-x64-dedicated.exe'
2010-09-24 10:41:18 +00:00
verbose "$SELF" release-compile win64 \
2010-10-02 19:24:02 +00:00
'STRIP=: DP_MAKE_TARGET=mingw CC="x86_64-w64-mingw32-gcc -g -Wl,--dynamicbase -Wl,--nxcompat -I.deps/include -L.deps/lib -DSUPPORTIPV6" WINDRES="x86_64-w64-mingw32-windres" SDL_CONFIG=".deps/bin/sdl-config" LIB_JPEG= CFLAGS_LIBJPEG= WIN64RELEASE=1 D3D=0' \
2010-09-24 10:41:18 +00:00
'' '' \
2010-09-24 11:05:32 +00:00
cl-release 'darkplaces.exe:Xonotic/xonotic-x64.exe'
2010-07-02 12:44:22 +00:00
;;
2010-09-24 11:05:32 +00:00
release-engine-osx)
2010-08-11 05:42:23 +00:00
# gcc on OSX is buggy, needs -fno-reorder-blocks for a release build to succeed
2010-08-06 09:48:00 +00:00
verbose "$SELF" release-compile osx \
2010-10-02 19:24:02 +00:00
'STRIP=: CC="gcc -g -arch i386 -arch ppc -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.4 -I.deps/include -L.deps/lib -fno-reorder-blocks -DSUPPORTIPV6"' \
2010-06-17 14:19:01 +00:00
all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.osx' \
2010-08-21 14:38:36 +00:00
'sv-release sdl-release' 'darkplaces-sdl:Xonotic/Xonotic-SDL.app/Contents/MacOS/xonotic-osx-sdl-bin darkplaces-dedicated:Xonotic/xonotic-osx-dedicated'
2010-08-21 11:57:53 +00:00
verbose "$SELF" release-compile osx \
2010-10-02 19:24:02 +00:00
'STRIP=: CC="gcc -g -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.4 -I.deps/include -L.deps/lib -fno-reorder-blocks -DSUPPORTIPV6"' \
2010-08-21 11:57:53 +00:00
'' '' \
2010-08-27 15:04:02 +00:00
'cl-release' 'darkplaces-agl:Xonotic/Xonotic.app/Contents/MacOS/xonotic-osx-agl-bin'
2010-08-21 11:57:53 +00:00
;;
2010-06-17 13:20:57 +00:00
release-engine-linux32)
2010-08-06 09:48:00 +00:00
verbose "$SELF" release-compile linux32 \
2010-10-14 08:00:03 +00:00
'STRIP=: CC="gcc -m32 -march=i686 -g -I.deps/include -L.deps/lib -DSUPPORTIPV6" DP_MODPLUG_STATIC_LIBDIR=.deps/lib LIB_JPEG=.deps/lib/libjpeg.a DP_CRYPTO_STATIC_LIBDIR=.deps/lib' \
2010-06-17 14:19:01 +00:00
all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.linux32' \
2010-08-11 04:36:32 +00:00
release 'darkplaces-glx:Xonotic/xonotic-linux32-glx darkplaces-sdl:Xonotic/xonotic-linux32-sdl darkplaces-dedicated:Xonotic/xonotic-linux32-dedicated'
2010-06-17 13:20:57 +00:00
;;
release-engine-linux64)
2010-08-06 09:48:00 +00:00
verbose "$SELF" release-compile linux64 \
2010-10-02 19:25:02 +00:00
'STRIP=: CC="gcc -m64 -g -I.deps/include -L.deps/lib -DSUPPORTIPV6" DP_MODPLUG_STATIC_LIBDIR=.deps/lib LIB_JPEG=.deps/lib/libjpeg.a DP_CRYPTO_STATIC_LIBDIR=.deps/lib' \
2010-06-17 14:19:01 +00:00
all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.linux64' \
2010-08-11 04:36:32 +00:00
release 'darkplaces-glx:Xonotic/xonotic-linux64-glx darkplaces-sdl:Xonotic/xonotic-linux64-sdl darkplaces-dedicated:Xonotic/xonotic-linux64-dedicated'
2010-06-17 13:20:57 +00:00
;;
release-engine)
2010-09-06 09:45:39 +00:00
verbose "$SELF" release-engine-linux32 &
verbose "$SELF" release-engine-linux64 &
verbose "$SELF" release-engine-win32 &
verbose "$SELF" release-engine-win64 &
verbose "$SELF" release-engine-osx &
wait %1
wait %2
wait %3
wait %4
wait %5
wait
2010-06-17 12:53:28 +00:00
;;
release-maps)
2010-08-06 09:48:00 +00:00
verbose "$SELF" update-maps
2010-06-17 13:20:57 +00:00
;;
2010-06-28 12:27:27 +00:00
release-qc)
2010-08-06 09:48:00 +00:00
case "$RELEASETYPE" in
beta)
2010-10-20 14:30:41 +00:00
verbose make -C Xonotic/source FTEQCC="../../../fteqcc/fteqcc.linux32" XON_BUILDSYSTEM=1 clean all
# back out of: source/qcsrc/server
2010-08-06 09:48:00 +00:00
;;
release)
2010-10-20 14:30:41 +00:00
verbose make -C Xonotic/source FTEQCC="../../../fteqcc/fteqcc.linux32" XON_BUILDSYSTEM=1 FTEQCCFLAGS_WATERMARK= clean all
2010-08-06 09:48:00 +00:00
;;
esac
verbose rm -f Xonotic/source/*/fteqcc.log
2010-06-28 12:27:27 +00:00
;;
2010-06-17 13:20:57 +00:00
release-buildpk3-transform-raw)
2010-06-21 14:04:51 +00:00
dir=$1
2010-06-17 13:20:57 +00:00
;;
release-buildpk3-transform-normal)
2010-06-21 14:04:51 +00:00
dir=$1
2010-08-06 09:48:00 +00:00
verbose cd "$dir"
2010-06-21 14:04:51 +00:00
# texture: convert to jpeg and dds
2010-08-06 09:48:00 +00:00
verbose export do_jpeg=true
verbose export jpeg_qual_rgb=95
verbose export jpeg_qual_a=99
verbose export do_dds=true
verbose export dds_flags=
verbose export do_ogg=false
verbose export del_src=true
find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
2010-06-17 13:20:57 +00:00
;;
release-buildpk3-transform-low)
2010-06-21 14:04:51 +00:00
dir=$1
2010-08-06 09:48:00 +00:00
verbose cd "$dir"
2010-06-21 14:04:51 +00:00
# texture: convert to jpeg and dds
2010-06-17 13:20:57 +00:00
# music: reduce bitrate
2010-08-06 09:48:00 +00:00
verbose export do_jpeg=true
verbose export jpeg_qual_rgb=80
2010-10-26 19:05:31 +00:00
verbose export jpeg_qual_a=99
2010-08-06 09:48:00 +00:00
verbose export do_dds=false
verbose export do_ogg=true
verbose export ogg_qual=1
verbose export del_src=true
find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
2010-06-17 13:20:57 +00:00
;;
2010-08-05 13:16:29 +00:00
release-buildpk3-transform-lowdds)
dir=$1
2010-08-06 09:48:00 +00:00
verbose cd "$dir"
2010-08-05 13:16:29 +00:00
# texture: convert to jpeg and dds
# music: reduce bitrate
2010-08-06 09:48:00 +00:00
verbose export do_jpeg=false
verbose export do_jpeg_if_not_dds=true
verbose export jpeg_qual_rgb=80
2010-10-26 19:05:31 +00:00
verbose export jpeg_qual_a=99
2010-08-06 09:48:00 +00:00
verbose export do_dds=true
verbose export dds_flags=
verbose export do_ogg=true
verbose export ogg_qual=1
verbose export del_src=true
find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
2010-06-17 13:20:57 +00:00
;;
release-buildpk3)
src=$1
dst=$2
transform=$3
case "$dst" in
/*)
;;
2010-06-17 13:23:22 +00:00
*/)
2010-06-17 13:20:57 +00:00
dst="$PWD/$dst"
;;
esac
2010-08-06 09:48:00 +00:00
verbose rm -rf Xonotic/temp
verbose mkdir -p Xonotic/temp
2010-08-02 14:01:58 +00:00
{
2010-08-06 09:48:00 +00:00
verbose cd "$src"
verbose git archive --format=tar HEAD
2010-08-02 14:01:58 +00:00
} | {
2010-08-06 09:48:00 +00:00
verbose cd Xonotic/temp
verbose tar xvf -
2010-08-02 14:01:58 +00:00
}
2010-08-06 09:48:00 +00:00
verbose cd Xonotic/temp
2010-08-02 14:01:58 +00:00
if [ x"$src" = x"data/xonotic-data.pk3dir" ]; then
2010-08-06 10:19:30 +00:00
verbose cp ../source/progs.dat .
verbose cp ../source/csprogs.dat .
verbose cp ../source/menu.dat .
2010-08-06 09:48:00 +00:00
verbose rm -rf qcsrc
2010-08-05 18:12:49 +00:00
gv=`grep "^gameversion " "defaultXonotic.cfg" | awk '{ print $2 }'`
major=$(($gv / 10000))
minor=$(($gv / 100 - $major * 100))
patch=$(($gv - $major * 10000 - $minor * 100))
2010-09-14 03:59:21 +00:00
versionstr="$major.$minor.$patch"
case "$RELEASETYPE" in
beta)
versionstr="$versionstr""beta"
;;
esac
2010-08-06 09:48:00 +00:00
verbose sed -i "
2010-09-14 03:59:21 +00:00
s/^set g_xonoticversion [^ ]* /set g_xonoticversion $versionstr /;
2010-08-05 18:12:49 +00:00
s/^gameversion_min [0-9]*/gameversion_min $(( ($gv / 100) * 100 - 100 ))/;
s/^gameversion_max [0-9]*/gameversion_max $(( ($gv / 100) * 100 + 199 ))/;
" defaultXonotic.cfg
2010-09-14 03:59:21 +00:00
(
verbose cd gfx/menu/luminos
verbose cp "$d0"/mediasource/gfx/menu/luminos_versionbuilder/background_l2.svg .
verbose "$d0"/mediasource/gfx/menu/luminos_versionbuilder/versionbuilder "$versionstr"
verbose rm background_l2.svg
)
2010-08-02 14:01:58 +00:00
fi
2010-08-06 07:27:05 +00:00
if [ x"$src" = x"data/xonotic-maps.pk3dir" ]; then
2010-08-06 07:31:38 +00:00
for X in ../../data/*-????????????????????????????????????????-????????????????????????????????????????.pk3; do
2010-08-06 07:27:05 +00:00
if [ -f "$X" ]; then
2010-08-06 09:48:00 +00:00
verbose unzip "$X"
2010-09-14 03:59:21 +00:00
verbose rm -f maps/*.log maps/*.irc maps/*.lin
2010-08-06 07:27:05 +00:00
fi
done
fi
2010-09-06 07:11:34 +00:00
verbose export git_src_repo="$d0/$src" # skip hash-object
2010-08-06 09:48:00 +00:00
verbose "$SELF" release-buildpk3-transform-$transform "Xonotic/temp"
2010-09-16 10:42:38 +00:00
verbose mkzip "../../$dst" *
2010-08-06 09:48:00 +00:00
verbose cd ../..
verbose rm -rf Xonotic/temp
2010-06-17 13:20:57 +00:00
;;
release-buildpk3s)
2010-08-05 18:01:27 +00:00
stamp=`cat Xonotic/stamp.txt`
2010-06-17 13:20:57 +00:00
src=$1
shift
2010-08-05 18:01:27 +00:00
dst=${src%.pk3dir}
case "$dst" in
data/xonotic-*)
2010-08-05 18:54:32 +00:00
dst="data/xonotic-$stamp-${dst#data/xonotic-}"
2010-08-05 18:01:27 +00:00
;;
*)
dst="$dst-$stamp"
;;
esac
2010-06-17 13:20:57 +00:00
while [ "$#" -gt 1 ]; do
2010-08-06 09:48:00 +00:00
verbose "$SELF" release-buildpk3 "$src" "Xonotic/$dst$2.pk3" "$1"
2010-06-21 14:04:51 +00:00
shift
shift
2010-06-17 13:20:57 +00:00
done
;;
release-pack)
2010-08-06 09:48:00 +00:00
verbose "$SELF" release-buildpk3s data/font-nimbussansl.pk3dir raw ''
2010-10-18 19:12:31 +00:00
verbose "$SELF" release-buildpk3s data/xonotic-data.pk3dir normal '' low '-low' lowdds '-lowdds'
verbose "$SELF" release-buildpk3s data/xonotic-maps.pk3dir normal '' low '-low' lowdds '-lowdds'
2010-08-06 09:48:00 +00:00
verbose "$SELF" release-buildpk3s data/xonotic-music.pk3dir raw '' low '-low'
verbose "$SELF" release-buildpk3s data/xonotic-nexcompat.pk3dir low ''
2010-06-17 12:53:28 +00:00
;;
2010-08-05 08:59:22 +00:00
release-pack-needsx11)
case "$DISPLAY" in
'')
2010-08-06 09:48:00 +00:00
verbose startx "$SELF" release-pack -- /usr/bin/Xvfb :7
2010-08-05 08:59:22 +00:00
;;
*)
2010-08-06 09:48:00 +00:00
verbose "$SELF" release-pack
2010-08-05 08:59:22 +00:00
;;
esac
;;
2010-08-05 18:01:27 +00:00
release-zip)
2010-08-06 04:30:26 +00:00
stamp=`cat Xonotic/stamp.txt`
2010-09-16 09:42:48 +00:00
# exe and dll files do not need +x, so this makes them eligible for 7zip compression too
2010-09-17 04:54:31 +00:00
chmod a-x Xonotic/*.exe Xonotic/*.dll || true
2010-09-17 22:01:51 +00:00
# let's pass crypto import laws of some nasty countries
2010-09-19 19:35:03 +00:00
crypto_libs=`find Xonotic -name \*d0_rijndael\*`
2010-09-17 22:01:51 +00:00
if [ -n "$crypto_libs" ]; then
verbose mkzip Xonotic-$stamp-crypto.zip \
$crypto_libs
rm -f $crypto_libs
fi
# build the archives
2010-09-16 06:41:57 +00:00
verbose mkzip Xonotic-$stamp-engine.zip \
2010-08-05 18:01:27 +00:00
Xonotic/*.dll \
2010-09-04 16:01:13 +00:00
Xonotic/bin64/*.dll \
Xonotic/*.app \
Xonotic/xonotic-* \
2010-09-24 04:50:10 +00:00
Xonotic/xonotic.exe \
Xonotic/source/darkplaces/
2010-09-04 16:01:13 +00:00
verbose cp Xonotic-$stamp-engine.zip Xonotic-$stamp-common.zip
2010-09-16 06:41:57 +00:00
verbose mkzip Xonotic-$stamp-common.zip \
2010-09-24 04:50:10 +00:00
Xonotic/source/fteqcc/ \
Xonotic/source/qcsrc/ \
2010-08-05 18:01:27 +00:00
Xonotic/Docs \
Xonotic/misc \
Xonotic/fteqcc \
Xonotic/server \
2010-09-03 07:06:50 +00:00
Xonotic/key_0.d0pk \
2010-08-06 04:30:26 +00:00
Xonotic/data/font-nimbussansl-$stamp.pk3
2010-08-09 08:10:25 +00:00
verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp.zip
2010-09-16 06:41:57 +00:00
verbose mkzip0 Xonotic-$stamp.zip \
2010-08-06 04:30:26 +00:00
Xonotic/data/xonotic-$stamp-data.pk3 \
Xonotic/data/xonotic-$stamp-maps.pk3 \
Xonotic/data/xonotic-$stamp-music.pk3 \
Xonotic/data/xonotic-$stamp-nexcompat.pk3
2010-08-09 08:10:25 +00:00
verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp-low.zip
2010-09-16 06:41:57 +00:00
verbose mkzip0 Xonotic-$stamp-low.zip \
2010-08-06 04:30:26 +00:00
Xonotic/data/xonotic-$stamp-data-low.pk3 \
Xonotic/data/xonotic-$stamp-maps-low.pk3 \
2010-08-14 19:54:59 +00:00
Xonotic/data/xonotic-$stamp-music-low.pk3
2010-10-18 19:12:31 +00:00
# verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp-high.zip
# verbose mkzip0 Xonotic-$stamp-high.zip \
# Xonotic/data/xonotic-$stamp-data-raw.pk3 \
# Xonotic/data/xonotic-$stamp-maps-raw.pk3 \
# Xonotic/data/xonotic-$stamp-music.pk3 \
# Xonotic/data/xonotic-$stamp-nexcompat.pk3
verbose mv Xonotic-$stamp-common.zip Xonotic-$stamp-lowdds.zip
2010-09-16 06:41:57 +00:00
verbose mkzip0 Xonotic-$stamp-lowdds.zip \
2010-08-06 04:30:26 +00:00
Xonotic/data/xonotic-$stamp-data-lowdds.pk3 \
Xonotic/data/xonotic-$stamp-maps-lowdds.pk3 \
2010-08-14 19:54:59 +00:00
Xonotic/data/xonotic-$stamp-music-low.pk3
2010-06-17 12:53:28 +00:00
;;
release)
2010-08-06 09:48:00 +00:00
verbose "$SELF" release-prepare
verbose "$SELF" release-maps
verbose "$SELF" release-engine
verbose "$SELF" release-qc
verbose "$SELF" release-pack-needsx11
verbose "$SELF" release-zip
2010-06-17 12:53:28 +00:00
;;
2010-08-02 14:04:48 +00:00
2010-03-18 15:46:07 +00:00
*)
echo "Usage:"
2010-09-18 11:24:27 +00:00
echo " $SELF admin-merge [<branch>]"
echo " $SELF branch <branch>"
echo " $SELF branch <remote> <branch> [<srcbranch>]"
2010-04-02 18:34:05 +00:00
echo " $SELF branches"
2010-09-18 11:24:27 +00:00
echo " $SELF checkout|switch <branch>"
echo " $SELF checkout|switch <remote>/<branch>"
echo " $SELF clean [-m] [-f | -fu | -fU] [-r] [-D]"
echo " $SELF clean --reclone"
2010-10-16 09:33:47 +00:00
echo " $SELF compile [-c] [-r] [-0]"
2010-09-18 11:24:27 +00:00
echo " $SELF each|foreach [-k] command..."
echo " $SELF fix_upstream_rebase"
2010-10-16 09:33:47 +00:00
echo " $SELF keygen"
2010-09-18 11:24:27 +00:00
echo " $SELF merge"
echo " $SELF push|commit [-s]"
echo " $SELF release"
echo " $SELF restore-patches"
echo " $SELF run [sdl|glx|wgl|agl|dedicated] options..."
echo " $SELF save-patches"
echo " $SELF update-maps"
2010-10-18 16:11:00 +00:00
echo " $SELF update|pull [-N] [-s | -h [-p] | -g [-p]] [-l de|nl|default]"
2010-03-18 15:46:07 +00:00
;;
esac