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.
This commit is contained in:
Joey Hess 2018-06-26 10:11:28 -04:00
parent 87b329e451
commit 7ecbb6bc20
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 11 additions and 9 deletions

1
.gitignore vendored
View file

@ -5,7 +5,6 @@ Setup
tmp
test
Build/SysConfig
Build/SysConfig.hs
Build/InstallDesktopFile
Build/EvilSplicer
Build/Standalone

View file

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