Add error logging if achieve doesn't contain bin required (#1298)

* Add `error` logging if achieve doesn't contain bin required

So that users know that this is an upstream issue and will report to
upstream.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

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

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2023-08-17 09:13:21 +10:00 committed by GitHub
parent 146d3f8f43
commit 0f7828569a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,7 +14,7 @@ use maybe_owned::MaybeOwned;
use semver::{Version, VersionReq}; use semver::{Version, VersionReq};
use tempfile::TempDir; use tempfile::TempDir;
use tokio::task::spawn_blocking; use tokio::task::spawn_blocking;
use tracing::{debug, info, instrument, warn}; use tracing::{debug, error, info, instrument, warn};
use crate::{ use crate::{
bins, bins,
@ -267,13 +267,18 @@ async fn download_extract_and_verify(
// This binary is optional // This binary is optional
Err(err) => { Err(err) => {
let required_features = &bin.required_features; let required_features = &bin.required_features;
let bin_name = bin.name.as_str();
if required_features.is_empty() { if required_features.is_empty() {
error!(
"When resolving {name} bin {bin_name} is not found.\
This binary is not optional so it must be included in the archive, please contact with\
upstream to fix this issue."
);
// This bin is not optional, error // This bin is not optional, error
Some(Err(err)) Some(Err(err))
} else { } else {
// Optional, print a warning and continue. // Optional, print a warning and continue.
let bin_name = bin.name.as_str();
let features = required_features.iter().format(","); let features = required_features.iter().format(",");
warn!( warn!(
"When resolving {name} bin {bin_name} is not found. \ "When resolving {name} bin {bin_name} is not found. \