Pre-fetch packages to catch Hackage downtime early

This commit is contained in:
Michael Snoyman 2014-12-25 09:24:14 +02:00
parent ffe6392634
commit 7dd7763dab
3 changed files with 21 additions and 1 deletions

View File

@ -1,3 +1,7 @@
## 0.3.0.1
Pre-fetch all packages from Hackage to catch Hackage downtime early.
## 0.3.0.0
* Return progress URL from uploadBundle

View File

@ -136,6 +136,22 @@ performBuild pb = do
performBuild' :: PerformBuild -> IO [Text]
performBuild' pb@PerformBuild {..} = withBuildDir $ \builddir -> do
-- First make sure to fetch all of the dependencies... just in case Hackage
-- has an outage. Don't feel like wasting hours of CPU time.
pbLog $ encodeUtf8 "Pre-fetching all packages\n"
let toDownload = flip map (mapToList $ bpPackages pbPlan)
$ \(name, plan) -> unpack $ concat
[ display name
, "-"
, display $ ppVersion plan
]
withCheckedProcess
(proc "cabal"
$ "fetch"
: "--no-dependencies"
: toDownload)
$ \ClosedStream Inherited Inherited -> return ()
let removeTree' fp = whenM (isDirectory fp) (removeTree fp)
mapM_ removeTree' [pbInstallDest, pbLogDir]

View File

@ -1,5 +1,5 @@
name: stackage
version: 0.3.0.0
version: 0.3.0.1
synopsis: "Stable Hackage," tools for creating a vetted set of packages from Hackage.
description: Please see <http://www.stackage.org/package/stackage> for a description and documentation.
homepage: https://github.com/fpco/stackage