diff options
| author | ยท๐๐ด๐๐๐ฉ๐ค | 2025-12-30 14:28:21 +0000 |
|---|---|---|
| committer | ยท๐๐ด๐๐๐ฉ๐ค | 2025-12-30 14:28:21 +0000 |
| commit | 51b29e579692317725b6020075007cbec403ee19 (patch) | |
| tree | 3fbd5127b4e25ebaf02eb07aa6a828e5ab8f71d2 /lib/input_foreman.ml | |
| parent | ee33293e9b9345e9f437390537f91b664ed81e88 (diff) | |
| download | nixtaml-51b29e579692317725b6020075007cbec403ee19.tar nixtaml-51b29e579692317725b6020075007cbec403ee19.tar.gz nixtaml-51b29e579692317725b6020075007cbec403ee19.tar.bz2 nixtaml-51b29e579692317725b6020075007cbec403ee19.tar.lz nixtaml-51b29e579692317725b6020075007cbec403ee19.tar.xz nixtaml-51b29e579692317725b6020075007cbec403ee19.tar.zst nixtaml-51b29e579692317725b6020075007cbec403ee19.zip | |
silo: unlisted input cleanup
Diffstat (limited to 'lib/input_foreman.ml')
| -rw-r--r-- | lib/input_foreman.ml | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/input_foreman.ml b/lib/input_foreman.ml index 01b2926..10ae67a 100644 --- a/lib/input_foreman.ml +++ b/lib/input_foreman.ml @@ -174,6 +174,26 @@ let to_lockfile mk = (fun acc (name, input) -> NameMap.add name (mk input) acc) NameMap.empty +let clean_unlisted_from_silo () = + Logs.debug (fun m -> m "Silo: cleaning unlisted โฆ"); + let silo_path = Eio.Path.(Working_directory.(get () / silo_dir)) in + Eio.Path.read_dir silo_path + |> List.iter (fun name -> + if not (Htbl.mem inputs (Name.make name)) then + let path = Eio.Path.(silo_path / name) in + match Eio.Path.kind ~follow: false path with + | `Symbolic_link -> + Eio.Path.unlink path; + Logs.info (fun m -> m "Silo: unlinked %a." Eio.Path.pp path) + | `Directory | `Regular_file | `Socket -> + Eio.Path.rmtree path; + Logs.info (fun m -> m "Silo: removed %a." Eio.Path.pp path) + | _ -> + () + else + () + ) + let cp_darcs_context ~env ~(name : Name.t) ~context = let (let*) = Result.bind in let original_path = |
