about summary refs log tree commit diff
path: root/tvix/nix-compat/src/derivation
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/nix-compat/src/derivation')
-rw-r--r--tvix/nix-compat/src/derivation/output.rs2
-rw-r--r--tvix/nix-compat/src/derivation/tests/mod.rs5
-rw-r--r--tvix/nix-compat/src/derivation/validate.rs12
3 files changed, 10 insertions, 9 deletions
diff --git a/tvix/nix-compat/src/derivation/output.rs b/tvix/nix-compat/src/derivation/output.rs
index 4bfc7bf8014d..37161cbe98b5 100644
--- a/tvix/nix-compat/src/derivation/output.rs
+++ b/tvix/nix-compat/src/derivation/output.rs
@@ -27,7 +27,7 @@ impl Output {
             }
         }
         if validate_output_paths {
-            if let Err(e) = StorePath::from_absolute_path(&self.path) {
+            if let Err(e) = StorePath::from_absolute_path(self.path.as_bytes()) {
                 return Err(OutputError::InvalidOutputPath(self.path.to_string(), e));
             }
         }
diff --git a/tvix/nix-compat/src/derivation/tests/mod.rs b/tvix/nix-compat/src/derivation/tests/mod.rs
index 5daa16da03cb..f4070b2496f4 100644
--- a/tvix/nix-compat/src/derivation/tests/mod.rs
+++ b/tvix/nix-compat/src/derivation/tests/mod.rs
@@ -6,6 +6,7 @@ use std::collections::BTreeSet;
 use std::fs::File;
 use std::io::Read;
 use std::path::Path;
+use std::str::FromStr;
 use test_case::test_case;
 use test_generator::test_resources;
 
@@ -67,7 +68,7 @@ fn derivation_path(name: &str, expected_path: &str) {
 
     assert_eq!(
         derivation.calculate_derivation_path(name).unwrap(),
-        StorePath::from_string(expected_path).unwrap()
+        StorePath::from_str(expected_path).unwrap()
     );
 }
 
@@ -307,7 +308,7 @@ fn output_path_construction() {
     assert_eq!(foo_drv_expected, foo_drv);
 
     assert_eq!(
-        StorePath::from_string("4wvvbi4jwn0prsdxb7vs673qa5h9gr7x-foo.drv").expect("must succeed"),
+        StorePath::from_str("4wvvbi4jwn0prsdxb7vs673qa5h9gr7x-foo.drv").expect("must succeed"),
         foo_drv
             .calculate_derivation_path("foo")
             .expect("must succeed")
diff --git a/tvix/nix-compat/src/derivation/validate.rs b/tvix/nix-compat/src/derivation/validate.rs
index d8dc24a92ae1..6b81c4c80b86 100644
--- a/tvix/nix-compat/src/derivation/validate.rs
+++ b/tvix/nix-compat/src/derivation/validate.rs
@@ -1,5 +1,5 @@
 use crate::derivation::{Derivation, DerivationError};
-use crate::store_path::StorePath;
+use crate::store_path::{self, StorePath};
 
 impl Derivation {
     /// validate ensures a Derivation struct is properly populated,
@@ -26,10 +26,10 @@ impl Derivation {
             // meaning.
             //
             // Other output names that don't match the name restrictions from
-            // [StorePath] will fail the [StorePath::validate_name] check.
+            // [StorePath] will fail the [store_path::validate_name] check.
             if output_name.is_empty()
                 || output_name == "drv"
-                || StorePath::validate_name(output_name).is_err()
+                || store_path::validate_name(output_name.as_bytes()).is_err()
             {
                 return Err(DerivationError::InvalidOutputName(output_name.to_string()));
             }
@@ -55,7 +55,7 @@ impl Derivation {
         // Validate all input_derivations
         for (input_derivation_path, output_names) in &self.input_derivations {
             // Validate input_derivation_path
-            if let Err(e) = StorePath::from_absolute_path(input_derivation_path) {
+            if let Err(e) = StorePath::from_absolute_path(input_derivation_path.as_bytes()) {
                 return Err(DerivationError::InvalidInputDerivationPath(
                     input_derivation_path.to_string(),
                     e,
@@ -86,7 +86,7 @@ impl Derivation {
                 // [StorePath] will fail the [StorePath::validate_name] check.
                 if output_name.is_empty()
                     || output_name == "drv"
-                    || StorePath::validate_name(output_name).is_err()
+                    || store_path::validate_name(output_name.as_bytes()).is_err()
                 {
                     return Err(DerivationError::InvalidInputDerivationOutputName(
                         input_derivation_path.to_string(),
@@ -98,7 +98,7 @@ impl Derivation {
 
         // Validate all input_sources
         for input_source in self.input_sources.iter() {
-            if let Err(e) = StorePath::from_absolute_path(input_source) {
+            if let Err(e) = StorePath::from_absolute_path(input_source.as_bytes()) {
                 return Err(DerivationError::InvalidInputSourcesPath(
                     input_source.to_string(),
                     e,