Add parsing and finding the failed derivation
Signed-off-by: Marcel Müller <neikos@neikos.email>
This commit is contained in:
parent
a7986584d5
commit
85c6a8f169
9 changed files with 985 additions and 76 deletions
|
|
@ -5,8 +5,10 @@ use std::process::Stdio;
|
|||
use futures::FutureExt;
|
||||
use futures::StreamExt;
|
||||
use futures::stream::BoxStream;
|
||||
use nix_json::ActivityKind;
|
||||
use nix_json::NixBuildLogLine;
|
||||
use nix_json::RawNixDerivationInfoOutput;
|
||||
use nix_json::ResultKind;
|
||||
use petgraph::Directed;
|
||||
use petgraph::Graph;
|
||||
use petgraph::prelude::NodeIndex;
|
||||
|
|
@ -144,7 +146,7 @@ impl NixBackend for NixCliBackend {
|
|||
let build_info = &build_graph.build_infos[path];
|
||||
let cur_node = build_info.internal_id;
|
||||
|
||||
for (dep_path, _dep_info) in info.input_derivations() {
|
||||
for (dep_path, _dep_info) in &info.input_derivations {
|
||||
let other_node = build_graph.build_infos[dep_path].internal_id;
|
||||
build_graph.dependencies.add_edge(
|
||||
cur_node,
|
||||
|
|
@ -220,14 +222,14 @@ where
|
|||
let next_log_line = next_log_line?;
|
||||
|
||||
if let NixBuildLogLine::Start(start_log) = next_log_line {
|
||||
if start_log.kind == Some(105) {
|
||||
if start_log.kind == ActivityKind::Build {
|
||||
id_to_derivation.insert(
|
||||
start_log.id,
|
||||
start_log.fields[0].as_str().unwrap().to_string(),
|
||||
);
|
||||
}
|
||||
} else if let NixBuildLogLine::Result(result) = next_log_line {
|
||||
if result.kind == 101 {
|
||||
if result.kind == ResultKind::BuildLogLine {
|
||||
if let Some(build) = actually_built.get_mut(&id_to_derivation[&result.id]) {
|
||||
writeln!(&mut build.log, "{}", result.fields[0].as_str().unwrap()).unwrap()
|
||||
} else {
|
||||
|
|
@ -242,24 +244,3 @@ where
|
|||
Ok(actually_built)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[tokio::test]
|
||||
async fn check_unpure() {
|
||||
let builder = NixBuilder {
|
||||
backend: NixCliBackend {
|
||||
command_path: String::from("nix"),
|
||||
},
|
||||
};
|
||||
|
||||
let infos = builder
|
||||
.build(".#checks.x86_64-linux.crate-fmt".to_string())
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
println!("Got: {infos:#?}");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue