|
33 | 33 | module Distribution.Simple.Utils |
34 | 34 | ( cabalVersion |
35 | 35 | , cabalGitInfo |
| 36 | + , cabalCompilerInfo |
36 | 37 |
|
37 | 38 | -- * logging and errors |
38 | 39 | , dieNoVerbosity |
@@ -213,6 +214,7 @@ import Distribution.Compat.Internal.TempFile |
213 | 214 | import Distribution.Compat.Lens (Lens', over) |
214 | 215 | import Distribution.Compat.Prelude |
215 | 216 | import Distribution.Compat.Stack |
| 217 | +import Distribution.Compat.SysInfo as SIC |
216 | 218 | import Distribution.ModuleName as ModuleName |
217 | 219 | import Distribution.Simple.Errors |
218 | 220 | import Distribution.Simple.PreProcess.Types |
@@ -244,6 +246,7 @@ import Data.Typeable |
244 | 246 |
|
245 | 247 | import qualified Control.Exception as Exception |
246 | 248 | import Data.Time.Clock.POSIX (POSIXTime, getPOSIXTime) |
| 249 | +import qualified Data.Version as DV |
247 | 250 | import Distribution.Compat.Process (proc) |
248 | 251 | import Foreign.C.Error (Errno (..), ePIPE) |
249 | 252 | import qualified GHC.IO.Exception as GHC |
@@ -294,6 +297,7 @@ import System.IO.Error |
294 | 297 | import System.IO.Unsafe |
295 | 298 | ( unsafeInterleaveIO |
296 | 299 | ) |
| 300 | +import qualified System.Info as SI |
297 | 301 | import qualified System.Process as Process |
298 | 302 | import qualified Text.PrettyPrint as Disp |
299 | 303 |
|
@@ -331,20 +335,35 @@ cabalGitInfo = if giHash' == "" |
331 | 335 | else concat [ "(commit " |
332 | 336 | , giHash' |
333 | 337 | , branchInfo |
334 | | - , ", " |
335 | | - , either (const "") giCommitDate gi' |
| 338 | + , either (const "") ((", " ++) . giCommitDate) gi' |
336 | 339 | , ")" |
337 | 340 | ] |
338 | 341 | where |
339 | 342 | gi' = $$tGitInfoCwdTry |
340 | 343 | giHash' = take 7 . either (const "") giHash $ gi' |
| 344 | + branch = either id giBranch gi' |
341 | 345 | branchInfo | isLeft gi' = "" |
342 | | - | either id giBranch gi' == "master" = "" |
343 | | - | otherwise = " on " <> either id giBranch gi' |
| 346 | + | branch == "master" = "" |
| 347 | + | otherwise = " on " <> branch |
344 | 348 | #else |
345 | 349 | cabalGitInfo = "" |
346 | 350 | #endif |
347 | 351 |
|
| 352 | +-- | |
| 353 | +-- `Cabal` compiler information, reported by `--version-full` but otherwise |
| 354 | +-- unused. |
| 355 | +cabalCompilerInfo :: String |
| 356 | +cabalCompilerInfo = |
| 357 | + concat |
| 358 | + [ SI.compilerName |
| 359 | + , " " |
| 360 | + , intercalate "." (map show (DV.versionBranch SIC.fullCompilerVersion)) |
| 361 | + , " on " |
| 362 | + , SI.os |
| 363 | + , " " |
| 364 | + , SI.arch |
| 365 | + ] |
| 366 | + |
348 | 367 | -- ---------------------------------------------------------------------------- |
349 | 368 | -- Exception and logging utils |
350 | 369 |
|
|
0 commit comments