From 572f77dbf5343cbcfa4730c8e84a547f9ce5a039 Mon Sep 17 00:00:00 2001 From: Zhaofeng Li Date: Sun, 21 Nov 2021 16:02:45 -0800 Subject: [PATCH] A couple of fixes to progress output Need to have some integration tests. --- src/nix/deployment/mod.rs | 1 + src/nix/host/local.rs | 4 ++++ src/nix/host/mod.rs | 8 +++----- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/nix/deployment/mod.rs b/src/nix/deployment/mod.rs index 6222e76..d9643d3 100644 --- a/src/nix/deployment/mod.rs +++ b/src/nix/deployment/mod.rs @@ -284,6 +284,7 @@ impl Deployment { // FIXME: Remote builder? let nix_options = self.hive.nix_options().await.unwrap(); let mut builder = host::local(nix_options); + builder.set_job(Some(job.clone())); let map = derivation.realize(&mut *builder).await?; diff --git a/src/nix/host/local.rs b/src/nix/host/local.rs index 76b59b9..df9daa5 100644 --- a/src/nix/host/local.rs +++ b/src/nix/host/local.rs @@ -93,6 +93,10 @@ impl Host for Local { async fn active_derivation_known(&mut self) -> NixResult { Ok(true) } + + fn set_job(&mut self, job: Option) { + self.job = job; + } } impl Local { diff --git a/src/nix/host/mod.rs b/src/nix/host/mod.rs index 2179e57..1db8647 100644 --- a/src/nix/host/mod.rs +++ b/src/nix/host/mod.rs @@ -74,6 +74,9 @@ pub trait Host: Send + Sync + std::fmt::Debug { /// exist on the host. async fn realize_remote(&mut self, derivation: &StorePath) -> NixResult>; + /// Provides a JobHandle to use during operations. + fn set_job(&mut self, bar: Option); + /// Realizes the specified local derivation on the host then retrieves the outputs. async fn realize(&mut self, derivation: &StorePath) -> NixResult> { let options = CopyOptions::default(); @@ -122,9 +125,4 @@ pub trait Host: Send + Sync + std::fmt::Debug { async fn run_command(&mut self, command: &[&str]) -> NixResult<()> { Err(NixError::Unsupported) } - - /// Provides a JobHandle to use during operations. - #[allow(unused_variables)] - fn set_job(&mut self, bar: Option) { - } }