summaryrefslogtreecommitdiff
path: root/Build/Configure.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Build/Configure.hs')
-rw-r--r--Build/Configure.hs28
1 files changed, 15 insertions, 13 deletions
diff --git a/Build/Configure.hs b/Build/Configure.hs
index 3460f04..5682e8f 100644
--- a/Build/Configure.hs
+++ b/Build/Configure.hs
@@ -1,31 +1,33 @@
-{- Checks system configuration and generates SysConfig. -}
+{- Checks system configuration and generates Build/SysConfig. -}
{-# OPTIONS_GHC -fno-warn-tabs #-}
module Build.Configure where
-import Control.Monad.IfElse
-import Control.Applicative
-import Prelude
-
import Build.TestConfig
-import Build.Version
-import Git.Version
+import Utility.Env.Basic
+import qualified Git.Version
+
+import Control.Monad
tests :: [TestCase]
tests =
- [ TestCase "version" (Config "packageversion" . StringConfig <$> getVersion)
- , TestCase "git" $ testCmd "git" "git --version >/dev/null"
+ [ TestCase "git" $ testCmd "git" "git --version >/dev/null"
, TestCase "git version" getGitVersion
]
getGitVersion :: Test
-getGitVersion = Config "gitversion" . StringConfig . show
- <$> Git.Version.installed
+getGitVersion = go =<< getEnv "FORCE_GIT_VERSION"
+ where
+ go (Just s) = return $ Config "gitversion" $ StringConfig s
+ go Nothing = do
+ v <- Git.Version.installed
+ let oldestallowed = Git.Version.normalize "2.1"
+ when (v < oldestallowed) $
+ error $ "installed git version " ++ show v ++ " is too old! (Need " ++ show oldestallowed ++ " or newer)"
+ return $ Config "gitversion" $ StringConfig $ show v
run :: [TestCase] -> IO ()
run ts = do
config <- runTests ts
writeSysConfig config
- whenM (isReleaseBuild) $
- cabalSetup "git-repair.cabal"