Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Setup.hs configure more CWD-independent. #5397

Merged

Conversation

quasicomputational
Copy link
Contributor

Previously, we were checking the package with a hard-coded root
directory of ".". This was not a problem before, but with #5372 we
have started to expand globs while checking packages, which breaks if
the CWD is not the directory containing the .cabal file and causes
snowleopard/hadrian#634.

Luckily, this is an easy fix: the correct directory is easy to
determine. Writing a test and making sure it's tickling the failing
case took longer than writing the fix!

"." is hard-coded as the root directory passed to checkPackageFiles
in a few other places, but those are (a) non-trivial to test, and (b)
already in places that have other assumptions about their CWD, so I
have simply documented the CWD requirement for those.

Please include the following checklist in your PR:

  • Patches conform to the coding conventions.
  • Any changes that could be relevant to users have been recorded in the changelog.
  • The documentation has been updated, if necessary.
  • If the change is docs-only, [ci skip] is used to avoid triggering the build bots.

Please also shortly describe how you tested your change. Bonus points for added tests!

New test added, made sure it tickled the bad case and now it passes. Currently building GHC with Hadrian to verify the failure; will ensure this patch fixes it.

@angerman
Copy link
Collaborator

Just for reference, we have merged #4857, #4859, #4874, #4875, #4885, #4891, which were all intended to reduce the global CWD in cabal, and essential to allowing hadrian to run cabal functions in parallel without stepping onto each others toes due to the global CWD.

The overall idea was to be able to represent all packages that constitute ghc in cabal*, and try to make out-of-tree builds possible, so that multiple configurations can be built from the same source tree at the same time; and allow to build relocatable ghcs (without the need for wrapper scripts) with hadrian for windows, linux and macOS.

Previously, we were checking the package with a hard-coded root
directory of ".". This was not a problem before, but with haskell#5372 we
have started to expand globs while checking packages, which breaks if
the CWD is not the directory containing the `.cabal` file and causes
snowleopard/hadrian#634.

Luckily, this is an easy fix: the correct directory is easy to
determine. Writing a test and making sure it's tickling the failing
case took longer than writing the fix!

"." is hard-coded as the root directory passed to `checkPackageFiles`
in a few other places, but those are (a) non-trivial to test, and (b)
already in places that have other assumptions about their CWD, so I
have simply documented the CWD requirement for those.
@quasicomputational
Copy link
Contributor Author

I managed to build a stage-1 GHC with Hadrian with this patch, and @alpmestan got through a whole build with it; I've squashed it down for neatness and it's ready for review.

@quasicomputational
Copy link
Contributor Author

The failing AppVeyor test is that annoying flaky one. If you grep for 'Hadrian' in the log, you'll see that the added test is passing. Travis's 7.10 builders failed because 7.10 is fussy about some unused imports; that was from master, not related to this PR.

@quasicomputational
Copy link
Contributor Author

OK, this has been up for a little while and it is quite a simple fix; the test failures aren't relevant. The Hadrian people have been using this PR in their CI set-up and they haven't reported any breakage. Since it has been causing some pain for Hadrian I am going to go ahead and merge.

@quasicomputational quasicomputational merged commit a31ab06 into haskell:master Jul 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants