summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2014-07-30 13:54:46 +0100
committerEdward Z. Yang <ezyang@cs.stanford.edu>2014-08-05 10:08:03 +0100
commit36637914b0a874d7716d9b6a6c7e80540aae68af (patch)
tree557b6e4a13ad89517aa816fcda630f35c743c3ff
parent66218d15b7c27a4a38992003bd761f60bae84b1f (diff)
downloadhaskell-36637914b0a874d7716d9b6a6c7e80540aae68af.tar.gz
Disable ghc-pkg accepting multiple package IDs (differing package keys) for now.
Duncan requested that ghc-pkg not accept duplicate package IDs (foo-0.1) by default until the higher level tools can accommodate it. Until then you'll need to use the --multi-instance flag to install multiple copies in the package database. I think reusing the --multi-instance flag is dodgy, because that can be used to cause duplicate package keys; but there is a mode of use of the database where package keys are unique. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
-rw-r--r--utils/ghc-pkg/Main.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs
index 2679639a46..970ab67083 100644
--- a/utils/ghc-pkg/Main.hs
+++ b/utils/ghc-pkg/Main.hs
@@ -901,13 +901,13 @@ registerPackage input verbosity my_flags auto_ghci_libs multi_instance
let
-- In the normal mode, we only allow one version of each package, so we
- -- remove all instances with the same source package key as the one we're
+ -- remove all instances with the same source package id as the one we're
-- adding. In the multi instance mode we don't do that, thus allowing
- -- multiple instances with the same source package key.
+ -- multiple instances with the same source package id.
removes = [ RemovePackage p
| not multi_instance,
p <- packages db_to_operate_on,
- packageKey p == packageKey pkg ]
+ sourcePackageId p == sourcePackageId pkg ]
--
changeDB verbosity (removes ++ [AddPackage pkg']) db_to_operate_on
@@ -1564,14 +1564,13 @@ checkDuplicates :: PackageDBStack -> InstalledPackageInfo
-> Bool -> Bool-> Validate ()
checkDuplicates db_stack pkg multi_instance update = do
let
- pkg_key = packageKey pkg
pkgid = sourcePackageId pkg
pkgs = packages (head db_stack)
--
-- Check whether this package id already exists in this DB
--
when (not update && not multi_instance
- && (pkg_key `elem` map packageKey pkgs)) $
+ && (pkgid `elem` map sourcePackageId pkgs)) $
verror CannotForce $
"package " ++ display pkgid ++ " is already installed"