summaryrefslogtreecommitdiff
path: root/configure.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-11-18 13:48:28 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-11-18 13:49:01 -0400
commit161823d6eaff2adb7b99475b0edfe819fde11be1 (patch)
tree985788fced5af741d7da3b735876ba24e2b7f9d7 /configure.hs
parent54513c69baffa40f2fcce42eb8651fdd98e05277 (diff)
Only use cp -a if it is supported, falling back to cp -p or plain cp.
* cp --reflink=auto is used if supported, and will make git annex unlock much faster on filesystems like btrfs that support copy of write.
Diffstat (limited to 'configure.hs')
-rw-r--r--configure.hs18
1 files changed, 9 insertions, 9 deletions
diff --git a/configure.hs b/configure.hs
index fa07be3ab..56daf583a 100644
--- a/configure.hs
+++ b/configure.hs
@@ -1,5 +1,4 @@
-{- Checks system configuration and generates SysConfig.hs.
- -}
+{- Checks system configuration and generates SysConfig.hs. -}
import System.IO
import System.Cmd
@@ -12,8 +11,9 @@ data Config = Config String Bool
tests :: [TestDesc]
tests = [
- TestDesc "cp -a" "cp_a" cp_a
- , TestDesc "cp --reflink" "cp_reflink" cp_reflink
+ TestDesc "cp -a" "cp_a" $ testCp "-a"
+ , TestDesc "cp -p" "cp_p" $ testCp "-p"
+ , TestDesc "cp --reflink=auto" "cp_reflink_auto" $ testCp "--reflink=auto"
]
tmpDir :: String
@@ -25,11 +25,9 @@ testFile = tmpDir ++ "/testfile"
quiet :: String -> String
quiet s = s ++ " 2>/dev/null"
-cp_a :: Test
-cp_a = testCmd $ quiet $ "cp -a " ++ testFile ++ " " ++ testFile ++ ".new"
-
-cp_reflink :: Test
-cp_reflink = testCmd $ quiet $ "cp --reflink=auto " ++ testFile ++ " " ++ testFile ++ ".new"
+testCp :: String -> Test
+testCp option = testCmd $ quiet $ "cp " ++ option ++ " " ++ testFile ++
+ " " ++ testFile ++ ".new"
testCmd :: String -> Test
testCmd c = do
@@ -51,6 +49,7 @@ writeSysConfig config = do
header = [
"{- Automatically generated by configure. -}"
, "module SysConfig where"
+ , ""
]
footer = []
vars [] = []
@@ -58,6 +57,7 @@ writeSysConfig config = do
showvar (Config name val) = [
name ++ " :: Bool"
, name ++ " = " ++ show val
+ , ""
]
runTests :: [TestDesc] -> IO [Config]