[Pkg-haskell-commits] [tools] 02/07: A bit more reliably downloading in AcquireFile

Joachim Breitner nomeata at moszumanska.debian.org
Mon Sep 8 07:29:40 UTC 2014


This is an automated email from the git hooks/post-receive script.

nomeata pushed a commit to branch master
in repository tools.

commit 95dd1097f5b3f529139b57b4032eba10b6b642de
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Thu Aug 28 11:58:37 2014 -0700

    A bit more reliably downloading in AcquireFile
---
 AcquireFile.hs | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/AcquireFile.hs b/AcquireFile.hs
index 0afd68d..719934c 100644
--- a/AcquireFile.hs
+++ b/AcquireFile.hs
@@ -25,6 +25,7 @@ acquireFile url ungz offline = do
         Just path -> do
                    createDirectoryIfMissing False path
                    let savename = path ++ "/"++ map fixChar url
+                   let tmpname = savename ++ ".tmp"
                    ex <- doesFileExist savename
                    when (offline && not ex) $ do
                       hPutStrLn stderr $ "Cached file for " ++ url ++ " does not exist, cannot use offline mode."
@@ -35,6 +36,8 @@ acquireFile url ungz offline = do
                               [ url ]
                    unless offline $ do
                      readProcess "/usr/bin/curl" args ""
+                     ex <- doesFileExist tmpname
+                     when ex $ renameFile tmpname savename
                      return ()
                    ex <- doesFileExist savename
                    unless ex $ do

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-haskell/tools.git



More information about the Pkg-haskell-commits mailing list