add path_info tests

This commit is contained in:
cy 2025-04-28 13:30:49 -04:00
parent 7285c29e88
commit 878e096494
4 changed files with 70 additions and 2 deletions

View file

@ -5,7 +5,7 @@ use clap::{Args, Parser, Subcommand};
mod bindings;
mod cli;
mod make_nar;
mod path_info;
pub mod path_info;
pub mod push;
pub mod store;
mod uploader;

View file

@ -1,6 +1,6 @@
use std::collections::HashSet;
use anyhow::{Context, Result};
use anyhow::{Context, Result, anyhow};
use futures::future::join_all;
use nix_compat::nixbase32;
use nix_compat::store_path::StorePath;
@ -41,6 +41,12 @@ impl PathInfo {
let derivation = String::from_utf8_lossy(derivation);
debug!("derivation: {derivation}");
if derivation.is_empty() {
return Err(anyhow!(
"nix path-info did not return a derivation for {path:#?}"
));
}
let store_path = StorePath::from_absolute_path(derivation.trim().as_bytes())
.context("storepath from derivation")?;
store