Add a --bin argument to mirror cargo install --bin. (#2189)

* Add a --bin argument to mirror cargo install --bin.

* Update crates/bin/src/args.rs

Co-authored-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
Signed-off-by: Matan Lurey <matanlurey@users.noreply.github.com>

* Update crates/binstalk/src/ops.rs

Co-authored-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
Signed-off-by: Matan Lurey <matanlurey@users.noreply.github.com>

* Address feedback, make e2e-test test both source/non-source.

* Update crates/bin/src/entry.rs

Co-authored-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
Signed-off-by: Matan Lurey <matanlurey@users.noreply.github.com>

* Update crates/binstalk/src/ops/resolve/resolution.rs

Co-authored-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
Signed-off-by: Matan Lurey <matanlurey@users.noreply.github.com>

* Update crates/binstalk/src/ops/resolve/resolution.rs

Co-authored-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
Signed-off-by: Matan Lurey <matanlurey@users.noreply.github.com>

* Update crates/binstalk/src/ops/resolve/resolution.rs

Co-authored-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
Signed-off-by: Matan Lurey <matanlurey@users.noreply.github.com>

* Get everything compiling again.

* optimize ResolutionFetch::resolve_bins

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* fix e2e-test on unix due to ordering

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* fix specific-binaries.sh: relax no-compile

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: Matan Lurey <matanlurey@users.noreply.github.com>
Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
Co-authored-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
This commit is contained in:
Matan Lurey 2025-06-10 04:17:48 -07:00 committed by GitHub
parent ea65a39d2d
commit 8d2b46b8bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 83 additions and 6 deletions

33
e2e-tests/specific-binaries.sh Executable file
View file

@ -0,0 +1,33 @@
#!/bin/bash
set -euxo pipefail
unset CARGO_INSTALL_ROOT
CARGO_HOME=$(mktemp -d 2>/dev/null || mktemp -d -t 'cargo-home')
export CARGO_HOME
export PATH="$CARGO_HOME/bin:$PATH"
# Install a specific binary, ensuring we don't fallback to source.
"./$1" binstall --no-confirm taplo-cli --bin taplo
# Verify that the binary was installed and is executable
if ! command -v taplo >/dev/null 2>&1; then
echo "taplo was not installed"
exit 1
fi
# Run the binary to check it works
taplo --version
# Install a specific binary, but always compile from source.
"./$1" binstall --no-confirm ripgrep --bin rg --strategies compile
# Verify that the binary was installed and is executable
if ! command -v rg >/dev/null 2>&1; then
echo "rg was not installed"
exit 1
fi
# Run the binary to check it works
rg --version