@@ -46,25 +46,7 @@ normalizeOutput nenv =
4646 . resub (posixRegexEscape " tmp/src-" ++ " [0-9]+" ) " <TMPDIR>"
4747 . resub (posixRegexEscape (normalizerTmpDir nenv) ++ sameDir) " <ROOT>/"
4848 . resub (posixRegexEscape (normalizerCanonicalTmpDir nenv) ++ sameDir) " <ROOT>/"
49- . (if buildOS == Windows
50- then
51- -- OK. Here's the deal. In `./Prelude.hs`, `withRepoNoUpdate` sets
52- -- `repoUri` to the tmpdir but with backslashes replaced with
53- -- slashes. This is because Windows treats backslashes and forward
54- -- slashes largely the same in paths, and backslashes aren't allowed
55- -- in a URL like `file+noindex://...`.
56- --
57- -- But that breaks the regexes above, which expect the paths to have
58- -- backslashes.
59- --
60- -- Honestly this whole `normalizeOutput` thing is super janky and
61- -- worth rewriting from the ground up. To you, poor soul in the
62- -- future, here is one more hack upon a great pile. Hey, at least all
63- -- the `PackageTests` function as a test suite for this thing...
64- resub (posixRegexEscape (backslashToSlash $ normalizerTmpDir nenv) ++ sameDir) " <ROOT>/"
65- . resub (posixRegexEscape (backslashToSlash $ normalizerCanonicalTmpDir nenv) ++ sameDir) " <ROOT>/"
66- else id )
67- -- Munge away C: prefix on filenames (Windows). We convert C:\\ to \\.
49+ -- Munge away C:\ prefix on filenames (Windows). We convert C:\ to \.
6850 . (if buildOS == Windows then resub " ([A-Z]):\\\\ " " \\\\ " else id )
6951 . appEndo (F. fold (map (Endo . packageIdRegex) (normalizerKnownPackages nenv)))
7052 -- Look for 0.1/installed-0d6uzW7Ubh1Fb4TB5oeQ3G
@@ -96,6 +78,14 @@ normalizeOutput nenv =
9678 else id )
9779 . normalizeBuildInfoJson
9880 . maybe id normalizePathCmdOutput (normalizerCabalInstallVersion nenv)
81+ -- Munge away \\.\C:/ prefix on paths (Windows). We convert @\\.\C:/@ to
82+ -- @\@. We need to do this before the step above as that one would convert
83+ -- @\\.\@ to @\.\@.
84+ --
85+ -- These paths might come up in file+noindex URIs due to @filepath@
86+ -- normalizing @//./C:/foo.txt@ paths to @\\.\C:/foo.txt@, see
87+ -- (filepath#247).
88+ . (if buildOS == Windows then resub " \\\\\\\\\\ .\\\\ ([A-Z]):/" " \\\\ " else id )
9989 -- hackage-security locks occur non-deterministically
10090 . resub " (Released|Acquired|Waiting) .*hackage-security-lock\n " " "
10191 . resub " installed: [0-9]+(\\ .[0-9]+)*" " installed: <VERSION>"
0 commit comments