Skip to content

Commit 129ec22

Browse files
committed
Include the compiler ABI hash in the package hash
This complements the previous commit in order to fix #9326
1 parent a0eec76 commit 129ec22

File tree

6 files changed

+19
-9
lines changed

6 files changed

+19
-9
lines changed

Cabal/src/Distribution/Simple/GHC.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ module Distribution.Simple.GHC
8282
import Distribution.Compat.Prelude
8383
import Prelude ()
8484

85-
import Control.Monad (forM_, msum)
85+
import Control.Monad (forM_)
8686
import Data.List (stripPrefix)
8787
import qualified Data.Map as Map
8888
import Distribution.CabalSpecVersion

cabal-install/src/Distribution/Client/PackageHash.hs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
-- * the package tarball
1111
-- * the ids of all the direct dependencies
1212
-- * other local configuration (flags, profiling, etc)
13+
--
14+
-- See 'PackageHashInputs' for a detailed list of what determines the hash.
1315
module Distribution.Client.PackageHash
1416
( -- * Calculating package hashes
1517
PackageHashInputs (..)
@@ -38,7 +40,8 @@ import Distribution.Package
3840
, mkComponentId
3941
)
4042
import Distribution.Simple.Compiler
41-
( CompilerId
43+
( AbiTag (..)
44+
, CompilerId
4245
, DebugInfoLevel (..)
4346
, OptimisationLevel (..)
4447
, PackageDB
@@ -191,6 +194,7 @@ type PackageSourceHash = HashValue
191194
-- package hash.
192195
data PackageHashConfigInputs = PackageHashConfigInputs
193196
{ pkgHashCompilerId :: CompilerId
197+
, pkgHashCompilerABI :: AbiTag
194198
, pkgHashPlatform :: Platform
195199
, pkgHashFlagAssignment :: FlagAssignment -- complete not partial
196200
, pkgHashConfigureScriptArgs :: [String] -- just ./configure for build-type Configure
@@ -301,6 +305,7 @@ renderPackageHashInputs
301305
pkgHashDirectDeps
302306
, -- and then all the config
303307
entry "compilerid" prettyShow pkgHashCompilerId
308+
, entry "compilerabi" prettyShow pkgHashCompilerABI
304309
, entry "platform" prettyShow pkgHashPlatform
305310
, opt "flags" mempty showFlagAssignment pkgHashFlagAssignment
306311
, opt "configure-script" [] unwords pkgHashConfigureScriptArgs

cabal-install/src/Distribution/Client/ProjectBuilding/UnpackedPackage.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ import Distribution.Simple.BuildPaths (haddockDirName)
7171
import Distribution.Simple.Command (CommandUI)
7272
import Distribution.Simple.Compiler
7373
( PackageDBStack
74-
, compilerId
7574
)
7675
import qualified Distribution.Simple.InstallDirs as InstallDirs
7776
import Distribution.Simple.LocalBuildInfo

cabal-install/src/Distribution/Client/ProjectPlanning.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4310,6 +4310,7 @@ packageHashConfigInputs
43104310
packageHashConfigInputs shared@ElaboratedSharedConfig{..} pkg =
43114311
PackageHashConfigInputs
43124312
{ pkgHashCompilerId = compilerId pkgConfigCompiler
4313+
, pkgHashCompilerABI = compilerAbiTag pkgConfigCompiler
43134314
, pkgHashPlatform = pkgConfigPlatform
43144315
, pkgHashFlagAssignment = elabFlagAssignment
43154316
, pkgHashConfigureScriptArgs = elabConfigureScriptArgs

cabal-testsuite/src/Test/Cabal/Monad.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ import Test.Cabal.TestCode
6363
import Distribution.Pretty (prettyShow)
6464
import Distribution.Simple.Compiler
6565
( PackageDBStack, PackageDB(..), compilerFlavor
66-
, Compiler, compilerVersion, showCompilerId )
66+
, Compiler, compilerVersion, showCompilerIdWithAbi )
6767
import Distribution.System
6868
import Distribution.Simple.Program.Db
6969
import Distribution.Simple.Program
@@ -582,7 +582,7 @@ testLibInstallDir env = libDir </> compilerDir
582582
libDir = case os of
583583
Windows -> testPrefixDir env
584584
_ -> testPrefixDir env </> "lib"
585-
compilerDir = prettyShow platform ++ "-" ++ showCompilerId (testCompiler env)
585+
compilerDir = prettyShow platform ++ "-" ++ showCompilerIdWithAbi (testCompiler env)
586586

587587
-- | The absolute path to the build directory that should be used
588588
-- for the current package in a test.

cabal-testsuite/src/Test/Cabal/OutputNormalizer.hs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,15 @@ normalizeOutput nenv =
5656
-- which will pick up the install ghc library (which doesn't have the
5757
-- date glob).
5858
. (if normalizerGhcVersion nenv /= nullVersion
59-
then resub (posixRegexEscape (display (normalizerGhcVersion nenv))
60-
-- Also glob the date, for nightly GHC builds
61-
++ "(\\.[0-9]+)?")
62-
"<GHCVER>"
59+
then
60+
let ghcver = posixRegexEscape (display (normalizerGhcVersion nenv))
61+
-- Also glob the date, for nightly GHC builds
62+
++ "(\\.[0-9]+)?"
63+
in resub ghcver "<GHCVER>"
64+
. resub (ghcver
65+
-- Also glob the GHC ABI hash, which is used from ghc 9.8
66+
++ "-[a-z0-9]+")
67+
(ghcver ++ "<GHCABI>")
6368
else id)
6469
-- hackage-security locks occur non-deterministically
6570
. resub "(Released|Acquired|Waiting) .*hackage-security-lock\n" ""

0 commit comments

Comments
 (0)