[commit: ghc] wip/nfs-locking: Add userPackages for overriding default targetPackages. (5d6c2d7)

git at git.haskell.org git at git.haskell.org
Thu Oct 26 23:57:19 UTC 2017


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

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

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

commit 5d6c2d7a48d85f2af6f341ee14bc86de400b4779
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Sun Jun 14 14:50:48 2015 +0100

    Add userPackages for overriding default targetPackages.


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

5d6c2d7a48d85f2af6f341ee14bc86de400b4779
 src/Expression.hs   | 5 ++++-
 src/Rules.hs        | 2 +-
 src/UserSettings.hs | 9 ++++++---
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/Expression.hs b/src/Expression.hs
index ac72891..77be4e9 100644
--- a/src/Expression.hs
+++ b/src/Expression.hs
@@ -6,7 +6,7 @@ module Expression (
     Ways, Packages,
     Environment (..), defaultEnvironment,
     append, appendM, remove, appendSub, appendSubD, filterSub, removeSub,
-    interpret,
+    interpret, interpretDiff,
     applyPredicate, (?), (??), stage, notStage, builder, notBuilder, package,
     configKeyValue, configKeyValues,
     configKeyYes, configKeyNo, configKeyNonEmpty
@@ -89,6 +89,9 @@ interpret = flip runReaderT
 fromDiff :: Monoid a => DiffExpr a -> Expr a
 fromDiff = fmap (($ mempty) . appEndo)
 
+interpretDiff :: Environment -> Expr a -> Action a
+interpretDiff env = interpret env . fromDiff
+
 applyPredicate :: Monoid a => Predicate -> Expr a -> Expr a
 applyPredicate predicate expr = do
     bool <- predicate
diff --git a/src/Rules.hs b/src/Rules.hs
index 50fa5e1..2873abf 100644
--- a/src/Rules.hs
+++ b/src/Rules.hs
@@ -18,7 +18,7 @@ generateTargets :: Rules ()
 generateTargets = action $
     forM_ [Stage0 ..] $ \stage -> do
         let env = defaultEnvironment { getStage = stage }
-        pkgs <- interpret env $ fromDiff targetPackages
+        pkgs <- interpretDiff env $ targetPackages <> userPackages
         forM_ pkgs $ \pkg -> do
             let dir = targetDirectory stage pkg
             need [pkgPath pkg </> dir </> "package-data.mk"]
diff --git a/src/UserSettings.hs b/src/UserSettings.hs
index 0a37159..1615d60 100644
--- a/src/UserSettings.hs
+++ b/src/UserSettings.hs
@@ -1,5 +1,5 @@
 module UserSettings (
-    userSettings
+    userSettings, userPackages
     ) where
 
 import Base hiding (arg, args, Args)
@@ -12,6 +12,9 @@ userSettings :: Settings
 userSettings = mconcat
     [ package compiler ? stage Stage0 ? append ["foo", "bar"]
     , builder (Ghc Stage0) ? remove ["-O2"]
-    , builder GhcCabal ? removeSub "--configure-option=CFLAGS" ["-Werror"]
-    ]
+    , builder GhcCabal ? removeSub "--configure-option=CFLAGS" ["-Werror"] ]
 
+userPackages :: Settings
+userPackages = mconcat
+    [ stage Stage1 ? remove [cabal]
+    ,                remove [compiler] ]



More information about the ghc-commits mailing list