Commit 4b648be1 authored by Edward Z. Yang's avatar Edward Z. Yang Committed by Herbert Valerio Riedel

Update Cabal submodule & ghc-pkg to use new module re-export types

The main change is that Cabal changed the representation of module
re-exports to distinguish reexports in source .cabal files versus
re-exports in installed package registraion files.

Cabal now also does the resolution of re-exports to specific installed
packages itself, so ghc-pkg no longer has to do this. This is a cleaner
design overall because re-export resolution can fail so it is better to
do it during package configuration rather than package registration.
It also simplifies the re-export representation that ghc-pkg has to use.

Add extra ghc-pkg sanity check for module re-exports and duplicates

For re-exports, check that the defining package exists and that it
exposes the defining module (or for self-rexport exposed or hidden
modules). Also check that the defining package is actually a direct
or indirect dependency of the package doing the re-exporting.

Also add a check for duplicate modules in a package, including
re-exported modules.

Test Plan:
So far the sanity checks are totally untested. Should add some test
case to make sure the sanity checks do catch things correctly, and
don't ban legal things.

Reviewers: austin, duncan

Subscribers: angerman, simonmar, ezyang, carter

Differential Revision:

GHC Trac Issues:
parent 165072b3
......@@ -767,11 +767,15 @@ findBroken pkgs = go [] Map.empty pkgs
-- package name/version. Additionally, a package may be preferred if
-- it is in the transitive closure of packages selected using -package-id
-- flags.
type UnusablePackage = (PackageConfig, UnusablePackageReason)
shadowPackages :: [PackageConfig] -> [InstalledPackageId] -> UnusablePackages
shadowPackages pkgs preferred
= let (shadowed,_) = foldl check ([],emptyUFM) pkgs
in Map.fromList shadowed
check :: ([(InstalledPackageId, UnusablePackage)], UniqFM PackageConfig)
-> PackageConfig
-> ([(InstalledPackageId, UnusablePackage)], UniqFM PackageConfig)
check (shadowed,pkgmap) pkg
| Just oldpkg <- lookupUFM pkgmap pkgid
, let
......@@ -785,7 +789,7 @@ shadowPackages pkgs preferred
| otherwise
= (shadowed, pkgmap')
pkgid = mkFastString (sourcePackageIdString pkg)
pkgid = packageKeyFS (packageKey pkg)
pkgmap' = addToUFM pkgmap pkgid pkg
-- -----------------------------------------------------------------------------
......@@ -383,7 +383,7 @@ else
# programs such as GHC and ghc-pkg, that we do not assume the stage0
# compiler already has installed (or up-to-date enough).
PACKAGES_STAGE0 = Cabal/Cabal hpc binary bin-package-db hoopl transformers
PACKAGES_STAGE0 = binary Cabal/Cabal hpc bin-package-db hoopl transformers
ifeq "$(Windows_Host)" "NO"
ifneq "$(HostOS_CPP)" "ios"
PACKAGES_STAGE0 += terminfo
......@@ -413,8 +413,8 @@ PACKAGES_STAGE1 += process
PACKAGES_STAGE1 += template-haskell
PACKAGES_STAGE1 += Cabal/Cabal
PACKAGES_STAGE1 += Cabal/Cabal
PACKAGES_STAGE1 += bin-package-db
PACKAGES_STAGE1 += transformers
Subproject commit 8d59dc9fba584a9fdb810f4d84f7f3ccb089dd08
Subproject commit 5cf626df3039c8746bff814a7b97988d25707d96
Reading package info from "test.pkg" ... done.
Reading package info from "test7a.pkg" ... done.
reexported-modules: testpkg:A (A@testpkg-
testpkg:A as A1 (A@testpkg-
E as E2 (E@testpkg7a-1.0-XXX)
reexported-modules: testpkg- as A
testpkg- as A1 testpkg7a-1.0-XXX:E as E2
Reading package info from "test7b.pkg" ... done.
reexported-modules: testpkg:A as F1 (A@testpkg-
testpkg7a:A as F2 (A@testpkg-
testpkg7a:A1 as F3 (A@testpkg-
testpkg7a:E as F4 (E@testpkg7a-1.0-XXX) E (E@testpkg7a-1.0-XXX)
E2 as E3 (E@testpkg7a-1.0-XXX)
reexported-modules: testpkg- as F1
testpkg7a-1.0-XXX:A as F2 testpkg7a-1.0-XXX:A1 as F3
testpkg7a-1.0-XXX:E as F4 testpkg7a-1.0-XXX:E as E
testpkg7a-1.0-XXX:E2 as E3
......@@ -13,6 +13,7 @@ category: none
exposed: True
exposed-modules: E
reexported-modules: testpkg:A, testpkg:A as A1, E as E2
reexported-modules: testpkg- as A, testpkg- as A1,
testpkg7a-1.0-XXX:E as E2
hs-libraries: testpkg7a-1.0
depends: testpkg-
......@@ -12,7 +12,8 @@ description: A Test Package
category: none
exposed: True
reexported-modules: testpkg:A as F1, testpkg7a:A as F2,
testpkg7a:A1 as F3, testpkg7a:E as F4, E, E2 as E3
reexported-modules: testpkg- as F1, testpkg7a-1.0-XXX:A as F2,
testpkg7a-1.0-XXX:A1 as F3, testpkg7a-1.0-XXX:E as F4,
testpkg7a-1.0-XXX:E as E, testpkg7a-1.0-XXX:E2 as E3
hs-libraries: testpkg7b-1.0
depends: testpkg-, testpkg7a-1.0-XXX
......@@ -40,7 +40,7 @@ test('haddock.base',
[unless(in_tree_compiler(), skip)
,stats_num_field('bytes allocated',
[(wordsize(64), 4500376192, 5)
[(wordsize(64), 5840893376, 5)
# 2012-08-14: 3255435248 (amd64/Linux)
# 2012-08-29: 3324606664 (amd64/Linux, new codegen)
# 2012-10-08: 3373401360 (amd64/Linux)
......@@ -56,6 +56,7 @@ test('haddock.Cabal',
# 2014-08-29: 4267311856 (x86_64/Linux - w/w for INLINABLE things)
# 2014-09-09: 4660249216 (x86_64/Linux - Applicative/Monad changes according to Austin)
# 2014-09-10: 4500376192 (x86_64/Linux - Applicative/Monad changes according to Joachim)
# 2014-09-24: 5840893376 (x86_64/Linux - Cabal update)
,(platform('i386-unknown-mingw32'), 2052220292, 5)
# 2012-10-30: 1733638168 (x86/Windows)
......@@ -347,7 +347,7 @@ generate directory distdir dll0Modules config_args
do cwd <- getCurrentDirectory
let ipid = InstalledPackageId (display (packageId pd) ++ "-inplace")
let installedPkgInfo = inplaceInstalledPackageInfo cwd distdir
pd lib lbi clbi
pd ipid lib lbi clbi
final_ipi = installedPkgInfo {
Installed.installedPackageId = ipid,
Installed.haddockHTMLs = []
......@@ -42,6 +42,7 @@ $(ghc-cabal_DIST_BINARY): utils/ghc-cabal/Main.hs $(TOUCH_DEP) | $$(dir $$@)/. b
-odir bootstrapping \
-hidir bootstrapping \
-ilibraries/Cabal/Cabal \
-ilibraries/binary/src -DGENERICS \
-ilibraries/filepath \
-ilibraries/hpc \
This diff is collapsed.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment