1
0
forked from GitHub/gf-core

Remove code which tries to get version information from darcs folder

This commit is contained in:
John J. Camilleri
2018-07-04 13:40:46 +02:00
parent f64b17eef7
commit b9b0217160
3 changed files with 0 additions and 51 deletions

View File

@@ -37,7 +37,6 @@ main = defaultMainWithHooks simpleUserHooks{ preBuild = gfPreBuild
gfPre args distFlag =
do h <- checkRGLArgs args
extractDarcsVersion distFlag
return h
gfPostBuild args flags pkg lbi =
@@ -383,35 +382,6 @@ default_gf lbi = buildDir lbi </> exeName' </> exeNameReal
exeNameReal = exeName' <.> (if null $ takeExtension exeName' then exeExtension else "")
-}
-- | Create autogen module with detailed version info by querying darcs
extractDarcsVersion distFlag =
do info <- tryIOE askDarcs
createDirectoryIfMissing True autogenPath
updateFile versionModulePath $ unlines $
["module "++modname++" where",
"{-# NOINLINE darcs_info #-}",
"darcs_info = "++show (either (const (Left ())) Right info)]
where
dist = fromFlagOrDefault "dist" distFlag
autogenPath = dist</>"build"</>"autogen"
versionModulePath = autogenPath</>"DarcsVersion_gf.hs"
modname = "DarcsVersion_gf"
askDarcs =
do flip unless (fail "no _darcs") =<< doesDirectoryExist "_darcs"
tags <- lines `fmap` readProcess "darcs" ["show","tags"] ""
let from = case tags of
[] -> []
tag:_ -> ["--from-tag="++tag]
dates <- (init' . patches) `fmap` readProcess "darcs" ("changes":from) ""
-- let dates = init' (filter ((`notElem` [""," "]).take 1) changes)
whatsnew <- tryIOE $ lines `fmap` readProcess "darcs" ["whatsnew","-s"] ""
return (listToMaybe tags,listToMaybe dates,
length dates,either (const 0) length whatsnew)
where
init' [] = []
init' xs = init xs
-- | Only update the file if contents has changed
updateFile path new =
do old <- tryIOE $ readFile path