My aggregated monorepo of OCaml code, automaintained
0
fork

Configure Feed

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

Refresh package symlinks when a layer is actually built

Previously the symlink was only created if it didn't exist. Now it's
replaced on every build, so it always points to the latest layer for
that package. Cache hits don't touch the symlink.

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

+6 -3
+6 -3
day11/layer/package_symlinks.ml
··· 4 4 let target = Filename.concat ".." (Filename.concat ".." layer_name) in 5 5 try 6 6 Bos.OS.Dir.create ~path:true pkg_dir |> ignore; 7 - if not (Bos.OS.Path.exists symlink_path |> Result.get_ok) then 8 - (try Unix.symlink target (Fpath.to_string symlink_path) 9 - with Unix.Unix_error (Unix.EEXIST, _, _) -> ()); 7 + (* Remove existing symlink and recreate — ensures it points to 8 + the latest build, not just the first one ever created *) 9 + (try Unix.unlink (Fpath.to_string symlink_path) 10 + with Unix.Unix_error (Unix.ENOENT, _, _) -> ()); 11 + (try Unix.symlink target (Fpath.to_string symlink_path) 12 + with Unix.Unix_error (Unix.EEXIST, _, _) -> ()); 10 13 Ok () 11 14 with exn -> 12 15 Rresult.R.error_msgf "ensure_layer_symlink %s/%s: %s"