[commit: Cabal] master: Unbreak the world target (2313511)
Ian Lynagh
igloo at earth.li
Fri Jun 24 02:08:28 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/231351146f057cd7f8604b45d6bf38254cb99624
>---------------------------------------------------------------
commit 231351146f057cd7f8604b45d6bf38254cb99624
Author: Duncan Coutts <duncan at community.haskell.org>
Date: Fri Mar 4 23:39:56 2011 +0000
Unbreak the world target
I'd accidentally left out the world target from the parsing phase
of the new user target handling system, so cabal install world did
not work. Now added to the target parser.
>---------------------------------------------------------------
cabal-install/Distribution/Client/Targets.hs | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/cabal-install/Distribution/Client/Targets.hs b/cabal-install/Distribution/Client/Targets.hs
index 9913dca..79b1cef 100644
--- a/cabal-install/Distribution/Client/Targets.hs
+++ b/cabal-install/Distribution/Client/Targets.hs
@@ -202,13 +202,17 @@ data UserTargetProblem
| UserTargetUnexpectedUriScheme String
| UserTargetUnrecognisedUri String
| UserTargetUnrecognised String
+ | UserTargetBadWorldPkg
deriving Show
readUserTarget :: String -> IO (Either UserTargetProblem UserTarget)
readUserTarget targetstr =
case testNamedTargets targetstr of
- Just target -> return target
- Nothing -> do
+ Just (Dependency (PackageName "world") verrange)
+ | verrange == anyVersion -> return (Right UserTargetWorld)
+ | otherwise -> return (Left UserTargetBadWorldPkg)
+ Just dep -> return (Right (UserTargetNamed dep))
+ Nothing -> do
fileTarget <- testFileTargets targetstr
case fileTarget of
Just target -> return target
@@ -217,8 +221,7 @@ readUserTarget targetstr =
Just target -> return target
Nothing -> return (Left (UserTargetUnrecognised targetstr))
where
- testNamedTargets = fmap (Right . UserTargetNamed)
- . readPToMaybe parseDependencyOrPackageId
+ testNamedTargets = readPToMaybe parseDependencyOrPackageId
testFileTargets filename = do
isDir <- doesDirectoryExist filename
@@ -292,6 +295,10 @@ reportUserTargetProblems problems = do
++ " - cabal files 'pkgname.cabal' or package directories 'pkgname/'\n"
++ " - package tarballs 'pkgname.tar.gz' or 'http://example.com/pkgname.tar.gz'"
+ case [ () | UserTargetBadWorldPkg <- problems ] of
+ [] -> return ()
+ _ -> die "The special 'world' target does not take any version."
+
case [ target | UserTargetNonexistantFile target <- problems ] of
[] -> return ()
target -> die
More information about the Cvs-libraries
mailing list