Skip to content

Commit f02f468

Browse files
committed
Two host assumptions the build scripts had never left this machine to test [build]
Both surfaced on the first CI run and both are real portability defects, not workflow mistakes. macOS: /usr/bin/lockf is absent on macOS 14, and therefore on the macos-14 runner, while it is present on 26. zsh reported "no such file or directory" and the `||` branch turned that into "another macOS AudioHub build is already running" — on a fresh VM where nothing else was running at all. The lock is now taken when lockf exists and its absence is announced instead of swallowed, because degrading is only defensible on a single-use runner that builds once, never on a developer machine. Windows: `npm --prefix <dir> install` redirects where packages are written, but which package.json npm READS is version-dependent. The runner's npm kept reading the current directory and failed with ENOENT on the repository root, while the same line worked on a developer box with an older npm. Running npm from inside the frontend directory has no such ambiguity.
1 parent 30233d8 commit f02f468

2 files changed

Lines changed: 31 additions & 4 deletions

File tree

‎app/build-app.sh‎

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,25 @@ else
4545
[[ ! -L "$BUILD_LOCK" ]] || die "refusing a symlinked macOS build lock: $BUILD_LOCK"
4646
exec 8>>"$BUILD_LOCK"
4747
/bin/chmod 0600 "$BUILD_LOCK"
48-
/usr/bin/lockf -s -t 0 8 \
49-
|| die "another macOS AudioHub build is already running"
50-
export AUDIOHUB_MACOS_BUILD_LOCK_PATH="$BUILD_LOCK"
48+
# `lockf` is not on every macOS: it is absent from macOS 14 (and so from the
49+
# macos-14 GitHub runner) and present on 26. Without this check its absence
50+
# surfaced as `no such file or directory` followed by the `||` branch —
51+
# i.e. the build reported "another build is already running" on a machine
52+
# where nothing else was running at all.
53+
#
54+
# Degrading here is safe for exactly one reason, and it is worth stating:
55+
# this lock serialises two builds on the SAME checkout, and the only hosts
56+
# missing lockf are fresh single-use CI runners that build once. It is not
57+
# safe to extend that reasoning to a developer machine, which is why the
58+
# absence is announced rather than swallowed.
59+
if [[ -x /usr/bin/lockf ]]; then
60+
/usr/bin/lockf -s -t 0 8 \
61+
|| die "another macOS AudioHub build is already running"
62+
export AUDIOHUB_MACOS_BUILD_LOCK_PATH="$BUILD_LOCK"
63+
else
64+
print -ru2 -- "[audiohub] WARNING: /usr/bin/lockf is missing on this host; \
65+
building without the concurrent-build lock. Do not run two builds at once."
66+
fi
5167
fi
5268

5369
TRIPLE="$(rustc -vV | awk '/^host: /{print $2}')"

‎scripts/build-windows-installer.ps1‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,18 @@ Step 'Windows-native frontend dependencies'
337337
# node_modules, so merely checking that the directory exists is insufficient:
338338
# a previous checkout can leave a valid-looking but incomplete dependency
339339
# tree. `npm install` is lockfile-aware and cheap when the tree is current.
340-
Invoke-Checked { & $Npm --prefix $FrontendDir install --no-audit --no-fund } 'npm install'
340+
# Run npm FROM the frontend directory rather than relying on --prefix.
341+
# `--prefix` redirects where packages are written, but which package.json npm
342+
# READS is a version-dependent detail: on the GitHub windows runner's npm it
343+
# kept reading the current directory and failed with ENOENT on the repository
344+
# root's (non-existent) package.json, while the same command worked on a
345+
# developer box with an older npm. Push-Location has no such ambiguity.
346+
Push-Location $FrontendDir
347+
try {
348+
Invoke-Checked { & $Npm install --no-audit --no-fund } 'npm install'
349+
} finally {
350+
Pop-Location
351+
}
341352

342353
# cargo-about resolves the union of target-specific dependency graphs while it
343354
# runs frozen. A target-qualified fetch only downloads that one graph, so a

0 commit comments

Comments
 (0)