forked from GitHub/gf-core
Remove code which tries to get version information from darcs folder
This commit is contained in:
30
Setup.hs
30
Setup.hs
@@ -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
|
||||
|
||||
5
gf.cabal
5
gf.cabal
@@ -39,10 +39,6 @@ data-files:
|
||||
www/translator/*.css
|
||||
www/translator/*.js
|
||||
|
||||
--source-repository head
|
||||
-- type: darcs
|
||||
-- location: http://www.grammaticalframework.org/
|
||||
|
||||
source-repository head
|
||||
type: git
|
||||
location: https://github.com/GrammaticalFramework/GF.git
|
||||
@@ -162,7 +158,6 @@ Library
|
||||
|
||||
GF.Data.Operations GF.Infra.Option GF.Infra.UseIO
|
||||
|
||||
DarcsVersion_gf
|
||||
GF.Command.Abstract
|
||||
GF.Command.CommandInfo
|
||||
GF.Command.Commands
|
||||
|
||||
@@ -2,11 +2,9 @@
|
||||
module GF.Infra.BuildInfo where
|
||||
import System.Info
|
||||
import Data.Version(showVersion)
|
||||
import DarcsVersion_gf
|
||||
|
||||
{-# NOINLINE buildInfo #-}
|
||||
buildInfo =
|
||||
{-details++"\n"++-}
|
||||
"Built on "++os++"/"++arch
|
||||
++" with "++compilerName++"-"++showVersion compilerVersion
|
||||
++", flags:"
|
||||
@@ -22,17 +20,3 @@ buildInfo =
|
||||
#ifdef C_RUNTIME
|
||||
++" c-runtime"
|
||||
#endif
|
||||
where
|
||||
details = either (const no_info) info darcs_info
|
||||
no_info = "No detailed version info available"
|
||||
info (otag,olast,changes,whatsnew) =
|
||||
(case changes of
|
||||
0 -> "No recorded changes"
|
||||
1 -> "One recorded change"
|
||||
_ -> show changes++" recorded changes")++
|
||||
(case whatsnew of
|
||||
0 -> ""
|
||||
1 -> " + one file with unrecorded changes"
|
||||
_ -> " + "++show whatsnew++" files with unrecorded changes")++
|
||||
(maybe "" (" since "++) otag)++
|
||||
(maybe "" ("\nLast recorded change: "++) olast)
|
||||
|
||||
Reference in New Issue
Block a user