fix: Skip binaries user didn't requst (#2199)

* fix: Skip binaries user didn't requst

Users may request only a subset of binaries via the --bin flag. In that
case, do not fail if binaries other than the ones requested are missing
from the downloaded archive.

* fix resolve.rs

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

* fix resolve.rs

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

* fix resolve.rs

---------

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:
Remo Senekowitsch 2025-06-20 13:02:21 +02:00 committed by GitHub
parent aa459296fa
commit 4628235403
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 56 additions and 1 deletions

View file

@ -193,6 +193,7 @@ async fn resolve_inner(
&package_info,
&opts.install_path,
opts.no_symlinks,
&opts.bins,
)
.await
{
@ -289,6 +290,7 @@ async fn download_extract_and_verify(
package_info: &PackageInfo,
install_path: &Path,
no_symlinks: bool,
bins: &Option<Vec<CompactString>>,
) -> Result<Vec<bins::BinFile>, BinstallError> {
// Download and extract it.
// If that fails, then ignore this fetcher.
@ -316,6 +318,14 @@ async fn download_extract_and_verify(
.iter()
.zip(bin_files)
.filter_map(|(bin, bin_file)| {
// skip binaries that were not requested by user
if bins
.as_ref()
.is_some_and(|bins| !bins.iter().any(|b| b == bin.name))
{
return None;
}
match bin_file.check_source_exists(&mut |p| extracted_files.has_file(p)) {
Ok(()) => Some(Ok(bin_file)),