[commit: ghc] wip/nfs-locking: Add copyFileUntracked (#313) (bc32262)
git at git.haskell.org
git at git.haskell.org
Fri Oct 27 00:32:54 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/nfs-locking
Link : http://ghc.haskell.org/trac/ghc/changeset/bc32262d3aa0e6586daee0c0d6edef98310ebe98/ghc
>---------------------------------------------------------------
commit bc32262d3aa0e6586daee0c0d6edef98310ebe98
Author: Zhen Zhang <izgzhen at gmail.com>
Date: Tue May 16 13:13:17 2017 -0700
Add copyFileUntracked (#313)
>---------------------------------------------------------------
bc32262d3aa0e6586daee0c0d6edef98310ebe98
src/Rules/Libffi.hs | 4 ++--
src/Util.hs | 12 ++++++++++--
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/Rules/Libffi.hs b/src/Rules/Libffi.hs
index 99b77c8..57f6263 100644
--- a/src/Rules/Libffi.hs
+++ b/src/Rules/Libffi.hs
@@ -39,7 +39,7 @@ configureEnvironment = do
libffiRules :: Rules ()
libffiRules = do
- libffiDependencies &%> \_ -> do
+ (libffiLibrary : libffiDependencies) &%> \_ -> do
useSystemFfi <- flag UseSystemFfi
if useSystemFfi
then do
@@ -57,7 +57,7 @@ libffiRules = do
ways <- interpretInContext libffiContext (getLibraryWays <> getRtsWays)
forM_ (nubOrd ways) $ \way ->
- copyFile libffiLibrary =<< rtsLibffiLibrary way
+ copyFileUntracked libffiLibrary =<< rtsLibffiLibrary way
putSuccess $ "| Successfully built custom library 'libffi'"
diff --git a/src/Util.hs b/src/Util.hs
index b6d9536..1fd19f8 100644
--- a/src/Util.hs
+++ b/src/Util.hs
@@ -3,7 +3,7 @@ module Util (
removeFile, copyDirectory, copyDirectoryContents, createDirectory,
moveDirectory, removeDirectory, applyPatch, runBuilder, runBuilderWith,
makeExecutable, renderProgram, renderLibrary, Match(..), builderEnvironment,
- needBuilder
+ needBuilder, copyFileUntracked
) where
import qualified System.Directory.Extra as IO
@@ -94,10 +94,18 @@ copyFile :: FilePath -> FilePath -> Action ()
copyFile source target = do
need [source] -- Guarantee source is built before printing progress info.
let dir = takeDirectory target
- unlessM (liftIO $ IO.doesDirectoryExist dir) $ createDirectory dir
+ liftIO $ IO.createDirectoryIfMissing True dir
putProgressInfo $ renderAction "Copy file" source target
copyFileChanged source target
+-- Same as copyFile, but not tracking the source as a build dependency
+copyFileUntracked :: FilePath -> FilePath -> Action ()
+copyFileUntracked source target = do
+ let dir = takeDirectory target
+ liftIO $ IO.createDirectoryIfMissing True dir
+ putProgressInfo $ renderAction "Copy file (Untracked)" source target
+ liftIO $ IO.copyFile source target
+
-- | Move a file; we cannot track the source, because it is moved.
moveFile :: FilePath -> FilePath -> Action ()
moveFile source target = do
More information about the ghc-commits
mailing list