summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2009-08-24 16:00:20 +0000
committerSimon Marlow <marlowsd@gmail.com>2009-08-24 16:00:20 +0000
commitf871cf1bf889704a4ec1f0063ad4d96f31453ea3 (patch)
tree5ef05bebe64fca03c2e19a2b173b138266129858 /compiler
parent7dda6727312f52df2980639bdf4a1a653e74ca8f (diff)
downloadhaskell-f871cf1bf889704a4ec1f0063ad4d96f31453ea3.tar.gz
Follow changes in Cabal: package -> sourcePackageId
Diffstat (limited to 'compiler')
-rw-r--r--compiler/ghci/Linker.lhs4
-rw-r--r--compiler/main/CodeOutput.lhs2
-rw-r--r--compiler/main/PackageConfig.hs2
-rw-r--r--compiler/main/Packages.lhs31
-rw-r--r--compiler/main/ParsePkgConf.y2
5 files changed, 21 insertions, 20 deletions
diff --git a/compiler/ghci/Linker.lhs b/compiler/ghci/Linker.lhs
index 4c85ac6940..8d0d6bab33 100644
--- a/compiler/ghci/Linker.lhs
+++ b/compiler/ghci/Linker.lhs
@@ -1024,7 +1024,7 @@ linkPackage dflags pkg
let dlls = [ dll | DLL dll <- classifieds ]
objs = [ obj | Object obj <- classifieds ]
- maybePutStr dflags ("Loading package " ++ display (package pkg) ++ " ... ")
+ maybePutStr dflags ("Loading package " ++ display (sourcePackageId pkg) ++ " ... ")
-- See comments with partOfGHCi
when (packageName pkg `notElem` partOfGHCi) $ do
@@ -1048,7 +1048,7 @@ linkPackage dflags pkg
maybePutStr dflags "linking ... "
ok <- resolveObjs
if succeeded ok then maybePutStrLn dflags "done."
- else ghcError (InstallationError ("unable to load package `" ++ display (package pkg) ++ "'"))
+ else ghcError (InstallationError ("unable to load package `" ++ display (sourcePackageId pkg) ++ "'"))
load_dyn :: [FilePath] -> FilePath -> IO ()
load_dyn dirs dll = do r <- loadDynamic dirs dll
diff --git a/compiler/main/CodeOutput.lhs b/compiler/main/CodeOutput.lhs
index d362fb4984..2d68b830ec 100644
--- a/compiler/main/CodeOutput.lhs
+++ b/compiler/main/CodeOutput.lhs
@@ -127,7 +127,7 @@ outputC dflags filenm flat_absC packages
_ -> "#include \""++h_file++"\""
pkg_configs <- getPreloadPackagesAnd dflags packages
- let pkg_names = map (display.package) pkg_configs
+ let pkg_names = map (display.sourcePackageId) pkg_configs
doOutput filenm $ \ h -> do
hPutStr h ("/* GHC_PACKAGES " ++ unwords pkg_names ++ "\n*/\n")
diff --git a/compiler/main/PackageConfig.hs b/compiler/main/PackageConfig.hs
index 79521c7df7..ac1a9fe446 100644
--- a/compiler/main/PackageConfig.hs
+++ b/compiler/main/PackageConfig.hs
@@ -59,7 +59,7 @@ mkPackageId = stringToPackageId . display
-- | Get the GHC 'PackageId' right out of a Cabalish 'PackageConfig'
packageConfigId :: PackageConfig -> PackageId
-packageConfigId = mkPackageId . package
+packageConfigId = mkPackageId . sourcePackageId
-- | Turn a 'PackageConfig', which contains GHC 'Module.ModuleName's into a Cabal specific
-- 'InstalledPackageInfo' which contains Cabal 'Distribution.ModuleName.ModuleName's
diff --git a/compiler/main/Packages.lhs b/compiler/main/Packages.lhs
index c4b8860186..e73ee75102 100644
--- a/compiler/main/Packages.lhs
+++ b/compiler/main/Packages.lhs
@@ -291,7 +291,7 @@ applyPackageFlag pkgs flag =
Just ([], _) -> panic "applyPackageFlag"
Just (p:ps,qs) -> return (p':ps')
where p' = p {exposed=True}
- ps' = hideAll (pkgName (package p)) (ps++qs)
+ ps' = hideAll (pkgName (sourcePackageId p)) (ps++qs)
HidePackage str ->
case matchingPackages str pkgs of
@@ -310,8 +310,9 @@ applyPackageFlag pkgs flag =
-- When a package is requested to be exposed, we hide all other
-- packages with the same name.
hideAll name ps = map maybe_hide ps
- where maybe_hide p | pkgName (package p) == name = p {exposed=False}
- | otherwise = p
+ where maybe_hide p
+ | pkgName (sourcePackageId p) == name = p {exposed=False}
+ | otherwise = p
matchingPackages :: String -> [PackageConfig]
@@ -325,15 +326,15 @@ matchingPackages str pkgs
-- version, or just the name if it is unambiguous.
packageMatches :: String -> PackageConfig -> Bool
packageMatches str p
- = str == display (package p)
- || str == display (pkgName (package p))
+ = str == display (sourcePackageId p)
+ || str == display (pkgName (sourcePackageId p))
pickPackages :: [PackageConfig] -> [String] -> [PackageConfig]
pickPackages pkgs strs =
[ p | p <- strs, Just (p:_, _) <- [matchingPackages p pkgs] ]
sortByVersion :: [InstalledPackageInfo_ m] -> [InstalledPackageInfo_ m]
-sortByVersion = sortBy (flip (comparing (pkgVersion.package)))
+sortByVersion = sortBy (flip (comparing (pkgVersion.sourcePackageId)))
comparing :: Ord a => (t -> a) -> t -> t -> Ordering
comparing f a b = f a `compare` f b
@@ -354,15 +355,15 @@ hideOldPackages dflags pkgs = mapM maybe_hide pkgs
| (p' : _) <- later_versions = do
debugTraceMsg dflags 2 $
(ptext (sLit "hiding package") <+>
- text (display (package p)) <+>
+ text (display (sourcePackageId p)) <+>
ptext (sLit "to avoid conflict with later version") <+>
- text (display (package p')))
+ text (display (sourcePackageId p')))
return (p {exposed=False})
| otherwise = return p
- where myname = pkgName (package p)
- myversion = pkgVersion (package p)
+ where myname = pkgName (sourcePackageId p)
+ myversion = pkgVersion (sourcePackageId p)
later_versions = [ p | p <- pkgs, exposed p,
- let pkg = package p,
+ let pkg = sourcePackageId p,
pkgName pkg == myname,
pkgVersion pkg > myversion ]
@@ -392,7 +393,7 @@ findWiredInPackages dflags pkgs = do
dphParPackageId ]
matches :: PackageConfig -> String -> Bool
- pc `matches` pid = display (pkgName (package pc)) == pid
+ pc `matches` pid = display (pkgName (sourcePackageId pc)) == pid
-- find which package corresponds to each wired-in package
-- delete any other packages with the same name
@@ -425,7 +426,7 @@ findWiredInPackages dflags pkgs = do
ptext (sLit "wired-in package ")
<> text wired_pkg
<> ptext (sLit " mapped to ")
- <> text (display (package pkg))
+ <> text (display (sourcePackageId pkg))
return (Just (installedPackageId pkg))
@@ -449,7 +450,7 @@ findWiredInPackages dflags pkgs = do
updateWiredInDependencies pkgs = map upd_pkg pkgs
where upd_pkg p
| installedPackageId p `elem` wired_in_ids
- = p { package = (package p){ pkgVersion = Version [] [] } }
+ = p { sourcePackageId = (sourcePackageId p){ pkgVersion = Version [] [] } }
| otherwise
= p
@@ -591,7 +592,7 @@ mkModuleMap pkg_db = foldr extend_modmap emptyUFM pkgids
hidden_mods = hiddenModules pkg
pprPkg :: PackageConfig -> SDoc
-pprPkg p = text (display (package p))
+pprPkg p = text (display (sourcePackageId p))
-- -----------------------------------------------------------------------------
-- Extracting information from the packages in scope
diff --git a/compiler/main/ParsePkgConf.y b/compiler/main/ParsePkgConf.y
index d05a6d54c0..4950b5fecc 100644
--- a/compiler/main/ParsePkgConf.y
+++ b/compiler/main/ParsePkgConf.y
@@ -62,7 +62,7 @@ fields :: { PackageConfig -> PackageConfig }
field :: { PackageConfig -> PackageConfig }
: VARID '=' pkgid
{% case unpackFS $1 of
- "package" -> return (\p -> p{package = $3})
+ "sourcePackageId" -> return (\p -> p{sourcePackageId = $3})
_ -> happyError
}