From cf8050091f5d7b017033e60f99f31790814eba3c Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Thu, 24 Sep 2026 16:44:43 -0700 Subject: [PATCH 1/2] fix(ci): package moq-cli from the flake package named after its binary #4030 renamed the flake package to `moq` and turned `.#moq-cli` into a stub script that refuses the old name. package-binary.sh still built `.#`, so the macOS moq-cli tarball packaged that stub and install_name_tool rejected it. Co-Authored-By: Claude Opus 5.5 --- rs/scripts/package-binary.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/rs/scripts/package-binary.sh b/rs/scripts/package-binary.sh index 114b9e269f..0984857a20 100755 --- a/rs/scripts/package-binary.sh +++ b/rs/scripts/package-binary.sh @@ -8,7 +8,7 @@ set -euo pipefail # --bin overrides the binary/command name when it differs from the crate (e.g. # the `moq-cli` crate ships its binary as `moq`); it defaults to the crate name. # -# Builds via `nix build .#` against the flake-pinned toolchain unless +# Builds via `nix build .#` against the flake-pinned toolchain unless # --binary supplies an existing build. Produces # /-v-.tar.gz, named after the release tag so # a URL rewritten from one tag to the next still resolves; the layout matches @@ -97,12 +97,13 @@ if [[ -n "$BINARY" ]]; then BIN_FILE="$BINARY" echo "Packaging prebuilt $CRATE binary for $TARGET..." else - echo "Building $CRATE for $TARGET via nix (output: $CRATE)..." + # The flake names each package after its executable, so `moq-cli` builds as + # `.#moq`; `.#moq-cli` is a stub that refuses the old name. + echo "Building $CRATE for $TARGET via nix (output: $BIN)..." RESULT_LINK="$BUILD_TMP/result" - nix build "$WORKSPACE_DIR#$CRATE" --out-link "$RESULT_LINK" + nix build "$WORKSPACE_DIR#$BIN" --out-link "$RESULT_LINK" - # Crane installs to result/bin/. The binary name is usually the - # crate name; the `moq-cli` crate ships as `moq`. + # Crane installs to result/bin/. BIN_FILE="$RESULT_LINK/bin/$BIN" fi From 07bf74a2a46ca216e7c15242aa86e60ba1880b5f Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Thu, 24 Sep 2026 16:49:24 -0700 Subject: [PATCH 2/2] test(ci): cover the nix package selector in package-binary Co-Authored-By: Claude Opus 5.5 --- .github/scripts/package-binary.test.sh | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/scripts/package-binary.test.sh b/.github/scripts/package-binary.test.sh index 2b2554b6c1..b1390552f1 100755 --- a/.github/scripts/package-binary.test.sh +++ b/.github/scripts/package-binary.test.sh @@ -42,3 +42,31 @@ cmp "$binary" "$bare" cmp "$binary" "$tmp/extracted/$name/bin/moq-relay" echo "release assets package together without path collisions" + +# Without --binary the script builds the flake package named after the binary: +# `.#moq` for the moq-cli crate, since `.#moq-cli` is a stub refusing the old name. +cat >"$tmp/bin/nix" <<'NIX' +#!/usr/bin/env bash +set -euo pipefail +[[ "$1 $3" == "build --out-link" && "$2" == *"#moq" ]] || { + echo "unexpected: nix $*" >&2 + exit 1 +} +mkdir -p "$4/bin" +printf '#!/usr/bin/env sh\necho moq\n' >"$4/bin/moq" +chmod 0755 "$4/bin/moq" +NIX +chmod 0755 "$tmp/bin/nix" + +PATH="$tmp/bin:$PATH" "$WORKSPACE_DIR/rs/scripts/package-binary.sh" \ + --crate moq-cli \ + --bin moq \ + --version 0.12.2 \ + --target "$target" \ + --output "$tmp/dist" + +name="moq-cli-v0.12.2-$target" +tar -xzf "$tmp/dist/$name.tar.gz" -C "$tmp/extracted" +[[ "$("$tmp/extracted/$name/bin/moq")" == moq ]] + +echo "a nix build packages the flake output named after the binary"