-
Notifications
You must be signed in to change notification settings - Fork 697
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10541 from geekosaur/git-revs
record Git revision in devel builds
- Loading branch information
Showing
8 changed files
with
125 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,51 @@ | ||
{-# LANGUAGE CPP #-} | ||
#ifdef GIT_REV | ||
{-# LANGUAGE TemplateHaskell #-} | ||
#endif | ||
|
||
-- | Provides the version number of @cabal-install@. | ||
module Distribution.Client.Version | ||
( cabalInstallVersion | ||
, cabalInstallGitInfo | ||
) where | ||
|
||
import Distribution.Version | ||
|
||
import qualified Paths_cabal_install as PackageInfo | ||
|
||
#ifdef GIT_REV | ||
import Data.Either (isLeft) | ||
import GitHash | ||
( giHash | ||
, giBranch | ||
, giCommitDate | ||
, tGitInfoCwdTry | ||
) | ||
#endif | ||
|
||
-- | | ||
-- This value determines the output of `cabal-install --version`. | ||
cabalInstallVersion :: Version | ||
cabalInstallVersion = mkVersion' PackageInfo.version | ||
|
||
-- | | ||
-- `cabal-install` Git information. Only filled in if built in a Git tree in | ||
-- developmnent mode and Template Haskell is available. | ||
cabalInstallGitInfo :: String | ||
#ifdef GIT_REV | ||
cabalInstallGitInfo = concat [ "(commit " | ||
, giHash' | ||
, branchInfo | ||
, ", " | ||
, either (const "") giCommitDate gi' | ||
, ")" | ||
] | ||
where | ||
gi' = $$tGitInfoCwdTry | ||
giHash' = take 7 . either (const "") giHash $ gi' | ||
branchInfo | isLeft gi' = "" | ||
| either id giBranch gi' == "master" = "" | ||
| otherwise = " on " <> either id giBranch gi' | ||
#else | ||
cabalInstallGitInfo = "" | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters