@@ -16,6 +16,7 @@ import Text.Regex.TDFA
16
16
import Data.Array ((!) )
17
17
18
18
import qualified Data.Foldable as F
19
+ import System.FilePath (dropExtension )
19
20
20
21
normalizeOutput :: NormalizerEnv -> String -> String
21
22
normalizeOutput nenv =
@@ -50,6 +51,7 @@ normalizeOutput nenv =
50
51
-- Normalize architecture
51
52
. resub (posixRegexEscape (display (normalizerPlatform nenv))) " <ARCH>"
52
53
. normalizeBuildInfoJson
54
+ . normalizePathCmdOutput
53
55
-- Some GHC versions are chattier than others
54
56
. resub " ^ignoring \\ (possibly broken\\ ) abi-depends field for packages" " "
55
57
-- Normalize the current GHC version. Apply this BEFORE packageIdRegex,
@@ -70,12 +72,19 @@ normalizeOutput nenv =
70
72
resub (posixRegexEscape (display pid) ++ " (-[A-Za-z0-9.-]+)?" )
71
73
(prettyShow (packageName pid) ++ " -<VERSION>" )
72
74
75
+ normalizePathCmdOutput =
76
+ -- clear the ghc path out of all supported output formats
77
+ resub (" compiler-path: " <> posixRegexEscape (dropExtension (normalizerGhcPath nenv)))
78
+ " compiler-path: <GHCPATH>"
79
+ . resub (" \" compiler-path\"\\ s*:\\ s*\" " <> posixRegexEscape (normalizerGhcPath nenv) <> " \" " )
80
+ " \" compiler-path\" : \" <GHCPATH>\" "
81
+
73
82
-- 'build-info.json' contains a plethora of host system specific information.
74
83
--
75
84
-- This must happen before the root-dir normalisation.
76
85
normalizeBuildInfoJson =
77
86
-- Remove ghc path from show-build-info output
78
- resub (" \" path\" :\" [^ \" ]* \" }" )
87
+ resub (" \" path\" :\" " <> posixRegexEscape (normalizerGhcPath nenv) <> " \" }" )
79
88
" \" path\" :\" <GHCPATH>\" }"
80
89
-- Remove cabal version output from show-build-info output
81
90
. resub (" {\" cabal-version\" :\" " ++ posixRegexEscape (display (normalizerCabalVersion nenv)) ++ " \" " )
@@ -104,6 +113,7 @@ data NormalizerEnv = NormalizerEnv
104
113
-- `/var` is a symlink for `/private/var`.
105
114
, normalizerGblTmpDir :: FilePath
106
115
, normalizerGhcVersion :: Version
116
+ , normalizerGhcPath :: FilePath
107
117
, normalizerKnownPackages :: [PackageId ]
108
118
, normalizerPlatform :: Platform
109
119
, normalizerCabalVersion :: Version
0 commit comments