From b1760c28680385280912644bf607575683d4b361 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 18 Jun 2014 14:29:39 -0400 Subject: add Build/BuildVersion, for use by autobuilders --- Build/BuildVersion.hs | 6 ++++++ Build/Configure.hs | 2 +- Build/Version.hs | 5 ++--- 3 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 Build/BuildVersion.hs (limited to 'Build') diff --git a/Build/BuildVersion.hs b/Build/BuildVersion.hs new file mode 100644 index 000000000..0093f5b5b --- /dev/null +++ b/Build/BuildVersion.hs @@ -0,0 +1,6 @@ +{- Outputs the version of git-annex that was built, for use by + - autobuilders. Note that this includes the git rev. -} + +import Build.Version + +main = putStr =<< getVersion diff --git a/Build/Configure.hs b/Build/Configure.hs index 116a44215..70cce74a5 100644 --- a/Build/Configure.hs +++ b/Build/Configure.hs @@ -17,7 +17,7 @@ import qualified Git.Version tests :: [TestCase] tests = - [ TestCase "version" getVersion + [ TestCase "version" (Config "packageversion" . StringConfig <$> getVersion) , TestCase "UPGRADE_LOCATION" getUpgradeLocation , TestCase "git" $ requireCmd "git" "git --version >/dev/null" , TestCase "git version" getGitVersion diff --git a/Build/Version.hs b/Build/Version.hs index 7ff2fe662..0bcb4a520 100644 --- a/Build/Version.hs +++ b/Build/Version.hs @@ -25,10 +25,10 @@ isReleaseBuild = isJust <$> catchMaybeIO (getEnv "RELEASE_BUILD") - - If git or a git repo is not available, or something goes wrong, - or this is a release build, just use the version from the changelog. -} -getVersion :: Test +getVersion :: IO String getVersion = do changelogversion <- getChangelogVersion - version <- ifM (isReleaseBuild) + ifM (isReleaseBuild) ( return changelogversion , catchDefaultIO changelogversion $ do let major = takeWhile (/= '.') changelogversion @@ -40,7 +40,6 @@ getVersion = do then return changelogversion else return $ concat [ major, ".", autoversion ] ) - return $ Config "packageversion" (StringConfig version) getChangelogVersion :: IO String getChangelogVersion = do -- cgit v1.2.3