From 7ecbb6bc20fa9dcc88fe652ca771b11373e21de7 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 26 Jun 2018 10:11:28 -0400 Subject: [PATCH] stop using git commit date as version This turns out to have been prolimatic because building from a git tag would make a git-annex that claimed a different version than the tag's version. The git rev is still included in the version, and people who want to know the exact tree that was built can just use that, so there's no real benefit to automatically advancing the date part of the version. --- .gitignore | 1 - Build/Version.hs | 19 +++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 03cb059e6a..f841f39e6e 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,6 @@ Setup tmp test Build/SysConfig -Build/SysConfig.hs Build/InstallDesktopFile Build/EvilSplicer Build/Standalone diff --git a/Build/Version.hs b/Build/Version.hs index 57364948a2..1d827ff685 100644 --- a/Build/Version.hs +++ b/Build/Version.hs @@ -22,12 +22,11 @@ type Version = String isReleaseBuild :: IO Bool isReleaseBuild = (== Just "1") <$> catchMaybeIO (getEnv "RELEASE_BUILD") -{- Version is usually based on the major version from the changelog, - - plus the date of the last commit, plus the git rev of that commit. +{- Version comes from the CHANGELOG, plus the git rev of the last commit. - This works for autobuilds, ad-hoc builds, etc. - - 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 :: IO Version getVersion = do changelogversion <- getChangelogVersion @@ -35,13 +34,17 @@ getVersion = do ( return changelogversion , catchDefaultIO changelogversion $ do let major = takeWhile (/= '.') changelogversion - autoversion <- takeWhile (\c -> isAlphaNum c || c == '-') <$> readProcess "sh" + gitversion <- takeWhile (\c -> isAlphaNum c) <$> readProcess "sh" [ "-c" - , "git log -n 1 --format=format:'%ci %h'| sed -e 's/-//g' -e 's/ .* /-g/'" + , "git log -n 1 --format=format:'%h'" ] "" - if null autoversion - then return changelogversion - else return $ concat [ major, ".", autoversion ] + return $ if null gitversion + then changelogversion + else concat + [ changelogversion + , "-g" + , gitversion + ] ) getChangelogVersion :: IO Version