@@ -198,6 +198,7 @@ import Distribution.Types.GivenComponent
198198import Distribution.Types.LibraryName
199199import qualified Distribution.Types.LocalBuildConfig as LBC
200200import Distribution.Types.PackageVersionConstraint
201+ import qualified Distribution.Types.PackageId as PI
201202import Distribution.Types.PkgconfigDependency
202203import 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