summaryrefslogtreecommitdiff
path: root/libraries/ghc-boot
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2016-12-14 01:28:43 -0800
committerEdward Z. Yang <ezyang@cs.stanford.edu>2016-12-21 08:49:06 -0800
commitee4e1654c31b9c6f6ad9b19ece25f040bbbcbd72 (patch)
tree8f58c21ea66a817e384fceb01e930df00cb7e7a9 /libraries/ghc-boot
parent2189239872322dc363cc5f82e14ab5fb1a6d5b8c (diff)
downloadhaskell-ee4e1654c31b9c6f6ad9b19ece25f040bbbcbd72.tar.gz
Support for abi-depends for computing shadowing.
Summary: This is a complete fix based off of ed7af26606b3a605a4511065ca1a43b1c0f3b51d for handling shadowing and out-of-order -package-db flags simultaneously. The general strategy is we first put all databases together, overriding packages as necessary. Once this is done, we successfully prune out broken packages, including packages which depend on a package whose ABI differs from the ABI we need. Our check gracefully degrades in the absence of abi-depends, as we only check deps which are recorded in abi-depends. Contains time and Cabal submodule update. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: niteria, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2846 GHC Trac Issues: #12485
Diffstat (limited to 'libraries/ghc-boot')
-rw-r--r--libraries/ghc-boot/GHC/PackageDb.hs12
1 files changed, 10 insertions, 2 deletions
diff --git a/libraries/ghc-boot/GHC/PackageDb.hs b/libraries/ghc-boot/GHC/PackageDb.hs
index 09991092ee..9b2889f4cf 100644
--- a/libraries/ghc-boot/GHC/PackageDb.hs
+++ b/libraries/ghc-boot/GHC/PackageDb.hs
@@ -66,7 +66,8 @@ import System.Directory
-- | This is a subset of Cabal's 'InstalledPackageInfo', with just the bits
--- that GHC is interested in.
+-- that GHC is interested in. See Cabal's documentation for a more detailed
+-- description of all of the fields.
--
data InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod
= InstalledPackageInfo {
@@ -78,6 +79,9 @@ data InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulenam
packageVersion :: Version,
abiHash :: String,
depends :: [instunitid],
+ -- | Like 'depends', but each dependency is annotated with the
+ -- ABI hash we expect the dependency to respect.
+ abiDepends :: [(instunitid, String)],
importDirs :: [FilePath],
hsLibraries :: [String],
extraLibraries :: [String],
@@ -159,6 +163,7 @@ emptyInstalledPackageInfo =
packageVersion = Version [] [],
abiHash = "",
depends = [],
+ abiDepends = [],
importDirs = [],
hsLibraries = [],
extraLibraries = [],
@@ -307,7 +312,7 @@ instance (RepInstalledPackageInfo a b c d e f g) =>
put (InstalledPackageInfo
unitId componentId instantiatedWith sourcePackageId
packageName packageVersion
- abiHash depends importDirs
+ abiHash depends abiDepends importDirs
hsLibraries extraLibraries extraGHCiLibraries
libraryDirs libraryDynDirs
frameworks frameworkDirs
@@ -325,6 +330,7 @@ instance (RepInstalledPackageInfo a b c d e f g) =>
instantiatedWith)
put abiHash
put (map toStringRep depends)
+ put (map (\(k,v) -> (toStringRep k, v)) abiDepends)
put importDirs
put hsLibraries
put extraLibraries
@@ -355,6 +361,7 @@ instance (RepInstalledPackageInfo a b c d e f g) =>
instantiatedWith <- get
abiHash <- get
depends <- get
+ abiDepends <- get
importDirs <- get
hsLibraries <- get
extraLibraries <- get
@@ -383,6 +390,7 @@ instance (RepInstalledPackageInfo a b c d e f g) =>
(fromStringRep packageName) packageVersion
abiHash
(map fromStringRep depends)
+ (map (\(k,v) -> (fromStringRep k, v)) abiDepends)
importDirs
hsLibraries extraLibraries extraGHCiLibraries
libraryDirs libraryDynDirs