about summary refs log tree commit diff
path: root/tvix/derivation/src/output.rs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-01-16T14·55+0100
committerflokli <flokli@flokli.de>2023-01-18T17·13+0000
commit083e24bbb1a216b43bfa4fa2e509a1ee6a88ad46 (patch)
treecf9e6bfe77cbcc801934470ffdfce4b9f119db90 /tvix/derivation/src/output.rs
parentb1e8fe7212618a61b78eeefa65075295fe2e40b2 (diff)
feat(tvix/derivation): add validate_output_paths flag for validate r/5700
This allows calling validate() on a derivation that doesn't have its
output paths already calculated yet. It allows offloading some of the
error checking in builtins.derivation* to be offloaded to that function.

Change-Id: Ib4aeadc0eb6583ef8cd765f33e9a9ec32be62729
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7848
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/derivation/src/output.rs')
-rw-r--r--tvix/derivation/src/output.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/tvix/derivation/src/output.rs b/tvix/derivation/src/output.rs
index 982ac7c9eb..369efca031 100644
--- a/tvix/derivation/src/output.rs
+++ b/tvix/derivation/src/output.rs
@@ -24,10 +24,12 @@ impl Output {
         self.hash.is_some()
     }
 
-    pub fn validate(&self) -> Result<(), OutputError> {
+    pub fn validate(&self, validate_output_paths: bool) -> Result<(), OutputError> {
         // TODO: add validation for hash, hashAlgo
-        if let Err(e) = StorePath::from_absolute_path(&self.path) {
-            return Err(OutputError::InvalidOutputPath(self.path.to_string(), e));
+        if validate_output_paths {
+            if let Err(e) = StorePath::from_absolute_path(&self.path) {
+                return Err(OutputError::InvalidOutputPath(self.path.to_string(), e));
+            }
         }
         Ok(())
     }