Skip to content

Commit 0af7c66

Browse files
zhmiaoCopilot
andcommitted
fix(rp-4): use bsdtar fallback for Windows .zip packaging
build-cli-windows job for v0.1.6 (CI run 26521444308) failed at the 'Package zip' step because MSYS `zip` binary is not on PATH in the windows-latest runner's Git Bash by default. Use Windows 10+ built-in bsdtar (`tar.exe -a -cf foo.zip ...`) when available — it auto-detects the archive format from the .zip extension. Falls back to standalone `zip` when bsdtar is missing (non-Windows hosts without bsdtar installed). The tar.gz branch is unaffected; verified locally on GNU tar 1.34: FLAVOR=cpu PLATFORM=linux-x86_64 VERSION=0.1.7-prep-smoke ./scripts/package_cli_tarball.sh -> 15M tarball produces {"device":"cpu"}. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent cc8c5de commit 0af7c66

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

sparrow-engine/scripts/package_cli_tarball.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,18 @@ case "$archive_ext" in
217217
tar -C "$work" -czf "$out_archive_abs" "$bundle_name"
218218
;;
219219
zip)
220-
# zip preserves the executable bit on Unix-style tools; Windows users
221-
# extract via Explorer or `tar -xf` (Win10+ ships bsdtar).
222-
( cd "$work" && zip -qr "$out_archive_abs" "$bundle_name" )
220+
# Prefer bsdtar (built into Windows 10+ as `tar.exe`; cross-platform on
221+
# macOS/Linux when available) — it auto-detects the archive format from
222+
# the .zip extension and is more portable than MSYS `zip`. Fall back to
223+
# the standalone `zip` binary if bsdtar isn't present.
224+
if tar --version 2>/dev/null | grep -qi bsdtar; then
225+
tar -a -cf "$out_archive_abs" -C "$work" "$bundle_name"
226+
elif command -v zip >/dev/null 2>&1; then
227+
( cd "$work" && zip -qr "$out_archive_abs" "$bundle_name" )
228+
else
229+
echo "ERROR: neither bsdtar nor zip available to create $out_archive_abs" >&2
230+
exit 6
231+
fi
223232
;;
224233
esac
225234

0 commit comments

Comments
 (0)