Skip to content

Commit

Permalink
fix: create lock dir parent if missing (ocaml#10876)
Browse files Browse the repository at this point in the history
fix: lock creates parent dir if missing

Signed-off-by: Etienne Marais <dev@maiste.fr>
  • Loading branch information
maiste authored and anmonteiro committed Nov 17, 2024
1 parent 633a2b8 commit 8f0ca0d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/dune_pkg/lock_dir.ml
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,9 @@ module Write_disk = struct
in
match Path.(parent (source lock_dir_path_src)) with
| Some parent_dir ->
fun () -> Temp.with_temp_dir ~parent_dir ~prefix:"dune" ~suffix:"lock" ~f:build
fun () ->
Path.mkdir_p parent_dir;
Temp.with_temp_dir ~parent_dir ~prefix:"dune" ~suffix:"lock" ~f:build
| None ->
User_error.raise
[ Pp.textf "Temporary directory can't be created by deriving the lock dir path" ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@ Create a lock directory that didn't originally exist
> (lang dune 3.10)
> (lock_dir
> (repositories mock))
> (lock_dir
> (path "dev/dune.lock")
> (repositories mock))
> (repository
> (name mock)
> (source "file://$(pwd)/mock-opam-repository"))
> EOF
$ dune pkg lock "dev/dune.lock"
Solution for dev/dune.lock:
(no dependencies to lock)
$ dune pkg lock
Solution for dune.lock:
(no dependencies to lock)
Expand Down

0 comments on commit 8f0ca0d

Please sign in to comment.