Skip to content

Commit

Permalink
refactor: acbs_build_gw should async
Browse files Browse the repository at this point in the history
  • Loading branch information
eatradish committed May 28, 2024
1 parent 5ad8cda commit e0238f6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions buildit-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ async fn write_new_spec(abbs_path: PathBuf, pkg: String) -> anyhow::Result<()> {
match get_new_spec(&mut spec).await {
Ok(()) => {
if i > 1 {
info!("({i}/5) Retrying to get new spec...");
warn!("({i}/5) Retrying to get new spec...");
}

fs::write(p, spec).await?;
Expand All @@ -180,7 +180,7 @@ async fn write_new_spec(abbs_path: PathBuf, pkg: String) -> anyhow::Result<()> {
Err(e) => {
if let Some(e) = e.downcast_ref::<ParseErrors>() {
warn!("{e}, try use acbs-build fallback to get new checksum ...");
acbs_build_gw(&pkg, &abbs_path)?;
acbs_build_gw(&pkg, &abbs_path).await?;
} else {
error!("Failed to get new spec: {e}");
if i == 5 {
Expand All @@ -194,8 +194,8 @@ async fn write_new_spec(abbs_path: PathBuf, pkg: String) -> anyhow::Result<()> {
Ok(())
}

fn acbs_build_gw(pkg_shared: &str, abbs_path_shared: &Path) -> anyhow::Result<()> {
let output = Command::new("acbs-build")
async fn acbs_build_gw(pkg_shared: &str, abbs_path_shared: &Path) -> anyhow::Result<()> {
let output = tokio::process::Command::new("acbs-build")
.arg("-gw")
.arg(pkg_shared)
.arg("--log-dir")
Expand All @@ -208,6 +208,7 @@ fn acbs_build_gw(pkg_shared: &str, abbs_path_shared: &Path) -> anyhow::Result<()
.arg(abbs_path_shared)
.current_dir(abbs_path_shared)
.output()
.await
.context("Running acbs-build to update checksums")?;

print_stdout_and_stderr(&output);
Expand Down

0 comments on commit e0238f6

Please sign in to comment.