Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

use cabal package tarball downloading code from cabal-install

  • Loading branch information...
commit 821330fb919e961915eb8e1f2b58784ce23af080 1 parent 8202cd4
@kolmodin kolmodin authored
Showing with 12 additions and 12 deletions.
  1. +11 −12 Merge.hs
  2. +1 −0  cabal-install-0.7.5/Distribution/Client/Fetch.hs
View
23 Merge.hs
@@ -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
@@ -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
View
1  cabal-install-0.7.5/Distribution/Client/Fetch.hs
@@ -19,6 +19,7 @@ module Distribution.Client.Fetch (
fetchPackage,
isFetched,
downloadIndex,
+ downloadURI
) where
import Distribution.Client.Types
Please sign in to comment.
Something went wrong with that request. Please try again.