[commit: Cabal] master: Uploading build reports shouldn't fail if there are no reports (01af90e)
Ian Lynagh
igloo at earth.li
Tue Oct 25 23:31:14 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/01af90e7946dcd18dfa360e14b4e0681fb840521
>---------------------------------------------------------------
commit 01af90e7946dcd18dfa360e14b4e0681fb840521
Author: Max Bolingbroke <batterseapower at hotmail.com>
Date: Sun Oct 16 14:38:19 2011 +0000
Uploading build reports shouldn't fail if there are no reports
>---------------------------------------------------------------
cabal-install/Distribution/Client/Upload.hs | 25 ++++++++++++++-----------
1 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/cabal-install/Distribution/Client/Upload.hs b/cabal-install/Distribution/Client/Upload.hs
index 2454f49..75a6696 100644
--- a/cabal-install/Distribution/Client/Upload.hs
+++ b/cabal-install/Distribution/Client/Upload.hs
@@ -32,7 +32,7 @@ import System.Random (randomRIO)
import System.FilePath ((</>), takeExtension, takeFileName)
import qualified System.FilePath.Posix as FilePath.Posix (combine)
import System.Directory
-import Control.Monad (forM_)
+import Control.Monad (forM_, when)
--FIXME: how do we find this path for an arbitrary hackage server?
@@ -97,16 +97,19 @@ report verbosity repos mUsername mPassword = do
Left remoteRepo
-> do dotCabal <- defaultCabalDir
let srcDir = dotCabal </> "reports" </> remoteRepoName remoteRepo
- contents <- getDirectoryContents srcDir
- forM_ (filter (\c -> takeExtension c == ".log") contents) $ \logFile ->
- do inp <- readFile (srcDir </> logFile)
- let (reportStr, buildLog) = read inp :: (String,String)
- case BuildReport.parse reportStr of
- Left errs -> do warn verbosity $ "Errors: " ++ errs -- FIXME
- Right report' ->
- do info verbosity $ "Uploading report for " ++ display (BuildReport.package report')
- cabalBrowse verbosity auth $ BuildReport.uploadReports (remoteRepoURI remoteRepo) [(report', Just buildLog)]
- return ()
+ -- We don't want to bomb out just because we haven't built any packages from this repo yet
+ srcExists <- doesDirectoryExist srcDir
+ when srcExists $ do
+ contents <- getDirectoryContents srcDir
+ forM_ (filter (\c -> takeExtension c == ".log") contents) $ \logFile ->
+ do inp <- readFile (srcDir </> logFile)
+ let (reportStr, buildLog) = read inp :: (String,String)
+ case BuildReport.parse reportStr of
+ Left errs -> do warn verbosity $ "Errors: " ++ errs -- FIXME
+ Right report' ->
+ do info verbosity $ "Uploading report for " ++ display (BuildReport.package report')
+ cabalBrowse verbosity auth $ BuildReport.uploadReports (remoteRepoURI remoteRepo) [(report', Just buildLog)]
+ return ()
Right{} -> return ()
where
targetRepoURI = remoteRepoURI $ last [ remoteRepo | Left remoteRepo <- map repoKind repos ] --FIXME: better error message when no repos are given
More information about the Cvs-libraries
mailing list