about summary refs log tree commit diff
path: root/tvix/glue/src/tvix_store_io.rs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-06-13T12·22+0300
committerclbot <clbot@tvl.fyi>2024-06-13T19·59+0000
commitb992ca49a6dc1d1839e7a97b4a6f32a51e915482 (patch)
tree11f652fb74c0c407d30e0275ce48c948339a8570 /tvix/glue/src/tvix_store_io.rs
parentc30fded8807e333b1037cf3170bdb3bfe7b6eecc (diff)
fix(tvix/glue/tvix_store_io): also populate input sources r/8265
These also need to be present in the input nodes of the BuildRequest.

Change-Id: Ie9b957805e42f766002581adc6182a6543c5333b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11802
Reviewed-by: Brian Olsen <me@griff.name>
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/glue/src/tvix_store_io.rs')
-rw-r--r--tvix/glue/src/tvix_store_io.rs25
1 files changed, 23 insertions, 2 deletions
diff --git a/tvix/glue/src/tvix_store_io.rs b/tvix/glue/src/tvix_store_io.rs
index 7ee6e19ee31c..489f020436c7 100644
--- a/tvix/glue/src/tvix_store_io.rs
+++ b/tvix/glue/src/tvix_store_io.rs
@@ -188,7 +188,7 @@ impl TvixStoreIO {
                         // Provide them, which means, here is where we recursively build
                         // all dependencies.
                         #[allow(clippy::mutable_key_type)]
-                        let input_nodes: BTreeSet<Node> =
+                        let mut input_nodes: BTreeSet<Node> =
                             futures::stream::iter(drv.input_derivations.iter())
                                 .map(|(input_drv_path, output_names)| {
                                     // look up the derivation object
@@ -244,6 +244,27 @@ impl TvixStoreIO {
                                 .try_collect()
                                 .await?;
 
+                        // add input sources
+                        // FUTUREWORK: merge these who things together
+                        #[allow(clippy::mutable_key_type)]
+                        let input_nodes_input_sources: BTreeSet<Node> =
+                            futures::stream::iter(drv.input_sources.iter())
+                                .then(|input_source| {
+                                    Box::pin(async {
+                                        let node = self
+                                            .store_path_to_node(input_source, Path::new(""))
+                                            .await?;
+                                        if let Some(node) = node {
+                                            Ok(node)
+                                        } else {
+                                            Err(io::Error::other("no node produced"))
+                                        }
+                                    })
+                                })
+                                .try_collect()
+                                .await?;
+                        input_nodes.extend(input_nodes_input_sources);
+
                         span.pb_set_message(&format!("🔨Building {}", &store_path));
 
                         // TODO: check if input sources are sufficiently dealth with,
@@ -261,7 +282,7 @@ impl TvixStoreIO {
                             .await
                             .map_err(|e| std::io::Error::new(io::ErrorKind::Other, e))?;
 
-                        // TODO: refscan?
+                        // TODO: refscan
 
                         // For each output, insert a PathInfo.
                         for output in &build_result.outputs {