Skip to content

Commit

Permalink
Only run codesign if there have been substitutions
Browse files Browse the repository at this point in the history
This ensures that we're not running `codesign` in cases we don't
strictly need it. This in turn prevents a regression in macos+nix, where
the codesign binary is not in PATH.

Closes #6226

Signed-off-by: Etienne Millon <me@emillon.org>
  • Loading branch information
emillon committed Oct 14, 2022
1 parent b02b6f6 commit c2230a8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@
Coq's standard library by including `(stdlib no)`.
(#6165 #6164, fixes #6163, @ejgallego @Alizter @LasseBlaauwbroek)

- on macOS, sign executables produced by artifact substitution (#6137, fixes
#5650, @emillon)
- on macOS, sign executables produced by artifact substitution (#6137, #6231,
fixes #5650, fixes #6226, @emillon)

- Added an (aliases ...) field to the (rules ...) stanza which allows the
specification of multiple aliases per rule (#6194, @Alizter)
Expand Down
12 changes: 6 additions & 6 deletions src/dune_rules/artifact_substitution.ml
Original file line number Diff line number Diff line change
Expand Up @@ -568,10 +568,10 @@ let copy_file_non_atomic ~conf ?chmod ~src ~dst () =
Fiber.return ())
(fun () -> copy ~conf ~input_file:src ~input:(input ic) ~output:(output oc))

let run_sign_hook conf file =
match conf.sign_hook with
| Some hook -> hook file
| None -> Fiber.return ()
let run_sign_hook conf ~has_subst file =
match (conf.sign_hook, has_subst) with
| Some hook, true -> hook file
| _ -> Fiber.return ()

(** This is just an optimisation: skip the renaming if the destination exists
and has the right digest. The optimisation is useful to avoid unnecessary
Expand Down Expand Up @@ -611,10 +611,10 @@ let copy_file ~conf ?chmod ?(delete_dst_if_it_is_a_directory = false) ~src ~dst
Fiber.finalize
(fun () ->
let open Fiber.O in
let* (_ : bool) =
let* has_subst =
copy_file_non_atomic ~conf ?chmod ~src ~dst:temp_file ()
in
let+ () = run_sign_hook conf temp_file in
let+ () = run_sign_hook conf ~has_subst temp_file in
replace_if_different ~delete_dst_if_it_is_a_directory ~src:temp_file ~dst)
~finally:(fun () ->
Path.unlink_no_err temp_file;
Expand Down

0 comments on commit c2230a8

Please sign in to comment.