Commit 3a770783 authored by Edward Z. Yang's avatar Edward Z. Yang Committed by Edward Z. Yang
Browse files

Update installedPkgs when registering.



This is similar to what we do in Distribution.Simple.Build;
preparatory commit so we can read out the ABI hashes of
our dependencies from installedPkgs.
Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
parent d23c5948
...@@ -61,6 +61,7 @@ import qualified Distribution.Simple.GHCJS as GHCJS ...@@ -61,6 +61,7 @@ import qualified Distribution.Simple.GHCJS as GHCJS
import qualified Distribution.Simple.LHC as LHC import qualified Distribution.Simple.LHC as LHC
import qualified Distribution.Simple.UHC as UHC import qualified Distribution.Simple.UHC as UHC
import qualified Distribution.Simple.HaskellSuite as HaskellSuite import qualified Distribution.Simple.HaskellSuite as HaskellSuite
import qualified Distribution.Simple.PackageIndex as Index
import Distribution.Simple.Compiler import Distribution.Simple.Compiler
import Distribution.Simple.Program import Distribution.Simple.Program
...@@ -72,6 +73,7 @@ import Distribution.Package ...@@ -72,6 +73,7 @@ import Distribution.Package
import qualified Distribution.InstalledPackageInfo as IPI import qualified Distribution.InstalledPackageInfo as IPI
import Distribution.InstalledPackageInfo (InstalledPackageInfo) import Distribution.InstalledPackageInfo (InstalledPackageInfo)
import Distribution.Simple.Utils import Distribution.Simple.Utils
import Distribution.Utils.MapAccum
import Distribution.System import Distribution.System
import Distribution.Text import Distribution.Text
import Distribution.Verbosity as Verbosity import Distribution.Verbosity as Verbosity
...@@ -90,7 +92,7 @@ import qualified Data.ByteString.Lazy.Char8 as BS.Char8 ...@@ -90,7 +92,7 @@ import qualified Data.ByteString.Lazy.Char8 as BS.Char8
register :: PackageDescription -> LocalBuildInfo register :: PackageDescription -> LocalBuildInfo
-> RegisterFlags -- ^Install in the user's database?; verbose -> RegisterFlags -- ^Install in the user's database?; verbose
-> IO () -> IO ()
register pkg_descr lbi flags = register pkg_descr lbi0 flags =
-- Duncan originally asked for us to not register/install files -- Duncan originally asked for us to not register/install files
-- when there was no public library. But with per-component -- when there was no public library. But with per-component
-- configure, we legitimately need to install internal libraries -- configure, we legitimately need to install internal libraries
...@@ -98,21 +100,24 @@ register pkg_descr lbi flags = ...@@ -98,21 +100,24 @@ register pkg_descr lbi flags =
doRegister doRegister
where where
doRegister = do doRegister = do
targets <- readTargetInfos verbosity pkg_descr lbi (regArgs flags) targets <- readTargetInfos verbosity pkg_descr lbi0 (regArgs flags)
-- It's important to register in build order, because ghc-pkg -- It's important to register in build order, because ghc-pkg
-- will complain if a dependency is not registered. -- will complain if a dependency is not registered.
let maybeGenerateOne target let componentsToRegister
| CLib lib <- targetComponent target = neededTargetsInBuildOrder' pkg_descr lbi0 (map nodeKey targets)
= fmap Just (generateOne pkg_descr lib lbi clbi flags)
| otherwise = return Nothing (_, ipi_mbs) <-
where clbi = targetCLBI target mapAccumM `flip` installedPkgs lbi0 `flip` componentsToRegister $ \index tgt ->
case targetComponent tgt of
ipis <- fmap catMaybes CLib lib -> do
. traverse maybeGenerateOne let clbi = targetCLBI tgt
$ neededTargetsInBuildOrder' pkg_descr lbi (map nodeKey targets) lbi = lbi0 { installedPkgs = index }
registerAll pkg_descr lbi flags ipis ipi <- generateOne pkg_descr lib lbi clbi flags
return () return (Index.insert ipi index, Just ipi)
_ -> return (index, Nothing)
registerAll pkg_descr lbi0 flags (catMaybes ipi_mbs)
where where
verbosity = fromFlag (regVerbosity flags) verbosity = fromFlag (regVerbosity flags)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment