diff --git a/testsuite/tests/backpack/cabal/bkpcabal02/bkpcabal02.stdout b/testsuite/tests/backpack/cabal/bkpcabal02/bkpcabal02.stdout index 1e51c3c4ac3387b24560d616d682af12f9abb526..2f17fdffcd8fb2243185d0de553e26dfe79bbe5f 100644 --- a/testsuite/tests/backpack/cabal/bkpcabal02/bkpcabal02.stdout +++ b/testsuite/tests/backpack/cabal/bkpcabal02/bkpcabal02.stdout @@ -1,11 +1,6 @@ -ignoring (possibly broken) abi-depends field for packages -ignoring (possibly broken) abi-depends field for packages Preprocessing library 'p' for bkpcabal01-0.1.0.0.. Building library 'p' instantiated with H = <H> for bkpcabal01-0.1.0.0.. -ignoring (possibly broken) abi-depends field for packages Preprocessing library 'q' for bkpcabal01-0.1.0.0.. Building library 'q' instantiated with H = <H> for bkpcabal01-0.1.0.0.. -ignoring (possibly broken) abi-depends field for packages -ignoring (possibly broken) abi-depends field for packages diff --git a/testsuite/tests/cabal/T12485a.stdout b/testsuite/tests/cabal/T12485a.stdout index af722c524af2dc3f2212b4a6fd8e30bbc95778b0..ee83ab293c8e7322c39fe564618fece475a801fb 100644 --- a/testsuite/tests/cabal/T12485a.stdout +++ b/testsuite/tests/cabal/T12485a.stdout @@ -1,4 +1,3 @@ -ignoring (possibly broken) abi-depends field for packages should SUCCEED should SUCCEED should SUCCEED diff --git a/testsuite/tests/cabal/T5442d.stdout b/testsuite/tests/cabal/T5442d.stdout index 0cb7375fbf7b08a5d02bf5acff279644d36f1e9f..f3214578d254bbccd56ea0c907fac99b0d76c8f0 100644 --- a/testsuite/tests/cabal/T5442d.stdout +++ b/testsuite/tests/cabal/T5442d.stdout @@ -1,7 +1,6 @@ Reading package info from "shadow1.pkg" ... done. Reading package info from "shadow4.pkg" ... done. Reading package info from "shadow2.pkg" ... done. -ignoring (possibly broken) abi-depends field for packages global (should be empty): user: shadow-2 diff --git a/testsuite/tests/cabal/cabal01/cabal01.stdout b/testsuite/tests/cabal/cabal01/cabal01.stdout index 1378031cb140c7ae3c3c79df467a9296a910dbd2..e828cbe68a0cb2d8f954c40f4ef3c6511f9837f5 100644 --- a/testsuite/tests/cabal/cabal01/cabal01.stdout +++ b/testsuite/tests/cabal/cabal01/cabal01.stdout @@ -1,4 +1,3 @@ -ignoring (possibly broken) abi-depends field for packages install1: bin lib diff --git a/testsuite/tests/cabal/cabal06/cabal06.stdout b/testsuite/tests/cabal/cabal06/cabal06.stdout index 381363977c2dbb8cd5249345d2eea4eed5c15e2e..e5ff042302ab9d84aa41f0d62f083da91e89aaf1 100644 --- a/testsuite/tests/cabal/cabal06/cabal06.stdout +++ b/testsuite/tests/cabal/cabal06/cabal06.stdout @@ -1,7 +1,3 @@ -ignoring (possibly broken) abi-depends field for packages -ignoring (possibly broken) abi-depends field for packages -ignoring (possibly broken) abi-depends field for packages -ignoring (possibly broken) abi-depends field for packages Does the first instance of q depend on p-1.0? 1 Does the second instance of q depend on p-1.0? diff --git a/testsuite/tests/cabal/cabal08/cabal08.stdout b/testsuite/tests/cabal/cabal08/cabal08.stdout index d70d778151acc85173ba68041eb9bbbbc2cda523..06a164b15009644a974d1046ecbf97f791b22256 100644 --- a/testsuite/tests/cabal/cabal08/cabal08.stdout +++ b/testsuite/tests/cabal/cabal08/cabal08.stdout @@ -1,5 +1,3 @@ -ignoring (possibly broken) abi-depends field for packages -ignoring (possibly broken) abi-depends field for packages [1 of 1] Compiling Main ( Main.hs, Main.o ) Linking Main ... p2 diff --git a/testsuite/tests/cabal/shadow.stdout b/testsuite/tests/cabal/shadow.stdout index c70767da1d4f441ebe5ec1d26788b033a746e8a8..a47ce15795d070131f5239c8687b073ab84d62ee 100644 --- a/testsuite/tests/cabal/shadow.stdout +++ b/testsuite/tests/cabal/shadow.stdout @@ -1,4 +1,3 @@ -ignoring (possibly broken) abi-depends field for packages databases 1 and 2: localshadow1.package.conf (shadow-1) diff --git a/testsuite/tests/driver/recomp007/recomp007.stdout b/testsuite/tests/driver/recomp007/recomp007.stdout index d5da3dae18b70be0c6a2b5ed457733afa78c64e1..d8343152e0c5d260faa86f800eb74277fc63357b 100644 --- a/testsuite/tests/driver/recomp007/recomp007.stdout +++ b/testsuite/tests/driver/recomp007/recomp007.stdout @@ -1,5 +1,3 @@ -ignoring (possibly broken) abi-depends field for packages -ignoring (possibly broken) abi-depends field for packages Preprocessing executable 'test' for b-1.0.. Building executable 'test' for b-1.0.. [1 of 2] Compiling B ( B.hs, dist/build/test/test-tmp/B.o ) [A changed] diff --git a/testsuite/tests/safeHaskell/check/pkg01/safePkg01.stdout b/testsuite/tests/safeHaskell/check/pkg01/safePkg01.stdout index 8d6378430b4a5f6b97e2312bcbdd2d243b9a022f..59886cd378f17a7fc3235c1b411102d5263166be 100644 --- a/testsuite/tests/safeHaskell/check/pkg01/safePkg01.stdout +++ b/testsuite/tests/safeHaskell/check/pkg01/safePkg01.stdout @@ -1,53 +1,49 @@ -ignoring (possibly broken) abi-depends field for packages pdb.safePkg01/local.db safePkg01-1.0 trusted: False M_SafePkg -package dependencies: base-4.11.0.0* ghc-prim-0.5.2.0 integer-gmp-1.0.1.0 +package dependencies: base-4.9.0.0* ghc-prim-0.5.0.0 integer-gmp-1.0.0.0 trusted: safe require own pkg trusted: False M_SafePkg2 -package dependencies: base-4.11.0.0 ghc-prim-0.5.2.0 integer-gmp-1.0.1.0 +package dependencies: base-4.9.0.0 ghc-prim-0.5.0.0 integer-gmp-1.0.0.0 trusted: trustworthy require own pkg trusted: False M_SafePkg3 -package dependencies: base-4.11.0.0* ghc-prim-0.5.2.0 integer-gmp-1.0.1.0 +package dependencies: base-4.9.0.0* ghc-prim-0.5.0.0 integer-gmp-1.0.0.0 trusted: safe require own pkg trusted: True M_SafePkg4 -package dependencies: base-4.11.0.0* ghc-prim-0.5.2.0 integer-gmp-1.0.1.0 +package dependencies: base-4.9.0.0* ghc-prim-0.5.0.0 integer-gmp-1.0.0.0 trusted: safe require own pkg trusted: True M_SafePkg5 -package dependencies: base-4.11.0.0* ghc-prim-0.5.2.0 integer-gmp-1.0.1.0 +package dependencies: base-4.9.0.0* ghc-prim-0.5.0.0 integer-gmp-1.0.0.0 trusted: safe require own pkg trusted: True M_SafePkg6 -package dependencies: array-0.5.2.0 base-4.11.0.0* bytestring-0.10.8.2* deepseq-1.4.3.0 ghc-prim-0.5.2.0 integer-gmp-1.0.1.0 +package dependencies: array-0.5.1.0 base-4.9.0.0* bytestring-0.10.7.0* deepseq-1.4.2.0 ghc-prim-0.5.0.0 integer-gmp-1.0.0.0 trusted: trustworthy require own pkg trusted: False M_SafePkg7 -package dependencies: array-0.5.2.0 base-4.11.0.0* bytestring-0.10.8.2* deepseq-1.4.3.0 ghc-prim-0.5.2.0 integer-gmp-1.0.1.0 +package dependencies: array-0.5.1.0 base-4.9.0.0* bytestring-0.10.7.0* deepseq-1.4.2.0 ghc-prim-0.5.0.0 integer-gmp-1.0.0.0 trusted: safe require own pkg trusted: False M_SafePkg8 -package dependencies: array-0.5.2.0 base-4.11.0.0 bytestring-0.10.8.2* deepseq-1.4.3.0 ghc-prim-0.5.2.0 integer-gmp-1.0.1.0 +package dependencies: array-0.5.1.0 base-4.9.0.0 bytestring-0.10.7.0* deepseq-1.4.2.0 ghc-prim-0.5.0.0 integer-gmp-1.0.0.0 trusted: trustworthy require own pkg trusted: False Testing setting trust -ignoring (possibly broken) abi-depends field for packages trusted: True -ignoring (possibly broken) abi-depends field for packages trusted: False -ignoring (possibly broken) abi-depends field for packages trusted: False diff --git a/testsuite/tests/typecheck/T13168/T13168.stdout b/testsuite/tests/typecheck/T13168/T13168.stdout index 32eec3e0026e10c52243eaa286c565673a55e245..a935d2ffb3bf9ab0af958fc45e9f108c32234070 100644 --- a/testsuite/tests/typecheck/T13168/T13168.stdout +++ b/testsuite/tests/typecheck/T13168/T13168.stdout @@ -1,3 +1 @@ -ignoring (possibly broken) abi-depends field for packages -ignoring (possibly broken) abi-depends field for packages Window diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs index b2efbb87c4f0982e807889eef5308afb6ab00810..a32252139fba97ec70f7a7e928ad7b096854d82a 100644 --- a/utils/ghc-pkg/Main.hs +++ b/utils/ghc-pkg/Main.hs @@ -1211,18 +1211,7 @@ updateDBCache verbosity db = do pkgsCabalFormat = packages db pkgsGhcCacheFormat :: [PackageCacheFormat] - pkgsGhcCacheFormat - = map (recomputeValidAbiDeps pkgsCabalFormat) -- Note [Recompute abi-depends] - $ map convertPackageInfoToCacheFormat - pkgsCabalFormat - - hasAnyAbiDepends :: InstalledPackageInfo -> Bool - hasAnyAbiDepends x = length (abiDepends x) > 0 - - -- warn when we find any (possibly-)bogus abi-depends fields; - -- Note [Recompute abi-depends] - when (any hasAnyAbiDepends pkgsCabalFormat) $ - infoLn "ignoring (possibly broken) abi-depends field for packages" + pkgsGhcCacheFormat = map convertPackageInfoToCacheFormat pkgsCabalFormat when (verbosity > Normal) $ infoLn ("writing cache " ++ filename) @@ -1245,45 +1234,6 @@ type PackageCacheFormat = GhcPkg.InstalledPackageInfo ModuleName OpenModule -{- Note [Recompute abi-depends] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Like most fields, `ghc-pkg` relies on who-ever is performing package -registration to fill in fields; this includes the `abi-depends` field present -for the package. - -However, this was likely a mistake, and is not very robust; in certain cases, -versions of Cabal may use bogus abi-depends fields for a package when doing -builds. Why? Because package database information is aggressively cached; it is -possible to work Cabal into a situation where it uses a cached version of -`abi-depends`, rather than the one in the actual database after it has been -recomputed. - -However, there is an easy fix: ghc-pkg /already/ knows the `abi-depends` of a -package, because they are the ABIs of the packages pointed at by the `depends` -field. So it can simply look up the abi from the dependencies in the original -database, and ignore whatever the system registering gave it. - -So, instead, we do two things here: - - - We throw away the information for a registered package's `abi-depends` field. - - - We recompute it: we simply look up the unit ID of the package in the original - database, and use *its* abi-depends. - -See Trac #14381, and Cabal issue #4728. - --} - -recomputeValidAbiDeps :: [InstalledPackageInfo] -> PackageCacheFormat -> PackageCacheFormat -recomputeValidAbiDeps db pkg = pkg { GhcPkg.abiDepends = catMaybes (newAbiDeps) } - where - newAbiDeps = flip map (GhcPkg.abiDepends pkg) $ \(k, _) -> - case filter (\d -> installedUnitId d == k) db of - [] -> Nothing - [x] -> Just (k, unAbiHash (abiHash x)) - _ -> Nothing -- ??? - convertPackageInfoToCacheFormat :: InstalledPackageInfo -> PackageCacheFormat convertPackageInfoToCacheFormat pkg = GhcPkg.InstalledPackageInfo {