Skip to content

Commit

Permalink
toolchain: Remove locations from pkg before hashing (#10902)
Browse files Browse the repository at this point in the history
When computing the hash of a toolchain package, first remove all
locations. Without doing this, identical compiler packages inside
different lockdirs will have different hashes and require
unnecessarily recompiling the compiler package.

Signed-off-by: Stephen Sherratt <[email protected]>
  • Loading branch information
gridbugs authored Sep 11, 2024
1 parent c50d37b commit 97cc5d8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/dune_pkg/lock_dir.mli
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module Pkg : sig
; exported_env : String_with_vars.t Action.Env_update.t list
}

val remove_locs : t -> t
val equal : t -> t -> bool
val decode : (lock_dir:Path.Source.t -> Package_name.t -> t) Decoder.t
val files_dir : Package_name.t -> lock_dir:Path.Source.t -> Path.Source.t
Expand Down
2 changes: 1 addition & 1 deletion src/dune_rules/pkg_toolchain.ml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ let pkg_dir (pkg : Dune_pkg.Lock_dir.Pkg.t) =
way). *)
let dir_name =
(* TODO should include resolved deps *)
let pkg_hash = Digest.generic pkg in
let pkg_hash = Digest.generic (Lock_dir.Pkg.remove_locs pkg) in
(* A hash of the fields of a package that affect its installed artifacts *)
sprintf
"%s.%s-%s"
Expand Down

0 comments on commit 97cc5d8

Please sign in to comment.