From 161823d6eaff2adb7b99475b0edfe819fde11be1 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 18 Nov 2010 13:48:28 -0400 Subject: 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. --- configure.hs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'configure.hs') 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] -- cgit v1.2.3