Skip to content

Commit 6939af8

Browse files
committed
fixup! Add compiler to PackageId
(cherry picked from commit 1259214)
1 parent fa6d6d1 commit 6939af8

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

cabal-install-solver/src/Distribution/Solver/Modular/IndexConversion.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ convIPI' toolchains (ShadowPkgs sip) idx =
8888
-- | Extract/recover the package ID from an installed package info, and convert it to a solver's I.
8989
convId :: Toolchains -> IPI.InstalledPackageInfo -> (PN, I)
9090
convId toolchains ipi = (pn, I stage ver $ Inst $ IPI.installedUnitId ipi)
91-
where MungedPackageId mpn ver = mungedId ipi
91+
where MungedPackageId mpn ver compid = mungedId ipi
9292
-- HACK. See Note [Index conversion with internal libraries]
9393
pn = encodeCompatPackageName mpn
9494
stage = case IPI.pkgCompiler ipi of
@@ -172,7 +172,7 @@ convSPI' toolchains constraints strfl solveExes =
172172
-- | Convert a single source package into the solver-specific format.
173173
convSP :: Toolchains -> Map PN [LabeledPackageConstraint]
174174
-> StrongFlags -> SolveExecutables -> SourcePackage loc -> [(PN, I, PInfo)]
175-
convSP toolchains constraints strfl solveExes (SourcePackage (PackageIdentifier pn pv) gpd _ _pl) =
175+
convSP toolchains constraints strfl solveExes (SourcePackage (PackageIdentifier pn pv _compid) gpd _ _pl) =
176176
let pkgConstraints = fromMaybe [] $ M.lookup pn constraints
177177
in [(pn, I Host pv InRepo, convGPD (hostToolchain toolchains) pkgConstraints strfl solveExes pn gpd)
178178
,(pn, I Build pv InRepo, convGPD (buildToolchain toolchains) pkgConstraints strfl solveExes pn gpd)]

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ import Distribution.Types.GivenComponent
198198
import Distribution.Types.LibraryName
199199
import qualified Distribution.Types.LocalBuildConfig as LBC
200200
import Distribution.Types.PackageVersionConstraint
201+
import qualified Distribution.Types.PackageId as PI
201202
import Distribution.Types.PkgconfigDependency
202203
import Distribution.Types.UnqualComponentName
203204

@@ -791,8 +792,21 @@ rebuildInstallPlan
791792
-- }
792793
-- deriving (Eq, Generic, Show, Read)
793794
--
794-
-- can probably use fromList $ Map.elems $ on it.
795+
-- let mapPkgIdx f = PI.fromList . map f . PI.allPackages
796+
-- let updateIPI :: IPI.InstalledPackageInfo -> IPI.InstalledPackageInfo
797+
-- updateIPI ipi = ipi {
798+
-- IPI.sourcePackageId = (IPI.sourcePackageId ipi){ PI.pkgCompiler = IPI.pkgCompiler ipi }
799+
-- }
800+
-- let addCompilerToSourcePkg :: CompilerId -> [PackageSpecifier UnresolvedSourcePackage] -> [PackageSpecifier UnresolvedSourcePackage]
801+
-- addCompilerToSourcePkg compilerId = map (addCompilerId compilerId)
802+
-- addCompilerId :: CompilerId -> PackageSpecifier UnresolvedSourcePackage -> PackageSpecifier UnresolvedSourcePackage
803+
-- addCompilerId compilerId (NamedPackage name props) = NamedPackage name props
804+
-- addCompilerId compilerId (SpecificSourcePackage pkg) = SpecificSourcePackage (f pkg)
805+
-- where f :: SourcePackage UnresolvedPkgLoc -> SourcePackage UnresolvedPkgLoc
806+
-- f pkg = pkg{srcpkgPackageId = (srcpkgPackageId pkg){pkgCompiler = Just compilerId}}
807+
795808
hinstalledPkgIndex <-
809+
-- mapPkgIdx updateIPI <$>
796810
getInstalledPackages
797811
verbosity
798812
(hostToolchain toolchains)
@@ -802,13 +816,16 @@ rebuildInstallPlan
802816
-- for now. FIXME!
803817
-- let hinstalledPkgIndex' = PI.fromList $ PI.allPackages hinstalledPkgIndex
804818
binstalledPkgIndex <-
819+
-- mapPkgIdx updateIPI <$>
805820
getInstalledPackages
806821
verbosity
807822
(buildToolchain toolchains)
808823
-- FIXME: HACK
809824
-- if host and build compiler are the same, we want to get -package-db in here.
810825
(corePackageDbs $ if buildIsHost toolchains then Host else Build)
811826

827+
-- let localPackages' = addCompilerToSourcePkg (compilerId . toolchainCompiler . hostToolchain $ toolchains) localPackages
828+
812829
(sourcePkgDb, tis, ar) <-
813830
getSourcePackages
814831
verbosity

0 commit comments

Comments
 (0)