Commit 39b71e81 authored by Edward Z. Yang's avatar Edward Z. Yang

Reimplement shadowing on a per database basis.

Summary:
This commit reimplements shadowing on package databases by doing
the shadowing calculation on a per-database basis: specifically,
if a later package database shadows a package from the earlier
databases, we first remove that package (and its transitive
dependencies) before merging the databases together.

This should also fix bootstrapping GHC HEAD with HEAD.
Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>

Test Plan: validate

Reviewers: ggreif, bgamari, austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1385
parent 91c6b1f5
......@@ -791,7 +791,7 @@ data DynFlags = DynFlags {
-- Package state
-- NB. do not modify this field, it is calculated by
-- Packages.initPackages
pkgDatabase :: Maybe [PackageConfig],
pkgDatabase :: Maybe [(FilePath, [PackageConfig])],
pkgState :: PackageState,
-- Temporary files
......
This diff is collapsed.
......@@ -156,19 +156,21 @@ shadow:
@echo "databases 1 and 3:"
$(LOCAL_GHC_PKGSHADOW13) list
echo "main = return ()" >shadow.hs
#
# In this test, shadow-1-XXX with ABI hash aaa conflicts with shadow-1-XXX with
# ABI hash bbb, so GHC errors
#
# In this test, the later database defines a new shadow-1-XXX which
# shadows the old one, making shadowdep unsatisfiable.
#
@echo "should FAIL:"
if '$(TEST_HC)' $(TEST_HC_OPTS) -package-db $(PKGCONFSHADOW1) -package-db $(PKGCONFSHADOW2) -package shadowdep -c shadow.hs -fno-code; then false; else true; fi
#
# Reversing the orders of the configs does not fix the problem
# Reversing the orders of the configs fixes the problem, because now
# the shadow-1-XXX defined in the same DB as shadowdep shadows
# shadow-1-XXX in localshadow2.package.conf
#
@echo "should FAIL:"
if '$(TEST_HC)' $(TEST_HC_OPTS) -package-db $(PKGCONFSHADOW2) -package-db $(PKGCONFSHADOW1) -package shadowdep -c shadow.hs -fno-code; then false; else true; fi
@echo "should SUCCEED:"
'$(TEST_HC)' $(TEST_HC_OPTS) -package-db $(PKGCONFSHADOW2) -package-db $(PKGCONFSHADOW1) -package shadowdep -c shadow.hs -fno-code
#
# When the ABIs are the same, there is no problem
# When the ABIs are the same, dependencies don't break, we just swap it in
#
@echo "should SUCCEED:"
'$(TEST_HC)' $(TEST_HC_OPTS) -package-db $(PKGCONFSHADOW3) -package-db $(PKGCONFSHADOW1) -package shadowdep -c shadow.hs -fno-code
......
<command line>: package db: duplicate packages with incompatible ABIs:
shadow-1-XXX has ABIs: aaa, bbb
<command line>: package db: duplicate packages with incompatible ABIs:
shadow-1-XXX has ABIs: aaa, bbb
<command line>: cannot satisfy -package shadowdep:
shadowdep-1-XXX is unusable due to shadowed dependencies:
shadow-1-XXX
(use -v for more information)
......@@ -15,5 +15,5 @@ localshadow3.package.conf:
(shadow-1)
should FAIL:
should FAIL:
should SUCCEED:
should SUCCEED:
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment