Can now be built with older git versions (before 1.7.7); the resulting binary should only be used with old git.
Remove git old version check from configure, and use the git version it was built against in the git check-attr code.
This commit is contained in:
parent
7892397020
commit
5a275a3f5d
4 changed files with 72 additions and 25 deletions
23
configure.hs
23
configure.hs
|
@ -2,7 +2,6 @@
|
|||
|
||||
import System.Directory
|
||||
import Data.List
|
||||
import Data.String.Utils
|
||||
import System.Cmd.Utils
|
||||
|
||||
import Build.TestConfig
|
||||
|
@ -11,7 +10,7 @@ tests :: [TestCase]
|
|||
tests =
|
||||
[ TestCase "version" getVersion
|
||||
, TestCase "git" $ requireCmd "git" "git --version >/dev/null"
|
||||
, TestCase "git version" checkGitVersion
|
||||
, TestCase "git version" getGitVersion
|
||||
, testCp "cp_a" "-a"
|
||||
, testCp "cp_p" "-p"
|
||||
, testCp "cp_reflink_auto" "--reflink=auto"
|
||||
|
@ -58,25 +57,11 @@ getVersionString = do
|
|||
where
|
||||
middle = drop 1 . init
|
||||
|
||||
{- Checks for a new enough version of git. -}
|
||||
checkGitVersion :: Test
|
||||
checkGitVersion = do
|
||||
getGitVersion :: Test
|
||||
getGitVersion = do
|
||||
(_, s) <- pipeFrom "git" ["--version"]
|
||||
let version = last $ words $ head $ lines s
|
||||
if dotted version < dotted need
|
||||
then error $ "git version " ++ version ++ " too old; need " ++ need
|
||||
else return $ Config "gitversion" (StringConfig version)
|
||||
where
|
||||
-- for git-check-attr behavior change
|
||||
need = "1.7.7"
|
||||
dotted = sum . mult 1 . reverse . extend 10 . map readi . split "."
|
||||
extend n l = l ++ replicate (n - length l) 0
|
||||
mult _ [] = []
|
||||
mult n (x:xs) = (n*x) : mult (n*100) xs
|
||||
readi :: String -> Integer
|
||||
readi s = case reads s of
|
||||
((x,_):_) -> x
|
||||
_ -> 0
|
||||
return $ Config "gitversion" (StringConfig version)
|
||||
|
||||
{- Set up cabal file with version. -}
|
||||
cabalSetup :: IO ()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue