[commit: ghc] wip/nfs-locking: Split buildPackageData rule. (c1adff7)

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


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

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

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

commit c1adff7f36f088712b52c310eb0fb925e72d2549
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Sat Mar 5 14:07:47 2016 +0000

    Split buildPackageData rule.
    
    See #206.


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

c1adff7f36f088712b52c310eb0fb925e72d2549
 src/Rules/Data.hs | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/src/Rules/Data.hs b/src/Rules/Data.hs
index fee310f..719352f 100644
--- a/src/Rules/Data.hs
+++ b/src/Rules/Data.hs
@@ -1,7 +1,5 @@
 module Rules.Data (buildPackageData) where
 
-import qualified System.Directory as IO
-
 import Base
 import Context
 import Expression
@@ -22,8 +20,9 @@ buildPackageData context at Context {..} = do
         configure = pkgPath package -/- "configure"
         dataFile  = pkgDataFile context
         oldPath   = pkgPath package -/- contextDirectory context -- TODO: remove, #113
+        inTreeMk  = oldPath -/- takeFileName dataFile -- TODO: remove, #113
 
-    [dataFile, oldPath -/- "package-data.mk"] &%> \_ -> do
+    inTreeMk %> \mk -> do
         -- The first thing we do with any package is make sure all generated
         -- dependencies are in place before proceeding.
         orderOnly $ generatedDependencies stage package
@@ -37,22 +36,19 @@ buildPackageData context at Context {..} = do
         let depPkgs = matchPackageNames (sort pkgs) deps
         need =<< traverse (pkgConfFile . vanillaContext stage) depPkgs
 
-        -- TODO: get rid of this, see #113
-        let inTreeMk = oldPath -/- takeFileName dataFile
-
         need [cabalFile]
-        build $ Target context GhcCabal [cabalFile] [inTreeMk]
+        build $ Target context GhcCabal [cabalFile] [mk]
 
-        -- TODO: get rid of this, see #113
-        liftIO $ IO.copyFile inTreeMk dataFile
+    -- TODO: get rid of this, see #113
+    dataFile %> \mk -> do
+        copyFile inTreeMk mk
         autogenFiles <- getDirectoryFiles (oldPath -/- "build") ["autogen/*"]
         createDirectory $ buildPath context -/- "autogen"
         forM_ autogenFiles $ \file -> do
             copyFile (oldPath -/- "build" -/- file) (buildPath context -/- file)
         let haddockPrologue = "haddock-prologue.txt"
         copyFile (oldPath -/- haddockPrologue) (buildPath context -/- haddockPrologue)
-
-        postProcessPackageData context dataFile
+        postProcessPackageData context mk
 
     -- TODO: PROGNAME was $(CrossCompilePrefix)hp2ps
     priority 2.0 $ do



More information about the ghc-commits mailing list