Repository navigation
Description
I tried to run the tests that depend on hackage-repo-tool on AppVeyor, but I ran into several issues:
-
cabal-tests uses tar to create the repository, but tar misinterprets the colon in the drive letter, as in https://stackoverflow.com/questions/12823499/windows-command-line-tar-cannot-connect-to-d-resolve-failed-with-chef-knife/37996249. I was able to fix this issue by adding
--force-localto the arguments in
cabal/cabal-testsuite/Test/Cabal/Prelude.hs
Line 480 in 59bb50b
tar ["-czf", dst, "-C", src_parent, src_dir] -
cabal-testsuite tests can access the Hackage package index on Windows #5187 prevents the tests from reading the repository settings from the test config file. Setting CABAL_CONFIG for each test seemed to work.
-
The repository
urlfield in the config file generated by cabal-tests cannot be parsed as a URI. cabal-tests generates the config file here:
cabal/cabal-testsuite/Test/Cabal/Prelude.hs
Line 515 in 59bb50b
, " url: file:" ++ testRepoDir env
That produces a string with backslashes, such asfile:C:\projects\cabal\cabal-testsuite\PackageTests\NewBuild\CustomSetup\LocalPackageWithCustomSetup\build-local-package-with-custom-setup.dist\repo. cabal parses the field as a URI incabal/cabal-install/Distribution/Client/Config.hs
Lines 1114 to 1117 in 59bb50b
remoteRepoFields = [ simpleField "url" (text . show) (parseTokenQ >>= parseURI') remoteRepoURI (\x repo -> repo { remoteRepoURI = x }) -
cabal treats the file URI path as a file path when initializing the repository with hackage-security:
cabal/cabal-install/Distribution/Client/GlobalFlags.hs
Lines 248 to 249 in 59bb50b
withRepo _ callback | uriScheme remoteRepoURI == "file:" = do dir <- Sec.makeAbsolute $ Sec.fromFilePath (uriPath remoteRepoURI)
fromFilePathseems to expect a platform-specific path:
https://github.com/haskell/hackage-security/blob/21519f4f572b9547485285ebe44c152e1230fd76/hackage-security/src/Hackage/Security/Util/Path.hs#L277-L281
It converts the String to aFsPath, which contains aPath, which stores the path as a Posix-style path string: https://github.com/haskell/hackage-security/blob/21519f4f572b9547485285ebe44c152e1230fd76/hackage-security/src/Hackage/Security/Util/Path.hs#L121Later, hackage-security fails to find root.json, because it calls toAbsoluteFilePath on the invalid path:
https://github.com/haskell/hackage-security/blob/21519f4f572b9547485285ebe44c152e1230fd76/hackage-security/src/Hackage/Security/Util/Path.hs#L322-L325 . toAbsoluteFilePath tries to convert theAbsolutepath back to the platform-specific format:
https://github.com/haskell/hackage-security/blob/21519f4f572b9547485285ebe44c152e1230fd76/hackage-security/src/Hackage/Security/Util/Path.hs#L257-L258
After I worked around (3), I saw that cabal/hackage-security converted the path of typePath Absolute,C:/projects/cabal/cabal-testsuite/PackageTests/NewBuild/CustomSetup/LocalPackageWithCustomSetup/build-local-package-with-custom-setup.dist/repo/root.json, toC:projects\cabal\cabal-testsuite\PackageTests\NewBuild\CustomSetup\LocalPackageWithCustomSetup\build-local-package-with-custom-setup.dist\repo\root.json. The result is invalid because it is missing a backslash after the drive letter. -
After I worked around the previous issues, I saw new warnings about mirrors in the output, though I didn't look into them further.
# cabal update +Warning: Caught exception during _mirrors lookup:user error (DnsQuery_A failed with 9003) +Warning: No mirrors found for file:///C:/projects/cabal/cabal-testsuite/PackageTests/NewBuild/CustomSetup/LocalPackageWithCustomSetup/build-local-package-with-custom-setup.dist/repo Downloading the latest package list from test-local-repo
EDIT: I think (5) was only caused by the changes I made to work around the other issues.
Activity
sebright commentedon Mar 12, 2018
I was able to run most of the hackage-repo-tool tests on AppVeyor with this commit: sebright@d547107 I temporarily worked around the repo path issues by using a relative path, though I think that caused three of the new-freeze tests to fail.
Log: https://ci.appveyor.com/project/grayjay/cabal/build/1.0.507
There was one other test failure, PackageTests/NewBuild/CustomSetup/RemotePackageWithCustomSetup/build-package-from-repo-with-custom-setup.test.hs: https://ci.appveyor.com/project/grayjay/cabal/build/1.0.507#L1450
Use hackage-repo-tool when running cabal-testsuite on AppVeyor (closes …
Use hackage-repo-tool when running cabal-testsuite on AppVeyor (closes …
Use hackage-repo-tool when running cabal-testsuite on AppVeyor (closes …
Use hackage-repo-tool when running cabal-testsuite on AppVeyor (closes …
Use hackage-repo-tool when running cabal-testsuite on AppVeyor (closes …
Use hackage-repo-tool when running cabal-testsuite on AppVeyor (closes …
Use hackage-repo-tool when running cabal-testsuite on AppVeyor (closes …
Use hackage-repo-tool when running cabal-testsuite on AppVeyor (closes …