forgive it for what is has done
This commit is contained in:
parent
f982e37fe5
commit
ac4fdac3b7
1 changed files with 45 additions and 5 deletions
48
src/build.rs
48
src/build.rs
|
|
@ -1,4 +1,7 @@
|
||||||
use std::collections::{HashMap, VecDeque};
|
use std::{
|
||||||
|
collections::{HashMap, VecDeque},
|
||||||
|
rc::Rc,
|
||||||
|
};
|
||||||
|
|
||||||
use tokio::{
|
use tokio::{
|
||||||
process::Command,
|
process::Command,
|
||||||
|
|
@ -85,7 +88,7 @@ pub async fn build_loop(
|
||||||
};
|
};
|
||||||
if !paths_built.contains(&eval_job.drv_path) {
|
if !paths_built.contains(&eval_job.drv_path) {
|
||||||
paths_built.push(eval_job.drv_path.clone());
|
paths_built.push(eval_job.drv_path.clone());
|
||||||
match run_build(job.attr, eval_job.drv_path.clone()).await {
|
match run_build(job.attr, eval_job.drv_path.clone(), copy_tx.clone()).await {
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
let _ = result_tx
|
let _ = result_tx
|
||||||
.send(NixCiResult {
|
.send(NixCiResult {
|
||||||
|
|
@ -116,8 +119,12 @@ pub async fn build_loop(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument(skip(drv_path))]
|
#[tracing::instrument(skip(drv_path, copy_tx))]
|
||||||
pub async fn run_build(attr: String, drv_path: String) -> anyhow::Result<Vec<BuildResult>> {
|
pub async fn run_build(
|
||||||
|
attr: String,
|
||||||
|
drv_path: String,
|
||||||
|
copy_tx: Sender<CopyLoopMessage>,
|
||||||
|
) -> anyhow::Result<Vec<BuildResult>> {
|
||||||
let mut child = WrappedChild::new(
|
let mut child = WrappedChild::new(
|
||||||
Command::new("nix")
|
Command::new("nix")
|
||||||
.args(&[
|
.args(&[
|
||||||
|
|
@ -386,7 +393,40 @@ pub async fn run_build(attr: String, drv_path: String) -> anyhow::Result<Vec<Bui
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
|
};
|
||||||
|
match entry.data.as_ref() {
|
||||||
|
Some(ActivityDataPerType::Build { drv_path, state }) => {
|
||||||
|
let result = match state {
|
||||||
|
BuildState::Done => {
|
||||||
|
tracing::info!("derivation {} built successfully", drv_path);
|
||||||
|
BuildResultType::Built
|
||||||
}
|
}
|
||||||
|
BuildState::Failed => {
|
||||||
|
tracing::error!("derivation {} failed to build", drv_path);
|
||||||
|
BuildResultType::Failed
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
tracing::warn!(
|
||||||
|
"derivation {} somehow still running??",
|
||||||
|
drv_path
|
||||||
|
);
|
||||||
|
// unknown build status -> assume it was built successfully if nix build did not return an error
|
||||||
|
BuildResultType::Unknown
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if let Err(e) = copy_tx
|
||||||
|
.send(CopyLoopMessage::Build(BuildResult {
|
||||||
|
path: drv_path.to_string(),
|
||||||
|
result: result,
|
||||||
|
}))
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
tracing::error!("failed to enqueue package copy: {}", e);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue