summaryrefslogtreecommitdiff
path: root/src/Propellor
diff options
context:
space:
mode:
Diffstat (limited to 'src/Propellor')
-rw-r--r--src/Propellor/Bootstrap.hs2
-rw-r--r--src/Propellor/DotDir.hs33
2 files changed, 31 insertions, 4 deletions
diff --git a/src/Propellor/Bootstrap.hs b/src/Propellor/Bootstrap.hs
index 300be156..29175a67 100644
--- a/src/Propellor/Bootstrap.hs
+++ b/src/Propellor/Bootstrap.hs
@@ -92,7 +92,6 @@ depsCommand msys = "( " ++ intercalate " ; " (concat [osinstall, cabalinstall])
, "libghc-exceptions-dev"
, "libghc-stm-dev"
, "libghc-text-dev"
- , "libghc-concurrent-output-dev"
, "make"
]
fbsddeps =
@@ -111,7 +110,6 @@ depsCommand msys = "( " ++ intercalate " ; " (concat [osinstall, cabalinstall])
, "hs-exceptions"
, "hs-stm"
, "hs-text"
- , "hs-concurrent-output"
, "gmake"
]
diff --git a/src/Propellor/DotDir.hs b/src/Propellor/DotDir.hs
index 4f27788d..669ac303 100644
--- a/src/Propellor/DotDir.hs
+++ b/src/Propellor/DotDir.hs
@@ -1,4 +1,9 @@
-module Propellor.DotDir where
+module Propellor.DotDir
+ ( distrepo
+ , dotPropellor
+ , interactiveInit
+ , checkRepoUpToDate
+ ) where
import Propellor.Message
import Propellor.Bootstrap
@@ -66,6 +71,23 @@ interactiveInit = ifM (doesDirectoryExist =<< dotPropellor)
setup
)
+-- | Determine whether we need to create a cabal sandbox in ~/.propellor/,
+-- which we do if the user has configured cabal to require a sandbox, and the
+-- build system is cabal.
+cabalSandboxRequired :: IO Bool
+cabalSandboxRequired = ifM cabal
+ ( do
+ home <- myHomeDir
+ ls <- lines <$> catchDefaultIO []
+ (readFile (home </> ".cabal" </> "config"))
+ -- For simplicity, we assume a sane ~/.cabal/config here:
+ return $ any ("True" `isInfixOf`) $
+ filter ("require-sandbox:" `isPrefixOf`) ls
+ , return False
+ )
+ where
+ cabal = buildSystem >>= \bSystem -> return (bSystem == "cabal")
+
say :: String -> IO ()
say = outputConcurrent
@@ -115,7 +137,7 @@ setup :: IO ()
setup = do
sayLn "Propellor's configuration file is ~/.propellor/config.hs"
sayLn ""
- sayLn "Lets get you started with a simple config that you can adapt"
+ sayLn "Let's get you started with a simple config that you can adapt"
sayLn "to your needs. You can start with:"
sayLn " A: A clone of propellor's git repository (most flexible)"
sayLn " B: The bare minimum files to use propellor (most simple)"
@@ -134,6 +156,13 @@ setup = do
, Param "propellor.buildsystem"
, Param b
]
+ ifM cabalSandboxRequired
+ ( void $ boolSystem "cabal"
+ [ Param "sandbox"
+ , Param "init"
+ ]
+ , return ()
+ )
buildPropellor Nothing
sayLn ""
sayLn "Great! Propellor is bootstrapped."