diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-12-14 12:55:53 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-12-14 12:55:53 -0400 |
commit | 5ca81d114d7ccf0ee984cb03f56ad6ec1d9499f0 (patch) | |
tree | 4b49c7c03e77f356dd3941070509a498d97a3290 /Build | |
parent | 3a59749f2c0603872109a85c44234dd744d059cc (diff) | |
download | git-repair-5ca81d114d7ccf0ee984cb03f56ad6ec1d9499f0.tar.gz |
Merge from git-annex.
Diffstat (limited to 'Build')
-rw-r--r-- | Build/Configure.hs | 4 | ||||
-rw-r--r-- | Build/TestConfig.hs | 17 |
2 files changed, 4 insertions, 17 deletions
diff --git a/Build/Configure.hs b/Build/Configure.hs index d48d580..dc15141 100644 --- a/Build/Configure.hs +++ b/Build/Configure.hs @@ -1,4 +1,4 @@ -{- Checks system configuration and generates SysConfig.hs. -} +{- Checks system configuration and generates SysConfig. -} {-# OPTIONS_GHC -fno-warn-tabs #-} @@ -15,7 +15,7 @@ import Git.Version tests :: [TestCase] tests = [ TestCase "version" (Config "packageversion" . StringConfig <$> getVersion) - , TestCase "git" $ requireCmd "git" "git --version >/dev/null" + , TestCase "git" $ testCmd "git" "git --version >/dev/null" , TestCase "git version" getGitVersion ] diff --git a/Build/TestConfig.hs b/Build/TestConfig.hs index 79979c5..2f7213f 100644 --- a/Build/TestConfig.hs +++ b/Build/TestConfig.hs @@ -1,4 +1,4 @@ -{- Tests the system and generates Build.SysConfig.hs. -} +{- Tests the system and generates SysConfig. -} {-# OPTIONS_GHC -fno-warn-tabs #-} @@ -42,12 +42,11 @@ instance Show Config where valuetype (MaybeBoolConfig _) = "Maybe Bool" writeSysConfig :: [Config] -> IO () -writeSysConfig config = writeFile "Build/SysConfig.hs" body +writeSysConfig config = writeFile "Build/SysConfig" body where body = unlines $ header ++ map show config ++ footer header = [ "{- Automatically generated. -}" - , "module Build.SysConfig where" , "" ] footer = [] @@ -61,18 +60,6 @@ runTests (TestCase tname t : ts) = do rest <- runTests ts return $ c:rest -{- Tests that a command is available, aborting if not. -} -requireCmd :: ConfigKey -> String -> Test -requireCmd k cmdline = do - ret <- testCmd k cmdline - handle ret - where - handle r@(Config _ (BoolConfig True)) = return r - handle r = do - testEnd r - error $ "** the " ++ c ++ " command is required" - c = head $ words cmdline - {- Checks if a command is available by running a command line. -} testCmd :: ConfigKey -> String -> Test testCmd k cmdline = do |