[commit: ghc] wip/nfs-locking: Don't move from a temporary directory. (86f3052)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 00:08:41 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/86f3052c2cd738427136899bfe3a47210c4d98a5/ghc

>---------------------------------------------------------------

commit 86f3052c2cd738427136899bfe3a47210c4d98a5
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Tue Jan 12 22:22:34 2016 +0000

    Don't move from a temporary directory.
    
    Fix #156.


>---------------------------------------------------------------

86f3052c2cd738427136899bfe3a47210c4d98a5
 src/Rules/Libffi.hs | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/Rules/Libffi.hs b/src/Rules/Libffi.hs
index 7dd0376..0c38cd2 100644
--- a/src/Rules/Libffi.hs
+++ b/src/Rules/Libffi.hs
@@ -27,9 +27,6 @@ libffiBuild = buildRootPath -/- "stage0/libffi"
 libffiLibrary :: FilePath
 libffiLibrary = libffiBuild -/- "inst/lib/libffi.a"
 
-libffiMakefile :: FilePath
-libffiMakefile = libffiBuild -/- "Makefile.in"
-
 fixLibffiMakefile :: String -> String
 fixLibffiMakefile = unlines . map
     ( replace "-MD" "-MMD"
@@ -75,7 +72,7 @@ libffiRules = do
     libffiDependencies &%> \_ -> do
         when trackBuildSystem $ need [sourcePath -/- "Rules/Libffi.hs"]
         liftIO $ removeFiles libffiBuild ["//*"]
-        createDirectory $ buildRootPath -/- "stage0"
+        createDirectory $ buildRootPath -/- stageString Stage0
 
         tarballs <- getDirectoryFiles "" ["libffi-tarballs/libffi*.tar.gz"]
         when (length tarballs /= 1) $
@@ -85,12 +82,11 @@ libffiRules = do
         need tarballs
         let libname = dropExtension . dropExtension . takeFileName $ head tarballs
 
-        withTempDir $ \tmpDir -> do
-            let unifiedTmpDir = unifyPath tmpDir
-            build $ fullTarget libffiTarget Tar tarballs [unifiedTmpDir]
-            moveDirectory (unifiedTmpDir -/- libname) libffiBuild
+        build $ fullTarget libffiTarget Tar tarballs [buildRootPath]
+        actionFinally (moveDirectory (buildRootPath -/- libname) libffiBuild) $
+            removeFiles buildRootPath [libname <//> "*"]
 
-        fixFile libffiMakefile fixLibffiMakefile
+        fixFile (libffiBuild -/- "Makefile.in") fixLibffiMakefile
 
         forM_ ["config.guess", "config.sub"] $ \file ->
             copyFile file (libffiBuild -/- file)



More information about the ghc-commits mailing list