[commit: ghc] wip/nfs-locking: Compute package dependencies only for packages we build (67f433b)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 00:43:15 UTC 2017


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

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

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

commit 67f433bf028ec4c4251b928fa476ff1302e8299c
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Thu Oct 27 20:00:58 2016 +0100

    Compute package dependencies only for packages we build
    
    See #265


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

67f433bf028ec4c4251b928fa476ff1302e8299c
 src/Rules/Cabal.hs      | 5 +++--
 src/Rules/Test.hs       | 2 +-
 src/Settings.hs         | 5 ++++-
 src/Settings/Default.hs | 1 -
 4 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/Rules/Cabal.hs b/src/Rules/Cabal.hs
index 409ca1b..8848268 100644
--- a/src/Rules/Cabal.hs
+++ b/src/Rules/Cabal.hs
@@ -16,7 +16,7 @@ cabalRules :: Rules ()
 cabalRules = do
     -- Cache boot package constraints (to be used in 'cabalArgs').
     bootPackageConstraints %> \out -> do
-        bootPkgs <- interpretInContext (stageContext Stage0) getPackages
+        bootPkgs <- stagePackages Stage0
         let pkgs = filter (\p -> p /= compiler && isLibrary p) bootPkgs
         constraints <- forM (sort pkgs) $ \pkg -> do
             need [pkgCabalFile pkg]
@@ -28,7 +28,8 @@ cabalRules = do
 
     -- Cache package dependencies.
     packageDependencies %> \out -> do
-        pkgDeps <- forM (sort knownPackages) $ \pkg ->
+        pkgs <- concatMapM stagePackages [Stage0 .. Stage2]
+        pkgDeps <- forM (sort pkgs) $ \pkg ->
             if pkg `elem` [hp2ps, libffi, rts, touchy, unlit]
             then return $ pkgNameString pkg
             else do
diff --git a/src/Rules/Test.hs b/src/Rules/Test.hs
index 3b2fd1b..18513a7 100644
--- a/src/Rules/Test.hs
+++ b/src/Rules/Test.hs
@@ -23,7 +23,7 @@ testRules = do
 
     "test" ~> do
         let yesNo x = show $ if x then "YES" else "NO"
-        pkgs     <- interpretInContext (stageContext Stage1) getPackages
+        pkgs     <- stagePackages Stage1
         tests    <- filterM doesDirectoryExist $ concat
                     [ [ pkgPath pkg -/- "tests", pkgPath pkg -/- "tests-ghc" ]
                     | pkg <- pkgs, isLibrary pkg, pkg /= rts, pkg /= libffi ]
diff --git a/src/Settings.hs b/src/Settings.hs
index 3fdf14f..0a71c90 100644
--- a/src/Settings.hs
+++ b/src/Settings.hs
@@ -1,7 +1,7 @@
 module Settings (
     getArgs, getPackages, getLibraryWays, getRtsWays, flavour, knownPackages,
     findKnownPackage, getPkgData, getPkgDataList, isLibrary, getPackagePath,
-    getContextDirectory, getBuildPath
+    getContextDirectory, getBuildPath, stagePackages
     ) where
 
 import Base
@@ -28,6 +28,9 @@ getRtsWays = fromDiffExpr $ rtsWays flavour
 getPackages :: Expr [Package]
 getPackages = fromDiffExpr $ packages flavour
 
+stagePackages :: Stage -> Action [Package]
+stagePackages stage = interpretInContext (stageContext stage) getPackages
+
 getPackagePath :: Expr FilePath
 getPackagePath = pkgPath <$> getPackage
 
diff --git a/src/Settings/Default.hs b/src/Settings/Default.hs
index f529019..f7ef62e 100644
--- a/src/Settings/Default.hs
+++ b/src/Settings/Default.hs
@@ -65,7 +65,6 @@ defaultBuilderArgs = mconcat
     , makeBuilderArgs
     , tarBuilderArgs ]
 
-
 -- | All 'Package'-dependent command line arguments.
 defaultPackageArgs :: Args
 defaultPackageArgs = mconcat



More information about the ghc-commits mailing list