My aggregated monorepo of OCaml code, automaintained
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix --rebuild-base to delete before loading cached base

The base was loaded before --rebuild-base ran, so the old cached
base was returned and Docker reused the stale image. Now deletion
happens early (before load_cached), and the old Docker image is
rebuilt from scratch with --no-cache.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+12 -9
+12 -9
day11/bin/cmd_batch.ml
··· 244 244 let find_opam = Day11_solver.Git_packages.find_package git_packages in 245 245 let patches = Option.map (fun dir -> 246 246 Day11_build.Patches.create (Fpath.v dir)) patches_dir in 247 - (* Try to load cached base image for DAG construction. 248 - dry-run works without Eio if base is already cached. *) 247 + (* Delete base image early if --rebuild-base, before loading *) 248 + if rebuild_base then begin 249 + let base_dir = Fpath.(cache_dir / "base") in 250 + Printf.printf "Deleting base image and all build layers for rebuild...\n%!"; 251 + ignore (Bos.OS.Path.delete ~recurse:true base_dir); 252 + let os_dir_pre = Fpath.(cache_dir / Printf.sprintf "%s-%s-%s" 253 + os_distribution os_version arch) in 254 + (* Need sudo for root-owned layer files *) 255 + Common.with_eio (fun env -> 256 + ignore (Day11_exec.Sudo.rm_rf env os_dir_pre)) 257 + end; 258 + (* Try to load cached base image for DAG construction. *) 249 259 let base_opt = Day11_build.Base.load_cached ~cache_dir 250 260 ~os_distribution ~os_version in 251 261 let base_hash = match base_opt with ··· 301 311 end else begin 302 312 (* === Build phase (needs Eio, base image, containers) === *) 303 313 Common.with_eio @@ fun env -> 304 - let base_opt = if rebuild_base then begin 305 - let base_dir = Fpath.(cache_dir / "base") in 306 - Printf.printf "Deleting base image and all build layers for rebuild...\n%!"; 307 - ignore (Day11_exec.Sudo.rm_rf env base_dir); 308 - ignore (Day11_exec.Sudo.rm_rf env os_dir); 309 - None 310 - end else base_opt in 311 314 let base = match base_opt with 312 315 | Some b -> b 313 316 | None ->