From 9a55f9d2ad6b933f831236eaca2278ae0506ec7e Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Wed, 31 May 2023 13:40:29 +1000 Subject: [PATCH] Build refinements: no advzip, git-based file mtimes Fixes #371 --- Makefile | 2 +- .../infrastructure/xonotic-release-build.cron | 16 +++++---- misc/tools/all/release.subr | 35 +++++++++---------- 3 files changed, 28 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index 794588b9..2300f386 100644 --- a/Makefile +++ b/Makefile @@ -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) diff --git a/misc/infrastructure/xonotic-release-build.cron b/misc/infrastructure/xonotic-release-build.cron index 8293b3a1..ef433c54 100755 --- a/misc/infrastructure/xonotic-release-build.cron +++ b/misc/infrastructure/xonotic-release-build.cron @@ -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" diff --git a/misc/tools/all/release.subr b/misc/tools/all/release.subr index 161dec26..4dc5ed1d 100644 --- a/misc/tools/all/release.subr +++ b/misc/tools/all/release.subr @@ -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 ;; -- 2.39.2