Skip to content

Commit

Permalink
Work around issue haskell#5218 in cabal-testsuite.
Browse files Browse the repository at this point in the history
This commit uses a relative path to specify the test remote repository on
Windows, to avoid the path conversion issue described in haskell#5218.
  • Loading branch information
grayjay committed Mar 31, 2018
1 parent 256911c commit 37902f0
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cabal-testsuite/Test/Cabal/Prelude.hs
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ withRepo repo_dir m = do
let package_cache = testCabalDir env </> "packages"
liftIO $ appendFile (testUserCabalConfigFile env)
$ unlines [ "repository test-local-repo"
, " url: file:" ++ testRepoDir env
, " url: " ++ repoUri env
, " secure: True"
-- TODO: Hypothetically, we could stick in the
-- correct key here
Expand All @@ -531,6 +531,18 @@ withRepo repo_dir m = do
-- 8. Profit
withReaderT (\env' -> env' { testHaveRepo = True }) m
-- TODO: Arguably should undo everything when we're done...
where
-- Work around issue #5218 (incorrect conversions between Windows paths and
-- file URIs) by using a relative path on Windows.
repoUri env =
if buildOS == Windows
then let relPath = definitelyMakeRelative (testCurrentDir env)
(testRepoDir env)
convertSeparators = intercalate "/"
. map dropTrailingPathSeparator
. splitPath
in "file:" ++ convertSeparators relPath
else "file:" ++ testRepoDir env

------------------------------------------------------------------------
-- * Subprocess run results
Expand Down

0 comments on commit 37902f0

Please sign in to comment.