My aggregated monorepo of OCaml code, automaintained
0
fork

Configure Feed

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

Always use cp merge instead of overlayfs multi-lower for dep stacking

overlayfs multi-lower does NOT merge directories across layers — only
the topmost layer's version of a directory is visible. This broke
packages depending on multiple conf packages that install into the
same system directories (e.g. /usr/include/GL/).

Now always uses Stack.merge (cp --archive --link --no-target-directory)
to combine all dep layers into a single lower dir, like day10 does.
Hard links mean no extra disk space. Files from all layers are visible
in the same directory tree.

Fixes lablgl.1.05 and likely many other failures involving
conf-* packages.

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

+7 -13
+7 -13
day11/build/run_in_layers.ml
··· 54 54 let merged = Fpath.(temp_dir / "merged") in 55 55 let lower = Fpath.(temp_dir / "lower") in 56 56 List.iter mkdir [ upper; work; merged ]; 57 - (* Use overlayfs multi-lower when possible (zero copy, instant). 58 - Fall back to cp-merge when there are too many layers — the mount 59 - options string is limited to one page (4096 bytes). *) 60 - let all_layer_fs_dirs = List.filter_map (fun dir -> 61 - let fs = Fpath.(dir / "fs") in 62 - if Bos.OS.Dir.exists fs |> Result.get_ok then Some fs else None 63 - ) build_dirs in 64 - let lowerdir_len = List.fold_left (fun acc fs -> 65 - acc + String.length (Fpath.to_string fs) + 1 66 - ) 0 (all_layer_fs_dirs @ [ base_fs ]) in 67 - let use_merge = lowerdir_len > 3500 in 57 + (* Merge all dep layers into a single lower dir using cp --link. 58 + overlayfs multi-lower does NOT merge directories across layers — 59 + only the topmost layer's version of a directory is visible. This 60 + broke packages depending on multiple conf packages that install 61 + into the same system directories (e.g. /usr/include/GL/). *) 68 62 let layer_fs_dirs = 69 - if not use_merge then all_layer_fs_dirs 63 + if build_dirs = [] then [] 70 64 else begin 71 65 mkdir lower; 72 66 let merge_result = ··· 82 76 end 83 77 in 84 78 let cleanup_internals () = 85 - if use_merge then 79 + if build_dirs <> [] then 86 80 ignore (Day11_exec.Sudo.rm_rf env lower); 87 81 ignore (Day11_exec.Sudo.rm_rf env work); 88 82 ignore (Day11_exec.Sudo.rm_rf env merged);