summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
l---------config.hs2
-rw-r--r--debian/changelog8
-rw-r--r--doc/todo/merge_request:___96__propellor_--init__96___should_sometimes_run___96__cabal_sandbox_init__96__.mdwn2
-rw-r--r--privdata/relocate1
-rw-r--r--src/Propellor/DotDir.hs33
5 files changed, 43 insertions, 3 deletions
diff --git a/config.hs b/config.hs
index ec313725..97d90636 120000
--- a/config.hs
+++ b/config.hs
@@ -1 +1 @@
-config-simple.hs \ No newline at end of file
+joeyconfig.hs \ No newline at end of file
diff --git a/debian/changelog b/debian/changelog
index 4c432a73..1ea87d91 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+propellor (3.0.1) UNRELEASED; urgency=medium
+
+ * propellor --init now runs cabal sandbox init if cabal has been
+ configured with require-sandbox: True.
+ Thanks, Sean Whitton
+
+ -- Joey Hess <id@joeyh.name> Tue, 05 Apr 2016 11:39:48 -0400
+
propellor (3.0.0) unstable; urgency=medium
* Property types have been improved to indicate what systems they target.
diff --git a/doc/todo/merge_request:___96__propellor_--init__96___should_sometimes_run___96__cabal_sandbox_init__96__.mdwn b/doc/todo/merge_request:___96__propellor_--init__96___should_sometimes_run___96__cabal_sandbox_init__96__.mdwn
index 483af4a6..eb7f561b 100644
--- a/doc/todo/merge_request:___96__propellor_--init__96___should_sometimes_run___96__cabal_sandbox_init__96__.mdwn
+++ b/doc/todo/merge_request:___96__propellor_--init__96___should_sometimes_run___96__cabal_sandbox_init__96__.mdwn
@@ -1,3 +1,5 @@
Please consider merging branch `fix-init-build` of repository `https://git.spwhitton.name/propellor`.
`propellor --init` can fail if the build system is cabal and the user has `require-sandbox: True` in `~/.cabal/config`. This patch fixes that.
+
+> [[merged|done]] --[[Joey]]
diff --git a/privdata/relocate b/privdata/relocate
new file mode 100644
index 00000000..271692d8
--- /dev/null
+++ b/privdata/relocate
@@ -0,0 +1 @@
+.joeyconfig
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."