diff options
author | Vincent Ambo <mail@tazj.in> | 2023-05-17T15·33+0300 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2023-05-18T19·12+0000 |
commit | ba4807e1de44a234fc9499dad0011440cde113fb (patch) | |
tree | 938107dbb5da42d2146221e63003dc68c89f3b29 /tvix/cli/src/nix_compat.rs | |
parent | 7f99eb44a5c734dba27682025f0dbdc253a7cabd (diff) |
refactor(tvix/cli): split CLI-specific IO logic into TvixIO type r/6159
This adds a wrapper type TvixIO<T: EvalIO>, which can wrap around an arbitrary EvalIO implementation and perform actions needed for the Tvix CLI (marking imported paths as known, and handling __corepkgs__). Change-Id: I5fc1ca199b9f94b21a89103b84575e0f8f58dff9 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8579 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/cli/src/nix_compat.rs')
-rw-r--r-- | tvix/cli/src/nix_compat.rs | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/tvix/cli/src/nix_compat.rs b/tvix/cli/src/nix_compat.rs index 1c9f6ba54ef1..70bddb834674 100644 --- a/tvix/cli/src/nix_compat.rs +++ b/tvix/cli/src/nix_compat.rs @@ -9,10 +9,8 @@ use std::cell::RefCell; use std::collections::HashMap; use std::path::Path; use std::process::Command; -use std::rc::Rc; use std::{io, path::PathBuf}; -use crate::known_paths::KnownPaths; use smol_str::SmolStr; use tvix_eval::{ErrorKind, EvalIO, FileType, StdIO}; @@ -23,10 +21,6 @@ pub struct NixCompatIO { /// instead. underlying: StdIO, - /// Ingested paths must be reported to this known paths tracker - /// for accurate build reference scanning. - known_paths: Rc<RefCell<KnownPaths>>, - /// Cache paths for identical files being imported to the store. // TODO(tazjin): This could be done better by having a thunk cache // for these calls on the eval side, but that is a little more @@ -86,11 +80,10 @@ impl EvalIO for NixCompatIO { } impl NixCompatIO { - pub fn new(known_paths: Rc<RefCell<KnownPaths>>) -> Self { + pub fn new() -> Self { NixCompatIO { underlying: StdIO, import_cache: RefCell::new(HashMap::new()), - known_paths, } } @@ -118,8 +111,6 @@ impl NixCompatIO { .map_err(|err| io::Error::new(io::ErrorKind::InvalidData, err))?; let out_path_trimmed = out_path_str.trim(); - self.known_paths.borrow_mut().plain(out_path_trimmed); - let mut out_path = PathBuf::new(); out_path.push(out_path_trimmed); Ok(out_path) |