diff options
author | Roman Perepelitsa <roman.perepelitsa@gmail.com> | 2022-02-14 21:26:12 +0300 |
---|---|---|
committer | Roman Perepelitsa <roman.perepelitsa@gmail.com> | 2022-02-14 21:26:12 +0300 |
commit | c0a028351ff9a611c4061938ebd5ec4cafb900eb (patch) | |
tree | 123c16859e00abda3c18d25736bf7bc69bd2c004 /mbuild | |
parent | 4b21cd06ffeb5706b017c78b13c2eaf40d7deac1 (diff) |
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
Diffstat (limited to 'mbuild')
-rwxr-xr-x | mbuild | 48 |
1 files changed, 44 insertions, 4 deletions
@@ -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 && "$(</proc/version)" == *Microsoft* ]]; then + () { + (( $# )) || return 0 + print -ru2 -- "WARNING: lock files exist: $@" + (( $# )) && rm -- $@ + } $locks/*(N) + + function flock() { + local fd + sysopen -ro cloexec -u fd <( + exec </dev/null 2>/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 +} "$@" |