Skip to content

Commit ebfbd69

Browse files
committed
Revert "fix(pkg): Create temporary directories on same FS"
This reverts commit 9a68cd0. This change has been upstreamed.
1 parent 3dff28b commit ebfbd69

File tree

5 files changed

+14
-35
lines changed

5 files changed

+14
-35
lines changed

Diff for: src/dune_pkg/fetch.ml

+4-13
Original file line numberDiff line numberDiff line change
@@ -195,19 +195,9 @@ let unpack ~target ~archive =
195195
Pp.textf "unable to extract %S" (Path.to_string archive))
196196
;;
197197
198-
let with_download url checksum ~target ~f =
198+
let with_download url checksum ~f =
199199
let url = OpamUrl.to_string url in
200-
let temp_dir =
201-
let prefix = "dune" in
202-
let suffix = Filename.basename url in
203-
match (target : Path.t) with
204-
| In_build_dir _ ->
205-
Temp.temp_in_dir Dir ~dir:(Lazy.force Temp_dir.in_build) ~prefix ~suffix
206-
| _ ->
207-
let parent = Path.parent_exn target in
208-
Path.mkdir_p parent;
209-
Temp.temp_in_dir Dir ~dir:parent ~prefix ~suffix
210-
in
200+
let temp_dir = Temp.create Dir ~prefix:"dune" ~suffix:(Filename.basename url) in
211201
let output = Path.relative temp_dir "download" in
212202
Fiber.finalize ~finally:(fun () ->
213203
Temp.destroy Dir temp_dir;
@@ -232,9 +222,10 @@ let with_download url checksum ~target ~f =
232222
;;
233223
234224
let fetch_curl ~unpack:unpack_flag ~checksum ~target (url : OpamUrl.t) =
235-
with_download url checksum ~target ~f:(fun output ->
225+
with_download url checksum ~f:(fun output ->
236226
match unpack_flag with
237227
| false ->
228+
Path.mkdir_p (Path.parent_exn target);
238229
Path.rename output target;
239230
Fiber.return @@ Ok ()
240231
| true ->

Diff for: src/dune_pkg/rev_store.ml

+1-7
Original file line numberDiff line numberDiff line change
@@ -710,13 +710,7 @@ module At_rev = struct
710710
let check_out { repo = { dir; _ }; revision = Sha1 rev; files = _ } ~target =
711711
(* TODO iterate over submodules to output sources *)
712712
let git = Lazy.force Vcs.git in
713-
let temp_dir =
714-
Temp.temp_in_dir
715-
Dir
716-
~dir:(Lazy.force Temp_dir.in_build)
717-
~prefix:"rev-store"
718-
~suffix:rev
719-
in
713+
let temp_dir = Temp.create Dir ~prefix:"rev-store" ~suffix:rev in
720714
Fiber.finalize ~finally:(fun () ->
721715
let+ () = Fiber.return () in
722716
Temp.destroy Dir temp_dir)

Diff for: src/dune_pkg/tar.ml

+9-4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ let bin =
1111

1212
let output_limit = 1_000_000
1313

14+
let temp_dir_in_build =
15+
lazy
16+
(let dir = Path.relative (Path.build Path.Build.root) ".temp" in
17+
Path.mkdir_p dir;
18+
dir)
19+
;;
20+
1421
let extract ~archive ~target =
1522
let* () = Fiber.return () in
1623
let tar = Lazy.force bin in
@@ -19,10 +26,8 @@ let extract ~archive ~target =
1926
let suffix = Path.basename archive in
2027
match target with
2128
| In_build_dir _ ->
22-
Temp.temp_in_dir Dir ~dir:(Lazy.force Temp_dir.in_build) ~prefix ~suffix
23-
| _ ->
24-
let parent = Path.parent_exn target in
25-
Temp.temp_in_dir Dir ~dir:parent ~prefix ~suffix
29+
Temp.temp_in_dir Dir ~dir:(Lazy.force temp_dir_in_build) ~prefix ~suffix
30+
| _ -> Temp.create Dir ~prefix ~suffix
2631
in
2732
Fiber.finalize ~finally:(fun () ->
2833
Temp.destroy Dir target_in_temp;

Diff for: src/dune_pkg/temp_dir.ml

-8
This file was deleted.

Diff for: src/dune_pkg/temp_dir.mli

-3
This file was deleted.

0 commit comments

Comments
 (0)