Skip to content

Commit

Permalink
Clean up some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
dcoutts committed Aug 12, 2008
1 parent 9bc2a78 commit 2428f90
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
1 change: 1 addition & 0 deletions Distribution/Client/BuildReports/Upload.hs
Expand Up @@ -55,6 +55,7 @@ postBuildReport uri buildReport = do

putBuildLog :: BuildReportId -> BuildLog -> BrowserAction ()
putBuildLog reportId buildLog = do
--FIXME: do something if the request fails
(_, response) <- request Request {
rqURI = reportId{uriPath = uriPath reportId </> "buildlog"},
rqMethod = PUT,
Expand Down
15 changes: 6 additions & 9 deletions Distribution/Client/Upload.hs
Expand Up @@ -13,7 +13,6 @@ import Distribution.Client.Config

import qualified Distribution.Client.BuildReports.Anonymous as BuildReport
import qualified Distribution.Client.BuildReports.Upload as BuildReport
import qualified Distribution.Client.BuildReports.Storage as BuildReport

import Network.Browser
( BrowserAction, browse, request
Expand All @@ -30,8 +29,8 @@ import System.IO (hFlush, stdin, stdout, hGetEcho, hSetEcho
,openBinaryFile, IOMode(ReadMode), hGetContents)
import Control.Exception (bracket)
import System.Random (randomRIO)
import System.FilePath
import qualified System.FilePath.Posix as FilePath.Posix
import System.FilePath ((</>), takeExtension)
import qualified System.FilePath.Posix as FilePath.Posix (combine)
import System.Directory
import Control.Monad (forM_)

Expand Down Expand Up @@ -62,7 +61,7 @@ upload verbosity repos mUsername mPassword paths = do
notice verbosity $ "Uploading " ++ path ++ "... "
handlePackage verbosity uploadURI auth path
where
targetRepoURI = remoteRepoURI $ selectUploadRepo [ remoteRepo | Left remoteRepo <- map repoKind repos ]
targetRepoURI = remoteRepoURI $ last [ remoteRepo | Left remoteRepo <- map repoKind repos ] --FIXME: better error message when no repos are given
promptUsername :: IO Username
promptUsername = do
putStr "Hackage username: "
Expand All @@ -78,8 +77,6 @@ upload verbosity repos mUsername mPassword paths = do
hSetEcho stdin False -- no echoing for entering the password
fmap Password getLine

selectUploadRepo = last -- Use head?

report :: Verbosity -> [Repo] -> IO ()
report verbosity repos
= forM_ repos $ \repo ->
Expand All @@ -93,9 +90,9 @@ report verbosity repos
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)
browse $ BuildReport.uploadReports (remoteRepoURI remoteRepo) [(report, Just buildLog)]
Right report' ->
do info verbosity $ "Uploading report for " ++ display (BuildReport.package report')
browse $ BuildReport.uploadReports (remoteRepoURI remoteRepo) [(report', Just buildLog)]
return ()
Right{} -> return ()

Expand Down

0 comments on commit 2428f90

Please sign in to comment.