about summary refs log tree commit diff
path: root/tvix/derivation/src/derivation.rs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-01-17T11·00+0100
committerflokli <flokli@flokli.de>2023-01-18T17·13+0000
commiteebb3ce028e56872cdfee462dd6556e33d2f204e (patch)
tree11867d4c71985837584ae5c75e3dff949351a8a9 /tvix/derivation/src/derivation.rs
parent0aad4e2246971601c16a20240eebf61964f8c198 (diff)
refactor(tvix/derivation): rename {ValidateDerivation,}Error r/5695
This is now used in more than just validate().

Change-Id: I69c3ad6cb5f3ad60a636fe2ea05d432aebe8e53b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7851
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/derivation/src/derivation.rs')
-rw-r--r--tvix/derivation/src/derivation.rs15
1 files changed, 6 insertions, 9 deletions
diff --git a/tvix/derivation/src/derivation.rs b/tvix/derivation/src/derivation.rs
index daccfad6c42e..d937bd91a7fa 100644
--- a/tvix/derivation/src/derivation.rs
+++ b/tvix/derivation/src/derivation.rs
@@ -1,6 +1,6 @@
 use crate::output::{Hash, Output};
 use crate::write;
-use crate::{nix_hash, ValidateDerivationError};
+use crate::{nix_hash, DerivationError};
 use serde::{Deserialize, Serialize};
 use sha2::{Digest, Sha256};
 use std::collections::BTreeSet;
@@ -35,7 +35,7 @@ fn build_store_path(
     is_derivation: bool,
     path_hash: &[u8],
     name: &str,
-) -> Result<StorePath, ValidateDerivationError> {
+) -> Result<StorePath, DerivationError> {
     let compressed = nix_hash::compress_hash(path_hash, 20);
     if is_derivation {
         StorePath::from_string(
@@ -50,9 +50,9 @@ fn build_store_path(
     } else {
         StorePath::from_string(format!("{}-{}", NIXBASE32.encode(&compressed), name,).as_str())
     }
-    .map_err(|_e| ValidateDerivationError::InvalidOutputName(name.to_string()))
+    .map_err(|_e| DerivationError::InvalidOutputName(name.to_string()))
     // Constructing the StorePath can only fail if the passed output name was
-    // invalid, so map errors to a [ValidateDerivationError::InvalidOutputName].
+    // invalid, so map errors to a [DerivationError::InvalidOutputName].
 }
 
 impl Derivation {
@@ -110,10 +110,7 @@ impl Derivation {
     ///   - Take the digest, run hash.CompressHash(digest, 20) on it.
     ///   - Encode it with nixbase32
     ///   - Use it (and the name) to construct a [StorePath].
-    pub fn calculate_derivation_path(
-        &self,
-        name: &str,
-    ) -> Result<StorePath, ValidateDerivationError> {
+    pub fn calculate_derivation_path(&self, name: &str) -> Result<StorePath, DerivationError> {
         let mut hasher = Sha256::new();
 
         // collect the list of paths from input_sources and input_derivations
@@ -230,7 +227,7 @@ impl Derivation {
         &mut self,
         name: &str,
         drv_replacement_str: &str,
-    ) -> Result<(), ValidateDerivationError> {
+    ) -> Result<(), DerivationError> {
         let mut hasher = Sha256::new();
 
         // Check if the Derivation is fixed output, because they cause