My aggregated monorepo of OCaml code, automaintained
0
fork

Configure Feed

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

Mount merged opam-repository into containers at runtime

Instead of relying on the repo baked into the base image, create
a merged repo from all --opam-repository sources at the start of
each batch run and bind-mount it over /home/opam/.opam/repo/default.
This matches day10's approach and means repo changes (like adding
patches to the local repo) take effect immediately without
--rebuild-base.

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

+21 -1
+21 -1
day11/bin/cmd_batch.ml
··· 352 352 in 353 353 let benv = Day11_build.Types.make_build_env ~base ~os_dir () in 354 354 Day11_build.Types.ensure_dirs benv; 355 + (* Create merged opam-repository and mount into containers — 356 + picks up changes without rebuilding the base image *) 357 + let merged_repo_dir = Fpath.(cache_dir / "merged-repo") in 358 + ignore (Day11_exec.Sudo.rm_rf env merged_repo_dir); 359 + Bos.OS.Dir.create ~path:true merged_repo_dir |> ignore; 360 + List.iteri (fun i repo -> 361 + let src = Fpath.v repo in 362 + if i = 0 then 363 + ignore (Day11_exec.Tree.copy ~source:src ~target:merged_repo_dir) 364 + else 365 + (* Overlay: copy packages/ from later repos, overwriting *) 366 + let src_pkgs = Fpath.(src / "packages") in 367 + if Bos.OS.Dir.exists src_pkgs |> Result.get_ok then 368 + ignore (Sys.command (Printf.sprintf "cp -a %s/* %s/packages/" 369 + (Fpath.to_string src_pkgs) (Fpath.to_string merged_repo_dir))) 370 + ) opam_repositories; 371 + let repo_mount = Day11_container.Mount.bind_ro 372 + ~src:(Fpath.to_string merged_repo_dir) 373 + "/home/opam/.opam/repo/default" in 355 374 (* Bless *) 356 375 let blessing_maps = Day11_batch.Blessing.compute_blessings solutions in 357 376 (* Build *) ··· 393 412 end) 394 413 nodes 395 414 (fun node -> 396 - match Day11_build.Build_layer.build env benv ?patches node () with 415 + match Day11_build.Build_layer.build env benv ?patches 416 + ~mounts:[repo_mount] node () with 397 417 | Day11_build.Types.Success _ -> true 398 418 | _ -> false); 399 419 let n_succeeded = Atomic.get succeeded in