summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--utils/ghc-pkg/Main.hs10
1 files changed, 9 insertions, 1 deletions
diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs
index 970ab67083..c88b814a71 100644
--- a/utils/ghc-pkg/Main.hs
+++ b/utils/ghc-pkg/Main.hs
@@ -916,7 +916,7 @@ parsePackageInfo
-> IO (InstalledPackageInfo, [ValidateWarning])
parsePackageInfo str =
case parseInstalledPackageInfo str of
- ParseOk warnings ok -> return (ok, ws)
+ ParseOk warnings ok -> return (mungePackageInfo ok, ws)
where
ws = [ msg | PWarning msg <- warnings
, not ("Unrecognized field pkgroot" `isPrefixOf` msg) ]
@@ -924,6 +924,14 @@ parsePackageInfo str =
(Nothing, s) -> die s
(Just l, s) -> die (show l ++ ": " ++ s)
+mungePackageInfo :: InstalledPackageInfo -> InstalledPackageInfo
+mungePackageInfo ipi = ipi { packageKey = packageKey' }
+ where
+ packageKey'
+ | OldPackageKey (PackageIdentifier (PackageName "") _) <- packageKey ipi
+ = OldPackageKey (sourcePackageId ipi)
+ | otherwise = packageKey ipi
+
-- | Takes the "reexported-modules" field of an InstalledPackageInfo
-- and resolves the references so they point to the original exporter
-- of a module (i.e. the module is in exposed-modules, not