From a3fb03c943440e6b9c48a857803d4f338cea092d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Mon, 23 Dec 2024 16:02:57 +0100 Subject: [PATCH] [release] ensure executables have a minimum size to prevent issues like #6699 from happening again --- scripts/release.sh | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/scripts/release.sh b/scripts/release.sh index 13608e9c8f..3e64b6d0a7 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -53,20 +53,21 @@ build-linux() { cd "${ROOTDIR}" echo Building Linux executable - build-vm 'ubuntu22.04' 'gallery-dl.bin' 'linux' + build-vm 'ubuntu22.04' 'gallery-dl.bin' 'linux' 24000000 } build-windows() { cd "${ROOTDIR}" echo Building Windows executable - build-vm 'windows7_x86_sp1' 'gallery-dl.exe' 'windows' + build-vm 'windows7_x86_sp1' 'gallery-dl.exe' 'windows' 12000000 } build-vm() { VMNAME="$1" BINNAME="$2" LABEL="$3" + MINSIZE="$4" TMPPATH="/tmp/gallery-dl/dist/$BINNAME" # launch VM @@ -87,10 +88,23 @@ build-vm() { rm -f "./dist/$BINNAME" # wait for new executable - while [ ! -e "$TMPPATH" ] ; do + while true; do sleep 5 + + if [ ! -e "$TMPPATH" ]; then + continue + fi + + sleep 2 + SIZE="$(stat -c %s "$TMPPATH")" + if [ "$SIZE" -lt "$MINSIZE" ]; then + echo Size of "'$TMPPATH'" is less than "$MINSIZE" bytes "($SIZE)" + rm -f "$TMPPATH" + continue + fi + + break done - sleep 2 # move mv "$TMPPATH" "./dist/$BINNAME"