about summary refs log tree commit diff
path: root/tvix/derivation/src
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2023-01-06T15·56+0300
committertazjin <tazjin@tvl.su>2023-01-06T17·57+0000
commit1ebda9e13e0a11d3040267134e0a23600f9faf65 (patch)
tree1b8937eb683278f168ec1ec3ccd2fec50d6eec6f /tvix/derivation/src
parent3e03e59893b77b0b3915224967b377f6e940670d (diff)
fix(tvix/derivation): fix build after StorePath rename r/5616
This project was not previously covered by CI (fixed in this commit),
so we didn't catch breakage due to a renamed module.

This was noticed while rebasing a CL that has a dependency on this
crate in its Nix build.

Change-Id: Ic48570b9313e5f73e14daab50cf7ea70918c94d1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7778
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/derivation/src')
-rw-r--r--tvix/derivation/src/derivation.rs15
-rw-r--r--tvix/derivation/src/output.rs4
-rw-r--r--tvix/derivation/src/tests/mod.rs7
-rw-r--r--tvix/derivation/src/validate.rs2
4 files changed, 12 insertions, 16 deletions
diff --git a/tvix/derivation/src/derivation.rs b/tvix/derivation/src/derivation.rs
index bf26e1baac69..550b386a7fce 100644
--- a/tvix/derivation/src/derivation.rs
+++ b/tvix/derivation/src/derivation.rs
@@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize};
 use sha2::{Digest, Sha256};
 use std::{collections::BTreeMap, fmt, fmt::Write};
 use tvix_store::nixbase32::NIXBASE32;
-use tvix_store::nixpath::{ParseStorePathError, StorePath, STORE_DIR};
+use tvix_store::store_path::{ParseStorePathError, StorePath, STORE_DIR};
 
 #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
 pub struct Derivation {
@@ -242,7 +242,7 @@ impl Derivation {
                     hasher.update(":sha256:");
                     hasher.update(drv_replacement_str);
                     hasher.update(":");
-                    hasher.update(tvix_store::nixpath::STORE_DIR);
+                    hasher.update(STORE_DIR);
                     hasher.update(":");
 
                     // calculate the output_name_path, which is the part of the NixPath after the digest.
@@ -258,7 +258,7 @@ impl Derivation {
 
                     let abs_store_path = format!(
                         "{}/{}",
-                        tvix_store::nixpath::STORE_DIR,
+                        STORE_DIR,
                         build_store_path(false, &digest, &output_path_name)?
                     );
 
@@ -289,17 +289,14 @@ impl Derivation {
                         hasher.update(drv_replacement_str);
                     }
                     hasher.update(":");
-                    hasher.update(tvix_store::nixpath::STORE_DIR);
+                    hasher.update(STORE_DIR);
                     hasher.update(":");
                     hasher.update(name);
                     hasher.finalize()
                 };
 
-                let abs_store_path = format!(
-                    "{}/{}",
-                    tvix_store::nixpath::STORE_DIR,
-                    build_store_path(false, &digest, name)?
-                );
+                let abs_store_path =
+                    format!("{}/{}", STORE_DIR, build_store_path(false, &digest, name)?);
 
                 self.outputs.insert(
                     "out".to_string(),
diff --git a/tvix/derivation/src/output.rs b/tvix/derivation/src/output.rs
index 02ba7e42e885..1236cd989f7f 100644
--- a/tvix/derivation/src/output.rs
+++ b/tvix/derivation/src/output.rs
@@ -1,7 +1,7 @@
 use serde::{Deserialize, Serialize};
-use tvix_store::nixpath::StorePath;
+use tvix_store::store_path::StorePath;
 
-#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
+#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize)]
 pub struct Output {
     pub path: String,
 
diff --git a/tvix/derivation/src/tests/mod.rs b/tvix/derivation/src/tests/mod.rs
index 8d1771f711f6..fb88e1beb2bf 100644
--- a/tvix/derivation/src/tests/mod.rs
+++ b/tvix/derivation/src/tests/mod.rs
@@ -6,7 +6,7 @@ use std::io::Read;
 use std::path::Path;
 use test_case::test_case;
 use test_generator::test_resources;
-use tvix_store::nixpath::StorePath;
+use tvix_store::store_path::StorePath;
 
 const RESOURCES_PATHS: &str = "src/tests/derivation_tests";
 
@@ -252,8 +252,7 @@ fn output_path_construction() {
 
     let bar_drv_path = bar_drv
         .calculate_derivation_path("bar")
-        .expect("must succeed")
-        .to_absolute_path();
+        .expect("must succeed");
 
     // assemble foo env
     let mut foo_env: BTreeMap<String, String> = BTreeMap::new();
@@ -275,7 +274,7 @@ fn output_path_construction() {
 
     // assemble foo input_derivations
     let mut foo_input_derivations: BTreeMap<String, Vec<String>> = BTreeMap::new();
-    foo_input_derivations.insert(bar_drv_path.to_absolute_string(), vec!["out".to_string()]);
+    foo_input_derivations.insert(bar_drv_path.to_absolute_path(), vec!["out".to_string()]);
 
     // assemble foo itself
     let mut foo_drv = Derivation {
diff --git a/tvix/derivation/src/validate.rs b/tvix/derivation/src/validate.rs
index 4e0503833913..eda0457ae564 100644
--- a/tvix/derivation/src/validate.rs
+++ b/tvix/derivation/src/validate.rs
@@ -1,6 +1,6 @@
 use crate::{derivation::Derivation, write::DOT_FILE_EXT};
 use anyhow::bail;
-use tvix_store::nixpath::StorePath;
+use tvix_store::store_path::StorePath;
 
 impl Derivation {
     /// validate ensures a Derivation struct is properly populated,