summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-07-14 09:34:29 +0100
committerZubin <zubin.duggal@gmail.com>2021-10-12 06:43:25 +0000
commitf176e86996047b9c84060ab35257056f219f2aef (patch)
tree9d31ab1f9d9386fbb3cd871e65d467c51662ada3
parent5a6255934a26e32c7ea696af1dc12ddb504db862 (diff)
downloadhaskell-f176e86996047b9c84060ab35257056f219f2aef.tar.gz
hadrian: Call ghc-pkg recache after copying package database into bindist
The package.cache needs to have a later mod-time than all of the .conf files. This invariant can be destroyed by `cp -r` and so we run `ghc-pkg recache` to ensure the package database which is distributed is consistent. If you are installing a relocatable bindist, for example, on windows, you should preserve mtimes by using cp -a or run ghc-pkg recache after installing. (cherry picked from commit 957fe3596e8a184ab6c4fe41be5c2f07c516fcbe)
-rw-r--r--hadrian/src/Rules/BinaryDist.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/hadrian/src/Rules/BinaryDist.hs b/hadrian/src/Rules/BinaryDist.hs
index af0088ddff..9a0a1e71e4 100644
--- a/hadrian/src/Rules/BinaryDist.hs
+++ b/hadrian/src/Rules/BinaryDist.hs
@@ -167,6 +167,11 @@ bindistRules = do
copyDirectory (ghcBuildDir -/- "lib") bindistFilesDir
copyDirectory (rtsIncludeDir) bindistFilesDir
+ -- Call ghc-pkg recache, after copying so the package.cache is
+ -- accurate, then it's on the distributor to use `cp -a` to install
+ -- a relocatable bindist.
+ cmd_ (bindistFilesDir -/- "bin" -/- "ghc-pkg") ["recache"]
+
unless cross $ need ["docs"]
-- TODO: we should only embed the docs that have been generated