Skip to content

Commit f493e3a

Browse files
committed
refactor(cabal-install): resolve package dbs during planning
1 parent ce05b66 commit f493e3a

File tree

4 files changed

+17
-19
lines changed

4 files changed

+17
-19
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ data PackageHashConfigInputs = PackageHashConfigInputs
219219
, pkgHashExtraIncludeDirs :: [FilePath]
220220
, pkgHashProgPrefix :: Maybe PathTemplate
221221
, pkgHashProgSuffix :: Maybe PathTemplate
222-
, pkgHashPackageDbs :: [Maybe PackageDBCWD]
222+
, pkgHashPackageDbs :: [PackageDBCWD]
223223
, -- Haddock options
224224
pkgHashDocumentation :: Bool
225225
, pkgHashHaddockHoogle :: Bool

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ import Distribution.Client.Errors
116116
import Distribution.Compat.Directory (listDirectory)
117117

118118
import Distribution.Client.ProjectBuilding.PackageFileMonitor
119-
import Distribution.Simple.Configure (interpretPackageDbFlags)
120119

121120
-- | Each unpacked package is processed in the following phases:
122121
--
@@ -709,7 +708,7 @@ buildAndInstallUnpackedPackage
709708
"registerPkg: elab does NOT require registration for "
710709
++ prettyShow uid
711710
| otherwise = do
712-
let packageDbStack = interpretPackageDbFlags False (elabPackageDbs pkg) ++ [storePackageDB storeDirLayout compiler]
711+
let packageDbStack = elabPackageDbs pkg ++ [storePackageDB storeDirLayout compiler]
713712
assert (elabRegisterPackageDBStack pkg == packageDbStack) (return ())
714713
_ <-
715714
runRegister

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2271,7 +2271,7 @@ elaborateInstallPlan
22712271
if shouldBuildInplaceOnly pkg
22722272
then BuildInplaceOnly OnDisk
22732273
else BuildAndInstall
2274-
elabPackageDbs = projectConfigPackageDBs sharedPackageConfig
2274+
elabPackageDbs = Cabal.interpretPackageDbFlags False (projectConfigPackageDBs sharedPackageConfig)
22752275
elabBuildPackageDBStack = buildAndRegisterDbs
22762276
elabRegisterPackageDBStack = buildAndRegisterDbs
22772277

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

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -247,21 +247,20 @@ data ElaboratedConfiguredPackage = ElaboratedConfiguredPackage
247247
-- to disable. This tells us which ones we build by default, and
248248
-- helps with error messages when the user asks to build something
249249
-- they explicitly disabled.
250-
--
251-
-- TODO: The 'Bool' here should be refined into an ADT with three
252-
-- cases: NotRequested, ExplicitlyRequested and
253-
-- ImplicitlyRequested. A stanza is explicitly requested if
254-
-- the user asked, for this *specific* package, that the stanza
255-
-- be enabled; it's implicitly requested if the user asked for
256-
-- all global packages to have this stanza enabled. The
257-
-- difference between an explicit and implicit request is
258-
-- error reporting behavior: if a user asks for tests to be
259-
-- enabled for a specific package that doesn't have any tests,
260-
-- we should warn them about it, but we shouldn't complain
261-
-- that a user enabled tests globally, and some local packages
262-
-- just happen not to have any tests. (But perhaps we should
263-
-- warn if ALL local packages don't have any tests.)
264-
, elabPackageDbs :: [Maybe PackageDBCWD]
250+
, -- TODO: The 'Bool' here should be refined into an ADT with three
251+
-- cases: NotRequested, ExplicitlyRequested and
252+
-- ImplicitlyRequested. A stanza is explicitly requested if
253+
-- the user asked, for this *specific* package, that the stanza
254+
-- be enabled; it's implicitly requested if the user asked for
255+
-- all global packages to have this stanza enabled. The
256+
-- difference between an explicit and implicit request is
257+
-- error reporting behavior: if a user asks for tests to be
258+
-- enabled for a specific package that doesn't have any tests,
259+
-- we should warn them about it, but we shouldn't complain
260+
-- that a user enabled tests globally, and some local packages
261+
-- just happen not to have any tests. (But perhaps we should
262+
-- warn if ALL local packages don't have any tests.)
263+
elabPackageDbs :: [PackageDBCWD]
265264
, elabSetupPackageDBStack :: PackageDBStackCWD
266265
, elabBuildPackageDBStack :: PackageDBStackCWD
267266
, elabRegisterPackageDBStack :: PackageDBStackCWD

0 commit comments

Comments
 (0)