[commit: ghc] master: Have ghc-pkg use an old-style package key when it's not provided. (5e46e1f)
git at git.haskell.org
git at git.haskell.org
Wed Aug 13 14:33:30 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/5e46e1f5323a7fc09e9bbd9023d5c63e144e1ad3/ghc
>---------------------------------------------------------------
commit 5e46e1f5323a7fc09e9bbd9023d5c63e144e1ad3
Author: Edward Z. Yang <ezyang at cs.stanford.edu>
Date: Wed Aug 13 14:04:10 2014 +0100
Have ghc-pkg use an old-style package key when it's not provided.
Summary:
When this occurs, it means that the user is using an old version of Cabal.
In that case, don't barf out: just go ahead and install it as an old-style
package key. The user won't be able to link multiple versions together,
but that should not be a problem because their Cabal can't handle it anyway.
What happens if old-style are mixed up with new-style? Well, currently
with Cabal, it's indistinguishable. However, if at some later point we
add private dependencies, libraries compiled with old style linker names
are incompatible with each other. We'll cross that road when we come
to it.
Signed-off-by: Edward Z. Yang <ezyang at cs.stanford.edu>
Test Plan: validate
Reviewers: tibbe, hvr, austin
Subscribers: simonmar, relrod, ezyang, carter
Differential Revision: https://phabricator.haskell.org/D154
>---------------------------------------------------------------
5e46e1f5323a7fc09e9bbd9023d5c63e144e1ad3
utils/ghc-pkg/Main.hs | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs
index 970ab67..c88b814 100644
--- a/utils/ghc-pkg/Main.hs
+++ b/utils/ghc-pkg/Main.hs
@@ -916,7 +916,7 @@ parsePackageInfo
-> IO (InstalledPackageInfo, [ValidateWarning])
parsePackageInfo str =
case parseInstalledPackageInfo str of
- ParseOk warnings ok -> return (ok, ws)
+ ParseOk warnings ok -> return (mungePackageInfo ok, ws)
where
ws = [ msg | PWarning msg <- warnings
, not ("Unrecognized field pkgroot" `isPrefixOf` msg) ]
@@ -924,6 +924,14 @@ parsePackageInfo str =
(Nothing, s) -> die s
(Just l, s) -> die (show l ++ ": " ++ s)
+mungePackageInfo :: InstalledPackageInfo -> InstalledPackageInfo
+mungePackageInfo ipi = ipi { packageKey = packageKey' }
+ where
+ packageKey'
+ | OldPackageKey (PackageIdentifier (PackageName "") _) <- packageKey ipi
+ = OldPackageKey (sourcePackageId ipi)
+ | otherwise = packageKey ipi
+
-- | Takes the "reexported-modules" field of an InstalledPackageInfo
-- and resolves the references so they point to the original exporter
-- of a module (i.e. the module is in exposed-modules, not
More information about the ghc-commits
mailing list