[commit: Cabal] master: Make cabal upload/check print out the error messages reported by the server (a6fe501)
Ian Lynagh
igloo at earth.li
Fri Jun 24 02:03:39 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/a6fe50118ff20d86d892b6e8ec96948894cd3ad8
>---------------------------------------------------------------
commit a6fe50118ff20d86d892b6e8ec96948894cd3ad8
Author: Duncan Coutts <duncan at haskell.org>
Date: Thu Jun 4 12:48:36 2009 +0000
Make cabal upload/check print out the error messages reported by the server
The code to do it was already there but we were checking for the
mime type text/plain using just (==) when in fact the server reports
text/plain; charset="ISO-8859-1"
so we have to parse the field a bit better (still a bit of a hack).
>---------------------------------------------------------------
cabal-install/Distribution/Client/Upload.hs | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/cabal-install/Distribution/Client/Upload.hs b/cabal-install/Distribution/Client/Upload.hs
index b748455..1e812c7 100644
--- a/cabal-install/Distribution/Client/Upload.hs
+++ b/cabal-install/Distribution/Client/Upload.hs
@@ -120,13 +120,15 @@ handlePackage verbosity uri auth path =
request req
debug verbosity $ show resp
case rspCode resp of
- (2,0,0) -> do notice verbosity "OK"
- (x,y,z) -> do notice verbosity $ "ERROR: " ++ path ++ ": "
+ (2,0,0) -> do notice verbosity "Ok"
+ (x,y,z) -> do notice verbosity $ "Error: " ++ path ++ ": "
++ map intToDigit [x,y,z] ++ " "
++ rspReason resp
case findHeader HdrContentType resp of
- Just "text/plain" -> notice verbosity $ rspBody resp
- _ -> debug verbosity $ rspBody resp
+ Just contenttype
+ | takeWhile (/= ';') contenttype == "text/plain"
+ -> notice verbosity $ rspBody resp
+ _ -> debug verbosity $ rspBody resp
mkRequest :: URI -> FilePath -> IO (Request String)
mkRequest uri path =
More information about the Cvs-libraries
mailing list