summaryrefslogtreecommitdiff
path: root/Build/TestConfig.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-03-23 12:36:06 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-03-23 12:39:14 -0400
commit981e1ab43dd4dc2ae99b69e34c5f2dabd35ec1ac (patch)
tree13b17f541ae829d9ed8acc28f148bd39fa07bef3 /Build/TestConfig.hs
parentff62bc515170f728d4418a56d91ac9a71d5dd522 (diff)
avoid rewriting SysConfig.hs with identical contents
This avoids some compliation when when reconfiguring.
Diffstat (limited to 'Build/TestConfig.hs')
-rw-r--r--Build/TestConfig.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/Build/TestConfig.hs b/Build/TestConfig.hs
index 0cc2019cf..03d87cd8b 100644
--- a/Build/TestConfig.hs
+++ b/Build/TestConfig.hs
@@ -5,6 +5,7 @@ module Build.TestConfig where
import System.IO
import System.Cmd
import System.Exit
+import System.Directory
type ConfigKey = String
data ConfigValue =
@@ -36,8 +37,14 @@ instance Show Config where
valuetype (MaybeBoolConfig _) = "Maybe Bool"
writeSysConfig :: [Config] -> IO ()
-writeSysConfig config = writeFile "Build/SysConfig.hs" body
+writeSysConfig config = do
+ e <- doesFileExist dest
+ old <- if e then readFile dest else return []
+ if (old /= body)
+ then writeFile dest body
+ else return ()
where
+ dest = "Build/SysConfig.hs"
body = unlines $ header ++ map show config ++ footer
header = [
"{- Automatically generated. -}"