File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -130,6 +130,7 @@ library
130130 Distribution.Client.Compat.Orphans
131131 Distribution.Client.Compat.Prelude
132132 Distribution.Client.Compat.Semaphore
133+ Distribution.Client.Compat.SysInfo
133134 Distribution.Client.Compat.Tar
134135 Distribution.Client.Config
135136 Distribution.Client.Configure
Original file line number Diff line number Diff line change 1+ {-# LANGUAGE CPP #-}
2+
3+ module Distribution.Client.Compat.SysInfo
4+ ( fullCompilerVersion
5+ ) where
6+
7+ import Data.Version (Version )
8+ import qualified System.Info as SI
9+
10+ fullCompilerVersion :: Version
11+ #if MIN_VERSION_base(4,15,0)
12+ fullCompilerVersion = SI. fullCompilerVersion
13+ #else
14+ fullCompilerVersion = SI. compilerVersion
15+ #endif
Original file line number Diff line number Diff line change @@ -358,6 +358,7 @@ instance Semigroup SavedConfig where
358358 combinedSavedGlobalFlags =
359359 GlobalFlags
360360 { globalVersion = combine globalVersion
361+ , globalFullVersion = combine globalFullVersion
361362 , globalNumericVersion = combine globalNumericVersion
362363 , globalConfigFile = combine globalConfigFile
363364 , globalConstraintsFile = combine globalConstraintsFile
Original file line number Diff line number Diff line change @@ -81,6 +81,7 @@ import qualified Hackage.Security.Util.Pretty as Sec
8181-- | Flags that apply at the top level, not to any sub-command.
8282data GlobalFlags = GlobalFlags
8383 { globalVersion :: Flag Bool
84+ , globalFullVersion :: Flag Bool
8485 , globalNumericVersion :: Flag Bool
8586 , globalConfigFile :: Flag FilePath
8687 , globalConstraintsFile :: Flag FilePath
@@ -103,6 +104,7 @@ defaultGlobalFlags :: GlobalFlags
103104defaultGlobalFlags =
104105 GlobalFlags
105106 { globalVersion = Flag False
107+ , globalFullVersion = Flag False
106108 , globalNumericVersion = Flag False
107109 , globalConfigFile = mempty
108110 , globalConstraintsFile = mempty
Original file line number Diff line number Diff line change @@ -170,7 +170,8 @@ import Distribution.Client.Utils
170170 , relaxEncodingErrors
171171 )
172172import Distribution.Client.Version
173- ( cabalInstallGitInfo
173+ ( cabalInstallCompilerInfo
174+ , cabalInstallGitInfo
174175 , cabalInstallVersion
175176 )
176177
@@ -346,6 +347,8 @@ mainWorker args = do
346347 _
347348 | fromFlagOrDefault False (globalVersion globalFlags) ->
348349 printVersion
350+ | fromFlagOrDefault False (globalFullVersion globalFlags) ->
351+ printFullVersion
349352 | fromFlagOrDefault False (globalNumericVersion globalFlags) ->
350353 printNumericVersion
351354 CommandHelp help -> printCommandHelp help
@@ -415,6 +418,13 @@ mainWorker args = do
415418 printErrors errs = dieNoVerbosity $ intercalate " \n " errs
416419 printNumericVersion = putStrLn $ display cabalInstallVersion
417420 printVersion =
421+ putStrLn $
422+ " cabal-install version "
423+ ++ display cabalInstallVersion
424+ ++ " \n compiled using version "
425+ ++ display cabalVersion
426+ ++ " of the Cabal library "
427+ printFullVersion =
418428 putStrLn $
419429 " cabal-install version "
420430 ++ display cabalInstallVersion
@@ -423,6 +433,8 @@ mainWorker args = do
423433 ++ display cabalVersion
424434 ++ " of the Cabal library "
425435 ++ cabalGitInfo'
436+ ++ " \n with "
437+ ++ cabalInstallCompilerInfo
426438 where
427439 cabalInstallGitInfo'
428440 | null cabalInstallGitInfo = " "
Original file line number Diff line number Diff line change @@ -984,6 +984,7 @@ convertToLegacySharedConfig
984984 globalFlags =
985985 GlobalFlags
986986 { globalVersion = mempty
987+ , globalFullVersion = mempty
987988 , globalNumericVersion = mempty
988989 , globalConfigFile = projectConfigConfigFile
989990 , globalConstraintsFile = mempty
Original file line number Diff line number Diff line change @@ -487,6 +487,13 @@ globalCommand commands =
487487 globalVersion
488488 (\ v flags -> flags{globalVersion = v})
489489 trueArg
490+ , option
491+ []
492+ [" version-full" ]
493+ " Print full version information with git revision (if available) and compiler"
494+ globalFullVersion
495+ (\ v flags -> flags{globalFullVersion = v})
496+ trueArg
490497 , option
491498 []
492499 [" numeric-version" ]
Original file line number Diff line number Diff line change 77module Distribution.Client.Version
88 ( cabalInstallVersion
99 , cabalInstallGitInfo
10+ , cabalInstallCompilerInfo
1011 ) where
1112
13+ import Data.List (intercalate )
14+ import qualified Data.Version as DV
15+ import qualified Distribution.Client.Compat.SysInfo as SIC
1216import Distribution.Version
17+ import qualified System.Info as SI
1318
1419import qualified Paths_cabal_install as PackageInfo
1520
@@ -28,6 +33,20 @@ import GitHash
2833cabalInstallVersion :: Version
2934cabalInstallVersion = mkVersion' PackageInfo. version
3035
36+ -- |
37+ -- `cabal-install` compiler information.
38+ cabalInstallCompilerInfo :: String
39+ cabalInstallCompilerInfo =
40+ concat
41+ [ SI. compilerName
42+ , " "
43+ , intercalate " ." (map show (DV. versionBranch SIC. fullCompilerVersion))
44+ , " on "
45+ , SI. os
46+ , " "
47+ , SI. arch
48+ ]
49+
3150-- |
3251-- `cabal-install` Git information. Only filled in if built in a Git tree in
3352-- development mode and Template Haskell is available.
You can’t perform that action at this time.
0 commit comments