Skip to content

Commit

Permalink
use cabal package tarball downloading code from cabal-install
Browse files Browse the repository at this point in the history
  • Loading branch information
kolmodin committed Dec 17, 2009
1 parent 8202cd4 commit 821330f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
23 changes: 11 additions & 12 deletions Merge.hs
Expand Up @@ -81,6 +81,7 @@ import Network.HTTP
import Cabal2Ebuild

import Distribution.Client.IndexUtils ( getAvailablePackages )
import Distribution.Client.Fetch ( downloadURI )
import qualified Distribution.Client.PackageIndex as Index
import Distribution.Client.Types

Expand Down Expand Up @@ -315,18 +316,16 @@ fetchAndDigest :: Verbosity
-> IO ()
fetchAndDigest verbosity ebuildDir tarballName tarballURI =
withWorkingDirectory ebuildDir $ do
notice verbosity $ "Fetching " ++ show tarballURI
e_response <- simpleHTTP (Request tarballURI GET [] "")
case e_response of
Left err -> throwEx (E.DownloadFailed (show tarballURI) (show err))
Right response -> do
repo_info <- Host.getInfo
let tarDestination = (Host.distfiles_dir repo_info) </> tarballName
notice verbosity $ "Saving to " ++ tarDestination
writeFile tarDestination (rspBody response)
notice verbosity "Recalculating digests..."
system "repoman manifest"
return ()
repo_info <- Host.getInfo
let tarDestination = (Host.distfiles_dir repo_info) </> tarballName
merr <- downloadURI verbosity tarDestination tarballURI
case merr of
Just err -> throwEx (E.DownloadFailed (show tarballURI) (show err))
Nothing -> do
notice verbosity $ "Saved to " ++ tarDestination
notice verbosity "Recalculating digests..."
system "repoman manifest"
return ()

withWorkingDirectory :: FilePath -> IO a -> IO a
withWorkingDirectory newDir action = do
Expand Down
1 change: 1 addition & 0 deletions cabal-install-0.7.5/Distribution/Client/Fetch.hs
Expand Up @@ -19,6 +19,7 @@ module Distribution.Client.Fetch (
fetchPackage,
isFetched,
downloadIndex,
downloadURI
) where

import Distribution.Client.Types
Expand Down

0 comments on commit 821330f

Please sign in to comment.