From c0a028351ff9a611c4061938ebd5ec4cafb900eb Mon Sep 17 00:00:00 2001 From: Roman Perepelitsa Date: Mon, 14 Feb 2022 19:26:12 +0100 Subject: Squashed 'gitstatus/' changes from f889c13d1..6dc0738c0 6dc0738c0 release v1.5.4 6b3e7cf2f update mbuild script for the new release infra 12b2457ae release v1.5.4 git-subtree-dir: gitstatus git-subtree-split: 6dc0738c0e5199b0ae47d9693874e7d43c7f8f29 --- mbuild | 48 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) (limited to 'mbuild') diff --git a/mbuild b/mbuild index ab096e8b..d3de3317 100755 --- a/mbuild +++ b/mbuild @@ -184,7 +184,7 @@ function build-unix() { case $2 in linux-ppc64le) ;; linux-*) flags+=(-d docker);; - darwin-arm64) intro='PATH="/opt/local/bin:$PATH"';; + darwin-arm64) intro='PATH="/opt/homebrew/bin:$PATH"';; darwin-*) intro='PATH="/usr/local/bin:$PATH"';; esac ssh $1 -- /bin/sh -uex <<<" @@ -271,16 +271,52 @@ function build-windows() { chmod +x $binaries/gitstatusd-$2 } +if [[ -r /proc/version && "$(/dev/null + ( + trap '' TERM PIPE + local fd + while true; do + sysopen -wo create,excl -u fd -- $1 && break + sleep 1 + done + exec {fd}>&- + while true; do + print || break + done + rm -- $1 + ) &! + ) + local REPLY + IFS= read -ru $fd + } +else + function flock() { + : >>$1 + zsystem flock $1 + } +fi + function build() ( setopt xtrace local platform=$1 local machine=$assets[$platform] - print -n >>$locks/$machine - zsystem flock $locks/$machine + flock $locks/$machine build-${protocol[(k)$platform]} $machine $platform local tmp=gitstatusd-$platform.tmp.$$.tar.gz ( cd -q -- $binaries; tar --owner=0 --group=0 -I 'gzip -9' -cf $tmp gitstatusd-$platform ) mv -f -- $binaries/$tmp $binaries/gitstatusd-$platform.tar.gz + # Make sure the last command is a built-in (important for flock). + : ) function mbuild() { @@ -365,4 +401,8 @@ function run-process-tree() { } mkdir -p -- $logs $locks $binaries -run-process-tree mbuild $@ + +() { + run-process-tree mbuild $@ + exit +} "$@" -- cgit v1.2.3