add Build/BuildVersion, for use by autobuilders

This commit is contained in:
Joey Hess 2014-06-18 14:29:39 -04:00
parent af90a03178
commit a615817ab1
4 changed files with 11 additions and 5 deletions

6
Build/BuildVersion.hs Normal file
View file

@ -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

View file

@ -17,7 +17,7 @@ import qualified Git.Version
tests :: [TestCase] tests :: [TestCase]
tests = tests =
[ TestCase "version" getVersion [ TestCase "version" (Config "packageversion" . StringConfig <$> getVersion)
, TestCase "UPGRADE_LOCATION" getUpgradeLocation , TestCase "UPGRADE_LOCATION" getUpgradeLocation
, TestCase "git" $ requireCmd "git" "git --version >/dev/null" , TestCase "git" $ requireCmd "git" "git --version >/dev/null"
, TestCase "git version" getGitVersion , TestCase "git version" getGitVersion

View file

@ -25,10 +25,10 @@ isReleaseBuild = isJust <$> catchMaybeIO (getEnv "RELEASE_BUILD")
- -
- If git or a git repo is not available, or something goes wrong, - 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. -} - or this is a release build, just use the version from the changelog. -}
getVersion :: Test getVersion :: IO String
getVersion = do getVersion = do
changelogversion <- getChangelogVersion changelogversion <- getChangelogVersion
version <- ifM (isReleaseBuild) ifM (isReleaseBuild)
( return changelogversion ( return changelogversion
, catchDefaultIO changelogversion $ do , catchDefaultIO changelogversion $ do
let major = takeWhile (/= '.') changelogversion let major = takeWhile (/= '.') changelogversion
@ -40,7 +40,6 @@ getVersion = do
then return changelogversion then return changelogversion
else return $ concat [ major, ".", autoversion ] else return $ concat [ major, ".", autoversion ]
) )
return $ Config "packageversion" (StringConfig version)
getChangelogVersion :: IO String getChangelogVersion :: IO String
getChangelogVersion = do getChangelogVersion = do

View file

@ -83,7 +83,8 @@ clean:
rm -rf tmp dist git-annex $(mans) configure *.tix .hpc \ rm -rf tmp dist git-annex $(mans) configure *.tix .hpc \
doc/.ikiwiki html dist tags Build/SysConfig.hs build-stamp \ doc/.ikiwiki html dist tags Build/SysConfig.hs build-stamp \
Setup Build/InstallDesktopFile Build/EvilSplicer \ Setup Build/InstallDesktopFile Build/EvilSplicer \
Build/Standalone Build/OSXMkLibs Build/LinuxMkLibs Build/DistributionUpdate \ Build/Standalone Build/OSXMkLibs Build/LinuxMkLibs \
Build/DistributionUpdate Build/BuildVersion \
git-union-merge .tasty-rerun-log git-union-merge .tasty-rerun-log
find . -name \*.o -exec rm {} \; find . -name \*.o -exec rm {} \;
find . -name \*.hi -exec rm {} \; find . -name \*.hi -exec rm {} \;