diff options
author | Florian Klink <flokli@flokli.de> | 2024-06-26T11·35+0300 |
---|---|---|
committer | flokli <flokli@flokli.de> | 2024-06-26T14·25+0000 |
commit | aa7d125c12eb7950bf522d4dfe094223df42743b (patch) | |
tree | c2b18fdb743997e985bd0c3f5c32baff2f9935ac /tvix/glue/src | |
parent | b757897e97dd86b8f0e9a8130277695e25caed12 (diff) |
refactor(tvix/eval): prefix ctx iterators in NixString r/8314
NixString::iter_plain() didn't make much sense, especially without a docstring. Rename it to iter_ctx_plain(), and copy the docstring from NixContext. Do the same for the two other context element types too. Change-Id: I1bbfcb967d8d9b14487d069bfe3a1f762253ef4d Reviewed-on: https://cl.tvl.fyi/c/depot/+/11882 Tested-by: BuildkiteCI Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com> Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/glue/src')
-rw-r--r-- | tvix/glue/src/builtins/derivation.rs | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/tvix/glue/src/builtins/derivation.rs b/tvix/glue/src/builtins/derivation.rs index 8400dcea13fe..473aa9d5e315 100644 --- a/tvix/glue/src/builtins/derivation.rs +++ b/tvix/glue/src/builtins/derivation.rs @@ -554,7 +554,9 @@ pub(crate) mod derivation_builtins { .to_contextful_str() .context("evaluating the `content` parameter of builtins.toFile")?; - if content.iter_derivation().count() > 0 || content.iter_single_outputs().count() > 0 { + if content.iter_ctx_derivation().count() > 0 + || content.iter_ctx_single_outputs().count() > 0 + { return Err(ErrorKind::UnexpectedContext); } @@ -568,13 +570,14 @@ pub(crate) mod derivation_builtins { let blob_digest = blob_writer.close().await?; let ca_hash = CAHash::Text(Sha256::digest(&content).into()); - let store_path = build_ca_path(name.to_str()?, &ca_hash, content.iter_plain(), false) - .map_err(|_e| { - nix_compat::derivation::DerivationError::InvalidOutputName( - name.to_str_lossy().into_owned(), - ) - }) - .map_err(DerivationError::InvalidDerivation)?; + let store_path = + build_ca_path(name.to_str()?, &ca_hash, content.iter_ctx_plain(), false) + .map_err(|_e| { + nix_compat::derivation::DerivationError::InvalidOutputName( + name.to_str_lossy().into_owned(), + ) + }) + .map_err(DerivationError::InvalidDerivation)?; let root_node = Node::File(FileNode { name: store_path.to_string().into(), @@ -592,7 +595,7 @@ pub(crate) mod derivation_builtins { // assemble references from plain context. let reference_paths: Vec<StorePathRef> = content - .iter_plain() + .iter_ctx_plain() .map(|elem| StorePathRef::from_absolute_path(elem.as_bytes())) .collect::<Result<_, _>>() .map_err(|e| ErrorKind::TvixError(Rc::new(e)))?; |