refactor(snix/nix-compat/derivation): minor cleanup
Change-Id: I9c975b238e78dcee80412f01681108977f29082a Reviewed-on: https://cl.snix.dev/c/snix/+/30276 Tested-by: besadii Reviewed-by: Florian Klink <flokli@flokli.de>
This commit is contained in:
parent
8101e7a45f
commit
1f70de459d
1 changed files with 5 additions and 7 deletions
|
|
@ -133,7 +133,7 @@ impl Derivation {
|
||||||
name: &str,
|
name: &str,
|
||||||
) -> Result<StorePath<String>, DerivationError> {
|
) -> Result<StorePath<String>, DerivationError> {
|
||||||
// append .drv to the name
|
// append .drv to the name
|
||||||
let name = &format!("{}.drv", name);
|
let name = format!("{}.drv", name);
|
||||||
|
|
||||||
// collect the list of paths from input_sources and input_derivations
|
// collect the list of paths from input_sources and input_derivations
|
||||||
// into a (sorted, guaranteed by BTreeSet) list of references
|
// into a (sorted, guaranteed by BTreeSet) list of references
|
||||||
|
|
@ -144,8 +144,8 @@ impl Derivation {
|
||||||
.map(StorePath::to_absolute_path)
|
.map(StorePath::to_absolute_path)
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
build_text_path(name, self.to_aterm_bytes(), references)
|
build_text_path(&name, self.to_aterm_bytes(), references)
|
||||||
.map_err(|_e| DerivationError::InvalidOutputName(name.to_string()))
|
.map_err(|_e| DerivationError::InvalidOutputName(name))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the FOD digest, if the derivation is fixed-output, or None if
|
/// Returns the FOD digest, if the derivation is fixed-output, or None if
|
||||||
|
|
@ -159,7 +159,7 @@ impl Derivation {
|
||||||
}
|
}
|
||||||
|
|
||||||
let out_output = self.outputs.get("out")?;
|
let out_output = self.outputs.get("out")?;
|
||||||
let ca_hash = &out_output.ca_hash.as_ref()?;
|
let ca_hash = out_output.ca_hash.as_ref()?;
|
||||||
|
|
||||||
Some(
|
Some(
|
||||||
Sha256::new_with_prefix(format!(
|
Sha256::new_with_prefix(format!(
|
||||||
|
|
@ -170,9 +170,7 @@ impl Derivation {
|
||||||
.path
|
.path
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(StorePath::to_absolute_path)
|
.map(StorePath::to_absolute_path)
|
||||||
.as_ref()
|
.unwrap_or_default(),
|
||||||
.map(|s| s as &str)
|
|
||||||
.unwrap_or(""),
|
|
||||||
))
|
))
|
||||||
.finalize()
|
.finalize()
|
||||||
.into(),
|
.into(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue