Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions cabal-install/src/Distribution/Client/Dependency.hs
Original file line number Diff line number Diff line change
Expand Up @@ -445,13 +445,16 @@ setSolverVerbosity verbosity params =
}

dependOnWiredIns :: CompilerInfo -> DepResolverParams -> DepResolverParams
dependOnWiredIns compiler params = addConstraints extraConstraints params
dependOnWiredIns compiler params =
case compilerInfoWiredInUnitIds compiler of
Nothing -> params
Just wiredInUnitIds -> addConstraints (extraConstraints wiredInUnitIds) params
where
extraConstraints =
extraConstraints wiredInUnitIds =
[ LabeledPackageConstraint
(PackageConstraint (ScopeAnyQualifier pkgName) (PackagePropertyInstalledSpecificUnitId unitId))
ConstraintSourceNonReinstallablePackage
| (pkgName, unitId) <- fromMaybe [] $ compilerInfoWiredInUnitIds compiler
| (pkgName, unitId) <- wiredInUnitIds
]
++
-- Old versions of `base` must be excluded from build plans still as they do not depend on any version of a wired-in unit.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,13 @@ tests =
allowBootLibInstalls $
mkTest dbBase "Install base with --allow-boot-library-installs" ["base"] $
solverSuccess [("base", 5), ("ghc-prim", 1), ("integer-gmp", 1), ("integer-simple", 1)]
, -- The base >= 4.22 constraint only makes sense alongside the wired-in
-- unit id constraints. A compiler that reports none has no installed
-- base satisfying it, so it must not be added here.
runTest $
allowBootLibInstalls $
mkTest dbBaseOld "Install old base with --allow-boot-library-installs" ["base"] $
solverSuccess [("base", 1)]
]
, testGroup
"Reinstallable base, template-haskell, but not ghc{,-internal} (GHC with wiredInUnitIds)"
Expand Down
10 changes: 10 additions & 0 deletions changelog.d/base-422-wired-in-guard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
synopsis: Fix `--allow-boot-library-installs` on GHC < 9.14
packages: [cabal-install]
prs: 12301
issues: 12328
---

`--allow-boot-library-installs` made builds fail on compilers that report no
wired-in unit ids, because `base` was constrained to version 4.22 or later
regardless of the compiler.
Loading