Commit 6866c112 authored by simonmar's avatar simonmar

[project @ 2005-02-10 15:12:22 by simonmar]

Make sure we don't register a package with an identifier that cannot
be parsed later.
parent c43539c3
......@@ -505,6 +505,7 @@ validatePackageConfig :: InstalledPackageInfo
-> Bool -- force
-> IO ()
validatePackageConfig pkg db_stack auto_ghci_libs update force = do
checkPackageId pkg
checkDuplicates db_stack pkg update
mapM_ (checkDep db_stack force) (depends pkg)
mapM_ (checkDir force) (importDirs pkg)
......@@ -515,6 +516,17 @@ validatePackageConfig pkg db_stack auto_ghci_libs update force = do
-- extra_libraries :: [String],
-- c_includes :: [String],
-- When the package name and version are put together, sometimes we can
-- end up with a package id that cannot be parsed. This will lead to
-- difficulties when the user wants to refer to the package later, so
-- we check that the package id can be parsed properly here.
checkPackageId :: InstalledPackageInfo -> IO ()
checkPackageId ipi =
let str = showPackageId (package ipi) in
case [ x | (x,ys) <- readP_to_S parsePackageId str, all isSpace ys ] of
[_] -> return ()
[] -> die ("invalid package identifier: " ++ str)
_ -> die ("ambiguous package identifier: " ++ str)
checkDuplicates :: PackageDBStack -> InstalledPackageInfo -> Bool -> IO ()
checkDuplicates db_stack pkg update = do
......
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