[commit: ghc] master: Disable ghc-pkg accepting multiple package IDs (differing package keys) for now. (3663791)
git at git.haskell.org
git at git.haskell.org
Tue Aug 5 10:15:38 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/36637914b0a874d7716d9b6a6c7e80540aae68af/ghc
>---------------------------------------------------------------
commit 36637914b0a874d7716d9b6a6c7e80540aae68af
Author: Edward Z. Yang <ezyang at cs.stanford.edu>
Date: Wed Jul 30 13:54:46 2014 +0100
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 at cs.stanford.edu>
>---------------------------------------------------------------
36637914b0a874d7716d9b6a6c7e80540aae68af
utils/ghc-pkg/Main.hs | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs
index 2679639..970ab67 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"
More information about the ghc-commits
mailing list