Build refinements: no advzip, git-based file mtimes

Fixes #371
This commit is contained in:
bones_was_here 2023-05-31 13:40:29 +10:00
parent 6e8d37156c
commit 9a55f9d2ad
No known key found for this signature in database
GPG Key ID: 982FE90EDA930528
3 changed files with 28 additions and 25 deletions

View File

@ -4,7 +4,7 @@ CLIENT = xonotic-local-sdl
SERVER = xonotic-local-dedicated
# CC and MAKEFLAGS are always set so ?= has no effect, therefore
# use CFLAGS to set default optimisations and support user override
# we use CFLAGS to set default optimisations which users may override
CFLAGS ?= -pipe -march=native -mtune=native -flto=auto
# user can override this with make -j
MAKEFLAGS := -j$(shell nproc)

View File

@ -12,7 +12,7 @@ case "$RELEASETYPE" in
;;
RC*)
RELEASETYPEDIR="$RELEASETYPE/"
RELEASETYPENAME="$RELEASETYPE build"
RELEASETYPENAME="Release Candidate"
;;
*)
RELEASETYPEDIR="$RELEASETYPE/"
@ -63,7 +63,7 @@ test -z "$RELEASETYPEDIR" && ssh autobuild-release-uploader@beta.xonotic.org '
'
cd ~/xonotic-release-build
./all clean --reclone # FIXME this updates timestamps of most unchanged files, making rsync slower, why?
./all clean --reclone
# ./all checkout maint
./all checkout
./all each git checkout HEAD^0
@ -79,6 +79,7 @@ cd ~/xonotic-release-build
# b=$b ./all each sh -c 'if git rev-parse $b >/dev/null 2>&1; then git merge $b; fi'
#done
./all update -N
./all each git restore-mtime --commit-time # adding --merge would be more correct but is slow and hits git limits
d0=`date +%Y%m%d`
d=$d0
i=1
@ -88,10 +89,13 @@ while HEAD -C xonotic:g-23 http://beta.xonotic.org/autobuild/"$RELEASETYPEDIR""X
done
RELEASEDATE=$d ./all release
sha512sum Xonotic-$d*.zip > Xonotic-$d.sha512
for X in Xonotic-$d*.zip; do
ln -snf "$X" "Xonotic-latest${X#Xonotic-$d}"
done
sha512sum Xonotic-latest*.zip > Xonotic-latest.sha512
if [ -z "$RELEASETYPEDIR" ]; then
sleep 1 # newer timestamps for correct file sort order in web gui
for X in Xonotic-$d*.zip; do
ln -snf "$X" "Xonotic-latest${X#Xonotic-$d}"
done
sha512sum Xonotic-latest*.zip > Xonotic-latest.sha512
fi
rsync -vaSHP Xonotic*.zip Xonotic*.sha512 autobuild-release-uploader@beta.xonotic.org:"$RELEASETYPEDIR"
if [ -z "$RELEASETYPEDIR" ]; then
ssh autobuild-release-uploader@beta.xonotic.org sh ../../update-rsync.sh "$d"

View File

@ -60,26 +60,25 @@ release_common()
{
archive=$1; shift
# get rid of this hack once we have done large enough changes
# to be no longer rsync compatible (and then enable the below
# code)
# bones_was_here: 7za still doesn't store symlinks correctly (even with -snl)
# but it does now store the executable bit.
# compared to advzip, 7za achieves very similar final zip size, is multi threaded,
# and avoids https://gitlab.com/xonotic/xonotic/-/issues/371
sevenzipflags=-mx=9
zipflags=-9
find "$@" -exec touch -d "2001-01-01 01:01:01 +0000" {} \+ # ugly hack to make the pk3 files rsync-friendly
# git restore-mtime replaces this hack:
#find "$@" -exec touch -d "2001-01-01 01:01:01 +0000" {} \+ # ugly hack to make the pk3 files rsync-friendly
ziplist=`mktemp`
find "$@" -xtype f \( -executable -or -type l \) -print | sed 's,\([./][^./]*$\),\1 \1,' | sort -k2 | cut -d\ -f1 > "$ziplist"
find "$@" -xtype f \( -type l \) -print | sed 's,\([./][^./]*$\),\1 \1,' | sort -k2 | cut -d\ -f1 > "$ziplist"
7za a -tzip $sevenzipflags -x@"$ziplist" "$archive" "$@" || true
zip $zipflags -y -@<"$ziplist" "$archive" || true
rm -f "$ziplist"
#zipflags=-1r
#find "$@" -exec touch -d "2001-01-01 01:01:01 +0000" {} \+ # ugly hack to make the pk3 files rsync-friendly
#zip $zipflags -y "$archive" "$@" || true
#advzip -4 "$archive"
}
mkzip()
{
# not using this currently, see above
archive=$1; shift
zipflags=-1ry
zip $zipflags "$archive" "$@" || true
@ -466,7 +465,7 @@ case "$cmd" in
if [ $gv -lt 9900 ]; then
# pre-1.0: compatible with any other pre-1.0
verbose sed "
s/^set g_xonoticversion [^ ]* /set g_xonoticversion $versionstr /;
s/^set g_xonoticversion [^ ]* /set g_xonoticversion \"$versionstr\" /;
s/^gameversion_max [0-9]*/gameversion_max 9999/;
" < xonotic-common.cfg > xonotic-common.cfg.new
# Following line was included in sed above, ref https://gitlab.com/xonotic/xonotic-data.pk3dir/-/merge_requests/1034
@ -474,7 +473,7 @@ case "$cmd" in
else
# >= 1.0
verbose sed "
s/^set g_xonoticversion [^ ]* /set g_xonoticversion $versionstr /;
s/^set g_xonoticversion [^ ]* /set g_xonoticversion \"$versionstr\" /;
s/^gameversion_max [0-9]*/gameversion_max $(( ($gv / 100) * 100 + 199 ))/;
" < xonotic-common.cfg > xonotic-common.cfg.new
# Following line was included in sed above, ref https://gitlab.com/xonotic/xonotic-data.pk3dir/-/merge_requests/1034
@ -565,12 +564,12 @@ case "$cmd" in
# exe and dll files do not need +x, so this makes them eligible for 7zip compression too
chmod a-x Xonotic/*.exe Xonotic/*.dll || true
# build the archives
verbose mkzip Xonotic-$stamp-enginesource.zip \
verbose mkzipr Xonotic-$stamp-enginesource.zip \
Xonotic/Makefile \
Xonotic/source/darkplaces/ \
Xonotic/COPYING Xonotic/GPL-2 Xonotic/GPL-3
verbose cp Xonotic-$stamp-enginesource.zip Xonotic-$stamp-engine.zip
verbose mkzip Xonotic-$stamp-engine.zip \
verbose mkzipr Xonotic-$stamp-engine.zip \
Xonotic/*.dll \
Xonotic/bin32/*.dll \
Xonotic/bin64/*.dll \
@ -578,7 +577,7 @@ case "$cmd" in
Xonotic/xonotic-* \
Xonotic/xonotic.exe
verbose cp Xonotic-$stamp-engine.zip Xonotic-$stamp-common.zip
verbose mkzip Xonotic-$stamp-common.zip \
verbose mkzipr Xonotic-$stamp-common.zip \
Xonotic/source/d0_blind_id/ \
Xonotic/source/gmqcc/ \
Xonotic/source/qcsrc/ \
@ -590,7 +589,7 @@ case "$cmd" in
Xonotic/data/font-unifont-$pk3stamp.pk3 \
Xonotic/data/font-xolonium-$pk3stamp.pk3
verbose cp Xonotic-$stamp-enginesource.zip Xonotic-$stamp-source.zip
verbose mkzip Xonotic-$stamp-source.zip \
verbose mkzipr Xonotic-$stamp-source.zip \
Xonotic/source/d0_blind_id/ \
Xonotic/source/gmqcc/ \
Xonotic/source/qcsrc/ \
@ -609,11 +608,11 @@ case "$cmd" in
Xonotic/data/xonotic-$pk3stamp-music.pk3 \
Xonotic/data/xonotic-$pk3stamp-nexcompat-high.pk3 \
Xonotic/data/xonotic-$pk3stamp-xoncompat-high.pk3
verbose mkzip Xonotic-$stamp-mappingsupport.zip \
verbose mkzipr Xonotic-$stamp-mappingsupport.zip \
Xonotic/mapping
verbose mkzip0 Xonotic-$stamp-mappingsupport.zip \
Xonotic/data/xonotic-$pk3stamp-maps-mapping.pk3
verbose mkzip gmqcc-$stamp.zip \
verbose mkzipr gmqcc-$stamp.zip \
Xonotic/gmqcc \
Xonotic/source/gmqcc
;;