summaryrefslogtreecommitdiff
path: root/utils/ghc-pkg
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2017-03-02 16:27:32 -0500
committerBen Gamari <ben@smart-cactus.org>2017-03-02 19:58:01 -0500
commit0b922909121f6a812d2861a29d0d0d3c7e2fcfce (patch)
treed971f683eaeb3da2d16025c849637565320940b6 /utils/ghc-pkg
parenta6874e546294173c166859769dd8054887a6ded7 (diff)
downloadhaskell-0b922909121f6a812d2861a29d0d0d3c7e2fcfce.tar.gz
Print out sub-libraries of packages more nicely.
Previously, we would print out the munged package name which looked like z-bkpcabal01-z-p-0.1.0.0. Now it looks like: bkpcabal01-0.1.0.0:p. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, bgamari, austin Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3235
Diffstat (limited to 'utils/ghc-pkg')
-rw-r--r--utils/ghc-pkg/Main.hs15
1 files changed, 13 insertions, 2 deletions
diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs
index c42feecb22..c5ecbf23e1 100644
--- a/utils/ghc-pkg/Main.hs
+++ b/utils/ghc-pkg/Main.hs
@@ -41,6 +41,7 @@ import Distribution.Package hiding (installedUnitId)
import Distribution.Text
import Distribution.Version
import Distribution.Backpack
+import Distribution.Types.UnqualComponentName
import Distribution.Simple.Utils (fromUTF8, toUTF8, writeUTF8File, readUTF8File)
import qualified Data.Version as Version
import System.FilePath as FilePath
@@ -1243,8 +1244,17 @@ convertPackageInfoToCacheFormat pkg =
GhcPkg.componentId = installedComponentId pkg,
GhcPkg.instantiatedWith = instantiatedWith pkg,
GhcPkg.sourcePackageId = sourcePackageId pkg,
- GhcPkg.packageName = packageName pkg,
+ GhcPkg.packageName =
+ case sourcePackageName pkg of
+ Nothing -> packageName pkg
+ Just pn -> pn,
GhcPkg.packageVersion = Version.Version (versionNumbers (packageVersion pkg)) [],
+ GhcPkg.mungedPackageName =
+ case sourcePackageName pkg of
+ Nothing -> Nothing
+ Just _ -> Just (packageName pkg),
+ GhcPkg.libName =
+ fmap (mkPackageName . unUnqualComponentName) (sourceLibName pkg),
GhcPkg.depends = depends pkg,
GhcPkg.abiDepends = map (\(AbiDependency k v) -> (k,unAbiHash v)) (abiDepends pkg),
GhcPkg.abiHash = unAbiHash (abiHash pkg),
@@ -1268,7 +1278,8 @@ convertPackageInfoToCacheFormat pkg =
GhcPkg.exposed = exposed pkg,
GhcPkg.trusted = trusted pkg
}
- where convertExposed (ExposedModule n reexport) = (n, reexport)
+ where
+ convertExposed (ExposedModule n reexport) = (n, reexport)
instance GhcPkg.BinaryStringRep ComponentId where
fromStringRep = mkComponentId . fromStringRep