diff --git a/Cabal/src/Distribution/Simple/GHC.hs b/Cabal/src/Distribution/Simple/GHC.hs index 65aa733684f..ea447c4070f 100644 --- a/Cabal/src/Distribution/Simple/GHC.hs +++ b/Cabal/src/Distribution/Simple/GHC.hs @@ -1,6 +1,7 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE MultiWayIf #-} +{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TupleSections #-} @@ -81,7 +82,8 @@ module Distribution.Simple.GHC import Distribution.Compat.Prelude import Prelude () -import Control.Monad (forM_) +import Control.Monad (forM_, msum) +import Data.List (stripPrefix) import qualified Data.Map as Map import Distribution.CabalSpecVersion import Distribution.InstalledPackageInfo (InstalledPackageInfo) @@ -236,10 +238,16 @@ configure verbosity hcPath hcPkgPath conf0 = do filterExt ext = filter ((/= EnableExtension ext) . fst) + compilerId :: CompilerId + compilerId = CompilerId GHC ghcVersion + + compilerAbiTag :: AbiTag + compilerAbiTag = maybe NoAbiTag AbiTag (Map.lookup "Project Unit Id" ghcInfoMap >>= stripPrefix (prettyShow compilerId <> "-")) + let comp = Compiler - { compilerId = CompilerId GHC ghcVersion - , compilerAbiTag = NoAbiTag + { compilerId + , compilerAbiTag , compilerCompat = [] , compilerLanguages = languages , compilerExtensions = extensions diff --git a/cabal-install/src/Distribution/Client/CmdHaddockProject.hs b/cabal-install/src/Distribution/Client/CmdHaddockProject.hs index cac23c9b51b..bde0948dcf9 100644 --- a/cabal-install/src/Distribution/Client/CmdHaddockProject.hs +++ b/cabal-install/src/Distribution/Client/CmdHaddockProject.hs @@ -54,9 +54,6 @@ import Distribution.Client.TargetProblem (TargetProblem (..)) import Distribution.Simple.Command ( CommandUI (..) ) -import Distribution.Simple.Compiler - ( Compiler (..) - ) import Distribution.Simple.Flag ( Flag (..) , fromFlag @@ -319,7 +316,7 @@ haddockProjectAction flags _extraArgs globalFlags = do packageDir = storePackageDirectory (cabalStoreDirLayout cabalLayout) - (compilerId (pkgConfigCompiler sharedConfig')) + (pkgConfigCompiler sharedConfig') (elabUnitId package) docDir = packageDir "share" "doc" "html" destDir = outputDir packageName diff --git a/cabal-install/src/Distribution/Client/CmdInstall.hs b/cabal-install/src/Distribution/Client/CmdInstall.hs index 5de704430f5..00fc32857e0 100644 --- a/cabal-install/src/Distribution/Client/CmdInstall.hs +++ b/cabal-install/src/Distribution/Client/CmdInstall.hs @@ -523,8 +523,7 @@ installAction flags@NixStyleFlags{extraFlags = clientInstallFlags', ..} targetSt -- progDb is a program database with compiler tools configured properly ( compiler@Compiler - { compilerId = - compilerId@(CompilerId compilerFlavor compilerVersion) + { compilerId = CompilerId compilerFlavor compilerVersion } , platform , progDb @@ -537,7 +536,7 @@ installAction flags@NixStyleFlags{extraFlags = clientInstallFlags', ..} targetSt envFile <- getEnvFile clientInstallFlags platform compilerVersion existingEnvEntries <- getExistingEnvEntries verbosity compilerFlavor supportsPkgEnvFiles envFile - packageDbs <- getPackageDbStack compilerId projectConfigStoreDir projectConfigLogsDir + packageDbs <- getPackageDbStack compiler projectConfigStoreDir projectConfigLogsDir installedIndex <- getInstalledPackages verbosity compiler packageDbs progDb let @@ -846,7 +845,7 @@ prepareExeInstall mkUnitBinDir :: UnitId -> FilePath mkUnitBinDir = InstallDirs.bindir - . storePackageInstallDirs' storeDirLayout (compilerId compiler) + . storePackageInstallDirs' storeDirLayout compiler mkExeName :: UnqualComponentName -> FilePath mkExeName exe = unUnqualComponentName exe <.> exeExtension platform @@ -1218,16 +1217,16 @@ getLocalEnv dir platform compilerVersion = <> ghcPlatformAndVersionString platform compilerVersion getPackageDbStack - :: CompilerId + :: Compiler -> Flag FilePath -> Flag FilePath -> IO PackageDBStack -getPackageDbStack compilerId storeDirFlag logsDirFlag = do +getPackageDbStack compiler storeDirFlag logsDirFlag = do mstoreDir <- traverse makeAbsolute $ flagToMaybe storeDirFlag let mlogsDir = flagToMaybe logsDirFlag cabalLayout <- mkCabalDirLayout mstoreDir mlogsDir - pure $ storePackageDBStack (cabalStoreDirLayout cabalLayout) compilerId + pure $ storePackageDBStack (cabalStoreDirLayout cabalLayout) compiler -- | This defines what a 'TargetSelector' means for the @bench@ command. -- It selects the 'AvailableTarget's that the 'TargetSelector' refers to, diff --git a/cabal-install/src/Distribution/Client/DistDirLayout.hs b/cabal-install/src/Distribution/Client/DistDirLayout.hs index 2b4bc54fb3e..834bda34705 100644 --- a/cabal-install/src/Distribution/Client/DistDirLayout.hs +++ b/cabal-install/src/Distribution/Client/DistDirLayout.hs @@ -41,7 +41,8 @@ import Distribution.Package , UnitId ) import Distribution.Simple.Compiler - ( OptimisationLevel (..) + ( Compiler (..) + , OptimisationLevel (..) , PackageDB (..) , PackageDBStack ) @@ -116,13 +117,13 @@ data DistDirLayout = DistDirLayout -- | The layout of a cabal nix-style store. data StoreDirLayout = StoreDirLayout - { storeDirectory :: CompilerId -> FilePath - , storePackageDirectory :: CompilerId -> UnitId -> FilePath - , storePackageDBPath :: CompilerId -> FilePath - , storePackageDB :: CompilerId -> PackageDB - , storePackageDBStack :: CompilerId -> PackageDBStack - , storeIncomingDirectory :: CompilerId -> FilePath - , storeIncomingLock :: CompilerId -> UnitId -> FilePath + { storeDirectory :: Compiler -> FilePath + , storePackageDirectory :: Compiler -> UnitId -> FilePath + , storePackageDBPath :: Compiler -> FilePath + , storePackageDB :: Compiler -> PackageDB + , storePackageDBStack :: Compiler -> PackageDBStack + , storeIncomingDirectory :: Compiler -> FilePath + , storeIncomingLock :: Compiler -> UnitId -> FilePath } -- TODO: move to another module, e.g. CabalDirLayout? @@ -267,33 +268,35 @@ defaultStoreDirLayout :: FilePath -> StoreDirLayout defaultStoreDirLayout storeRoot = StoreDirLayout{..} where - storeDirectory :: CompilerId -> FilePath - storeDirectory compid = - storeRoot prettyShow compid - - storePackageDirectory :: CompilerId -> UnitId -> FilePath - storePackageDirectory compid ipkgid = - storeDirectory compid prettyShow ipkgid - - storePackageDBPath :: CompilerId -> FilePath - storePackageDBPath compid = - storeDirectory compid "package.db" - - storePackageDB :: CompilerId -> PackageDB - storePackageDB compid = - SpecificPackageDB (storePackageDBPath compid) - - storePackageDBStack :: CompilerId -> PackageDBStack - storePackageDBStack compid = - [GlobalPackageDB, storePackageDB compid] - - storeIncomingDirectory :: CompilerId -> FilePath - storeIncomingDirectory compid = - storeDirectory compid "incoming" - - storeIncomingLock :: CompilerId -> UnitId -> FilePath - storeIncomingLock compid unitid = - storeIncomingDirectory compid prettyShow unitid <.> "lock" + storeDirectory :: Compiler -> FilePath + storeDirectory compiler = + storeRoot case compilerAbiTag compiler of + NoAbiTag -> prettyShow (compilerId compiler) + AbiTag tag -> prettyShow (compilerId compiler) <> "-" <> tag + + storePackageDirectory :: Compiler -> UnitId -> FilePath + storePackageDirectory compiler ipkgid = + storeDirectory compiler prettyShow ipkgid + + storePackageDBPath :: Compiler -> FilePath + storePackageDBPath compiler = + storeDirectory compiler "package.db" + + storePackageDB :: Compiler -> PackageDB + storePackageDB compiler = + SpecificPackageDB (storePackageDBPath compiler) + + storePackageDBStack :: Compiler -> PackageDBStack + storePackageDBStack compiler = + [GlobalPackageDB, storePackageDB compiler] + + storeIncomingDirectory :: Compiler -> FilePath + storeIncomingDirectory compiler = + storeDirectory compiler "incoming" + + storeIncomingLock :: Compiler -> UnitId -> FilePath + storeIncomingLock compiler unitid = + storeIncomingDirectory compiler prettyShow unitid <.> "lock" defaultCabalDirLayout :: IO CabalDirLayout defaultCabalDirLayout = diff --git a/cabal-install/src/Distribution/Client/ProjectBuilding/UnpackedPackage.hs b/cabal-install/src/Distribution/Client/ProjectBuilding/UnpackedPackage.hs index f0ce968a78d..46dc71e329a 100644 --- a/cabal-install/src/Distribution/Client/ProjectBuilding/UnpackedPackage.hs +++ b/cabal-install/src/Distribution/Client/ProjectBuilding/UnpackedPackage.hs @@ -686,12 +686,12 @@ buildAndInstallUnpackedPackage | otherwise = do assert ( elabRegisterPackageDBStack pkg - == storePackageDBStack compid + == storePackageDBStack compiler ) (return ()) _ <- runRegister - (storePackageDBStack compid) + (storePackageDBStack compiler) Cabal.defaultRegisterOptions { Cabal.registerMultiInstance = True , Cabal.registerSuppressFilesCheck = True @@ -703,7 +703,7 @@ buildAndInstallUnpackedPackage newStoreEntry verbosity storeDirLayout - compid + compiler uid (copyPkgFiles verbosity pkgshared pkg runCopy) registerPkg @@ -740,7 +740,6 @@ buildAndInstallUnpackedPackage where uid = installedUnitId rpkg pkgid = packageId rpkg - compid = compilerId compiler dispname :: String dispname = case elabPkgOrComp pkg of diff --git a/cabal-install/src/Distribution/Client/ProjectPlanning.hs b/cabal-install/src/Distribution/Client/ProjectPlanning.hs index 6d63ffcbaab..8048c009c74 100644 --- a/cabal-install/src/Distribution/Client/ProjectPlanning.hs +++ b/cabal-install/src/Distribution/Client/ProjectPlanning.hs @@ -860,7 +860,7 @@ rebuildInstallPlan -> Rebuild ElaboratedInstallPlan phaseImprovePlan elaboratedPlan elaboratedShared = do liftIO $ debug verbosity "Improving the install plan..." - storePkgIdSet <- getStoreEntries cabalStoreDirLayout compid + storePkgIdSet <- getStoreEntries cabalStoreDirLayout compiler let improvedPlan = improveInstallPlanWithInstalledPackages storePkgIdSet @@ -872,7 +872,7 @@ rebuildInstallPlan -- matches up as expected, e.g. no dangling deps, files deleted. return improvedPlan where - compid = compilerId (pkgConfigCompiler elaboratedShared) + compiler = pkgConfigCompiler elaboratedShared -- | If a 'PackageSpecifier' refers to a single package, return Just that -- package. @@ -2318,7 +2318,7 @@ elaborateInstallPlan corePackageDbs = applyPackageDbFlags - (storePackageDBStack (compilerId compiler)) + (storePackageDBStack compiler) (projectConfigPackageDBs sharedPackageConfig) -- For this local build policy, every package that lives in a local source @@ -3767,15 +3767,15 @@ userInstallDirTemplates compiler = do storePackageInstallDirs :: StoreDirLayout - -> CompilerId + -> Compiler -> InstalledPackageId -> InstallDirs.InstallDirs FilePath -storePackageInstallDirs storeDirLayout compid ipkgid = - storePackageInstallDirs' storeDirLayout compid $ newSimpleUnitId ipkgid +storePackageInstallDirs storeDirLayout compiler ipkgid = + storePackageInstallDirs' storeDirLayout compiler $ newSimpleUnitId ipkgid storePackageInstallDirs' :: StoreDirLayout - -> CompilerId + -> Compiler -> UnitId -> InstallDirs.InstallDirs FilePath storePackageInstallDirs' @@ -3783,12 +3783,12 @@ storePackageInstallDirs' { storePackageDirectory , storeDirectory } - compid + compiler unitid = InstallDirs.InstallDirs{..} where - store = storeDirectory compid - prefix = storePackageDirectory compid unitid + store = storeDirectory compiler + prefix = storePackageDirectory compiler unitid bindir = prefix "bin" libdir = prefix "lib" libsubdir = "" @@ -3838,7 +3838,7 @@ computeInstallDirs storeDirLayout defaultInstallDirs elaboratedShared elab -- use special simplified install dirs storePackageInstallDirs' storeDirLayout - (compilerId (pkgConfigCompiler elaboratedShared)) + (pkgConfigCompiler elaboratedShared) (elabUnitId elab) -- TODO: [code cleanup] perhaps reorder this code diff --git a/cabal-install/src/Distribution/Client/Store.hs b/cabal-install/src/Distribution/Client/Store.hs index d678e137090..4e7d97d97cc 100644 --- a/cabal-install/src/Distribution/Client/Store.hs +++ b/cabal-install/src/Distribution/Client/Store.hs @@ -26,8 +26,8 @@ import Prelude () import Distribution.Client.DistDirLayout import Distribution.Client.RebuildMonad -import Distribution.Compiler (CompilerId) import Distribution.Package (UnitId, mkUnitId) +import Distribution.Simple.Compiler (Compiler (..)) import Distribution.Simple.Utils ( debug @@ -129,15 +129,15 @@ import GHC.IO.Handle.Lock (hUnlock) -- or replace, i.e. not failing if the db entry already exists. -- | Check if a particular 'UnitId' exists in the store. -doesStoreEntryExist :: StoreDirLayout -> CompilerId -> UnitId -> IO Bool -doesStoreEntryExist StoreDirLayout{storePackageDirectory} compid unitid = - doesDirectoryExist (storePackageDirectory compid unitid) +doesStoreEntryExist :: StoreDirLayout -> Compiler -> UnitId -> IO Bool +doesStoreEntryExist StoreDirLayout{storePackageDirectory} compiler unitid = + doesDirectoryExist (storePackageDirectory compiler unitid) -- | Return the 'UnitId's of all packages\/components already installed in the -- store. -getStoreEntries :: StoreDirLayout -> CompilerId -> Rebuild (Set UnitId) -getStoreEntries StoreDirLayout{storeDirectory} compid = do - paths <- getDirectoryContentsMonitored (storeDirectory compid) +getStoreEntries :: StoreDirLayout -> Compiler -> Rebuild (Set UnitId) +getStoreEntries StoreDirLayout{storeDirectory} compiler = do + paths <- getDirectoryContentsMonitored (storeDirectory compiler) return $! mkEntries paths where mkEntries = @@ -174,7 +174,7 @@ data NewStoreEntryOutcome newStoreEntry :: Verbosity -> StoreDirLayout - -> CompilerId + -> Compiler -> UnitId -> (FilePath -> IO (FilePath, [FilePath])) -- ^ Action to place files. @@ -184,20 +184,20 @@ newStoreEntry newStoreEntry verbosity storeDirLayout@StoreDirLayout{..} - compid + compiler unitid copyFiles register = -- See $concurrency above for an explanation of the concurrency protocol - withTempIncomingDir storeDirLayout compid $ \incomingTmpDir -> do + withTempIncomingDir storeDirLayout compiler $ \incomingTmpDir -> do -- Write all store entry files within the temp dir and return the prefix. (incomingEntryDir, otherFiles) <- copyFiles incomingTmpDir -- Take a lock named after the 'UnitId' in question. - withIncomingUnitIdLock verbosity storeDirLayout compid unitid $ do + withIncomingUnitIdLock verbosity storeDirLayout compiler unitid $ do -- Check for the existence of the final store entry directory. - exists <- doesStoreEntryExist storeDirLayout compid unitid + exists <- doesStoreEntryExist storeDirLayout compiler unitid if exists then -- If the entry exists then we lost the race and we must abandon, @@ -217,7 +217,7 @@ newStoreEntry -- Atomically rename the temp dir to the final store entry location. renameDirectory incomingEntryDir finalEntryDir for_ otherFiles $ \file -> do - let finalStoreFile = storeDirectory compid makeRelative (incomingTmpDir (dropDrive (storeDirectory compid))) file + let finalStoreFile = storeDirectory compiler makeRelative (incomingTmpDir (dropDrive (storeDirectory compiler))) file createDirectoryIfMissing True (takeDirectory finalStoreFile) renameFile file finalStoreFile @@ -225,64 +225,67 @@ newStoreEntry "Installed store entry " ++ prettyShow compid prettyShow unitid return UseNewStoreEntry where - finalEntryDir = storePackageDirectory compid unitid + compid = compilerId compiler + + finalEntryDir = storePackageDirectory compiler unitid withTempIncomingDir :: StoreDirLayout - -> CompilerId + -> Compiler -> (FilePath -> IO a) -> IO a -withTempIncomingDir StoreDirLayout{storeIncomingDirectory} compid action = do +withTempIncomingDir StoreDirLayout{storeIncomingDirectory} compiler action = do createDirectoryIfMissing True incomingDir withTempDirectory silent incomingDir "new" action where - incomingDir = storeIncomingDirectory compid + incomingDir = storeIncomingDirectory compiler withIncomingUnitIdLock :: Verbosity -> StoreDirLayout - -> CompilerId + -> Compiler -> UnitId -> IO a -> IO a withIncomingUnitIdLock verbosity StoreDirLayout{storeIncomingLock} - compid + compiler unitid action = bracket takeLock releaseLock (\_hnd -> action) where + compid = compilerId compiler #ifdef MIN_VERSION_lukko - takeLock - | fileLockingSupported = do - fd <- fdOpen (storeIncomingLock compid unitid) - gotLock <- fdTryLock fd ExclusiveLock - unless gotLock $ do - info verbosity $ "Waiting for file lock on store entry " - ++ prettyShow compid prettyShow unitid - fdLock fd ExclusiveLock - return fd + takeLock + | fileLockingSupported = do + fd <- fdOpen (storeIncomingLock compiler unitid) + gotLock <- fdTryLock fd ExclusiveLock + unless gotLock $ do + info verbosity $ "Waiting for file lock on store entry " + ++ prettyShow compid prettyShow unitid + fdLock fd ExclusiveLock + return fd - -- if there's no locking, do nothing. Be careful on AIX. - | otherwise = return undefined -- :( + -- if there's no locking, do nothing. Be careful on AIX. + | otherwise = return undefined -- :( - releaseLock fd - | fileLockingSupported = do - fdUnlock fd - fdClose fd - | otherwise = return () + releaseLock fd + | fileLockingSupported = do + fdUnlock fd + fdClose fd + | otherwise = return () #else - takeLock = do - h <- openFile (storeIncomingLock compid unitid) ReadWriteMode - -- First try non-blocking, but if we would have to wait then - -- log an explanation and do it again in blocking mode. - gotlock <- hTryLock h ExclusiveLock - unless gotlock $ do - info verbosity $ "Waiting for file lock on store entry " - ++ prettyShow compid prettyShow unitid - hLock h ExclusiveLock - return h + takeLock = do + h <- openFile (storeIncomingLock compiler unitid) ReadWriteMode + -- First try non-blocking, but if we would have to wait then + -- log an explanation and do it again in blocking mode. + gotlock <- hTryLock h ExclusiveLock + unless gotlock $ do + info verbosity $ "Waiting for file lock on store entry " + ++ prettyShow compid prettyShow unitid + hLock h ExclusiveLock + return h - releaseLock h = hUnlock h >> hClose h + releaseLock h = hUnlock h >> hClose h #endif diff --git a/cabal-install/tests/UnitTests/Distribution/Client/Store.hs b/cabal-install/tests/UnitTests/Distribution/Client/Store.hs index 7268b4c8c34..976bd97a4cb 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/Store.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/Store.hs @@ -9,8 +9,8 @@ import System.FilePath -- import System.Random -import Distribution.Compiler (CompilerFlavor (..), CompilerId (..)) import Distribution.Package (UnitId, mkUnitId) +import Distribution.Simple.Compiler (AbiTag (..), Compiler (..), CompilerFlavor (..), CompilerId (..)) import Distribution.Simple.Utils (withTempDirectory) import Distribution.Verbosity (Verbosity, silent) import Distribution.Version (mkVersion) @@ -34,10 +34,20 @@ testListEmpty = withTempDirectory verbosity "." "store-" $ \tmp -> do let storeDirLayout = defaultStoreDirLayout (tmp "store") - assertStoreEntryExists storeDirLayout compid unitid False - assertStoreContent tmp storeDirLayout compid Set.empty + assertStoreEntryExists storeDirLayout compiler unitid False + assertStoreContent tmp storeDirLayout compiler Set.empty where - compid = CompilerId GHC (mkVersion [1, 0]) + compiler :: Compiler + compiler = + Compiler + { compilerId = CompilerId GHC (mkVersion [1, 0]) + , compilerAbiTag = NoAbiTag + , compilerCompat = [] + , compilerLanguages = [] + , compilerExtensions = [] + , compilerProperties = mempty + } + unitid = mkUnitId "foo-1.0-xyz" testInstallSerial :: Assertion @@ -54,7 +64,7 @@ testInstallSerial = assertNewStoreEntry tmp storeDirLayout - compid + compiler unitid1 (copyFiles "file1" "content-foo") (return ()) @@ -63,7 +73,7 @@ testInstallSerial = assertNewStoreEntry tmp storeDirLayout - compid + compiler unitid1 (copyFiles "file1" "content-foo") (return ()) @@ -72,18 +82,28 @@ testInstallSerial = assertNewStoreEntry tmp storeDirLayout - compid + compiler unitid2 (copyFiles "file2" "content-bar") (return ()) UseNewStoreEntry let pkgDir :: UnitId -> FilePath - pkgDir = storePackageDirectory storeDirLayout compid + pkgDir = storePackageDirectory storeDirLayout compiler assertFileEqual (pkgDir unitid1 "file1") "content-foo" assertFileEqual (pkgDir unitid2 "file2") "content-bar" where - compid = CompilerId GHC (mkVersion [1, 0]) + compiler :: Compiler + compiler = + Compiler + { compilerId = CompilerId GHC (mkVersion [1, 0]) + , compilerAbiTag = NoAbiTag + , compilerCompat = [] + , compilerLanguages = [] + , compilerExtensions = [] + , compilerProperties = mempty + } + unitid1 = mkUnitId "foo-1.0-xyz" unitid2 = mkUnitId "bar-2.0-xyz" @@ -150,7 +170,7 @@ testInstallParallel = assertNewStoreEntry :: FilePath -> StoreDirLayout - -> CompilerId + -> Compiler -> UnitId -> (FilePath -> IO (FilePath, [FilePath])) -> IO () @@ -159,43 +179,43 @@ assertNewStoreEntry assertNewStoreEntry tmp storeDirLayout - compid + compiler unitid copyFiles register expectedOutcome = do - entries <- runRebuild tmp $ getStoreEntries storeDirLayout compid + entries <- runRebuild tmp $ getStoreEntries storeDirLayout compiler outcome <- newStoreEntry verbosity storeDirLayout - compid + compiler unitid copyFiles register assertEqual "newStoreEntry outcome" expectedOutcome outcome - assertStoreEntryExists storeDirLayout compid unitid True + assertStoreEntryExists storeDirLayout compiler unitid True let expected = Set.insert unitid entries - assertStoreContent tmp storeDirLayout compid expected + assertStoreContent tmp storeDirLayout compiler expected assertStoreEntryExists :: StoreDirLayout - -> CompilerId + -> Compiler -> UnitId -> Bool -> Assertion -assertStoreEntryExists storeDirLayout compid unitid expected = do - actual <- doesStoreEntryExist storeDirLayout compid unitid +assertStoreEntryExists storeDirLayout compiler unitid expected = do + actual <- doesStoreEntryExist storeDirLayout compiler unitid assertEqual "store entry exists" expected actual assertStoreContent :: FilePath -> StoreDirLayout - -> CompilerId + -> Compiler -> Set.Set UnitId -> Assertion -assertStoreContent tmp storeDirLayout compid expected = do - actual <- runRebuild tmp $ getStoreEntries storeDirLayout compid +assertStoreContent tmp storeDirLayout compiler expected = do + actual <- runRebuild tmp $ getStoreEntries storeDirLayout compiler assertEqual "store content" actual expected assertFileEqual :: FilePath -> String -> Assertion diff --git a/changelog.d/pr-9326 b/changelog.d/pr-9326 new file mode 100644 index 00000000000..33350cd86f0 --- /dev/null +++ b/changelog.d/pr-9326 @@ -0,0 +1,10 @@ +synopsis: Include the GHC "Project Unit Id" in the cabal store path +packages: Cabal cabal-install +prs: #9326 +issues: #8114 +description: { +- This allows the use of several **API incompatible builds of the same version + of GHC** without corrupting the cabal store. +- This relies on the "Project Unit Id" which is available since GHC 9.8.1, + older versions of GHC do not benefit from this change. +}