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

Fix handling of default setup deps #3437

Merged
merged 2 commits into from
May 27, 2016
Merged

Conversation

dcoutts
Copy link
Contributor

@dcoutts dcoutts commented May 16, 2016

Commit 2f97657 added default setup dep handling to the existing install command code paths, but unfortunately broke the handling for the new-build code path. It added a call to addDefaultSetupDependencies into the standardInstallPolicy. That interfered with the addDefaultSetupDependencies that ProjectPlanning was already using.

So this patch splits a basicInstallPolicy out of standardInstallPolicy, where the basicInstallPolicy is all the old stuff, and the standardInstallPolicy just adds the addDefaultSetupDependencies that the install/fetch/freeze commands need. So then ProjectPlanning uses just the basicInstallPolicy.

The 2f97657 commit also added a new and simpler method to determine if a package has had default setup deps added. Previously ProjectPlanning had to use a rather complex method to remember this information. So this patch removes all that and makes use of the new method.

To stop this breaking in future we also add integration tests for setup script handling, covering 3 of the 4 possible cases:

  1. explicit custom setup deps
  2. custom setup with implicit/default deps
  3. non-custom setup using the internal cabal lib version

case 4 is a non-custom setup but where we're forced to use an external cabal lib version. This case is hard to test since it only happens when it's a newer (not older) Cabal lib version that the package requires, e.g. a .cabal file that specifies cabal-version: >= 2.0.

This should fix issue #3394.

Commit 2f97657 added default setup dep
handling to the existing install command code paths, but unfortunately
broke the handling for the new-build code path. It added a call to
addDefaultSetupDependencies into the standardInstallPolicy. That
interfered with the addDefaultSetupDependencies that ProjectPlanning was
already using.

So this patch splits a basicInstallPolicy out of standardInstallPolicy,
where the basicInstallPolicy is all the old stuff, and the
standardInstallPolicy just adds the addDefaultSetupDependencies that the
install/fetch/freeze commands need. So then ProjectPlanning uses just
the basicInstallPolicy.

The 2f97657 commit also added a new and simpler method to determine if a
package has had default setup deps added. Previously ProjectPlanning had
to use a rather complex method to remember this information. So this
patch removes all that and makes use of the new method.

To stop this breaking in future the next patch adds integration tests to
cover custom setup script handling.

This fixed issue haskell#3394.
@23Skidoo
Copy link
Member

Seems to fail on Travis.

@23Skidoo
Copy link
Member

Hmm, I don't see where you are adding default setup deps in new-build.

@dcoutts
Copy link
Contributor Author

dcoutts commented May 17, 2016

@23Skidoo yes, failing in two different ways on old vs new ghc, and only working on the version I was testing with myself :-). Will investigate and fix.

As for where we set the default setup deps, it's here. (This bit is unchanged from master)

@23Skidoo
Copy link
Member

As for where we set the default setup deps, it's here. (This bit is unchanged from master)

Ah, thanks, I see now. Looks good.

@dcoutts
Copy link
Contributor Author

dcoutts commented May 25, 2016

I've not yet been able to reproduce the test failure for ghc 7.10.

@dcoutts
Copy link
Contributor Author

dcoutts commented May 27, 2016

@23Skidoo so this appears to work now. I've just squashed some things, and turned the verbosity back down. So assuming it's green we should be good to merge.

Covers 3 of the 4 possible cases:
1. explicit custom setup deps
2. custom setup with implicit/default deps
4. non-custom setup using the internal cabal lib version

case 3 is a non-custom setup but where we're forced to use an external
cabal lib version. This case is hard to test since it only happens when
it's a newer (not older) Cabal lib version that the package requires,
e.g. a .cabal file that specifies cabal-version: >= 2.0.

Also, add a --with-ghc option to the integration test suite, which lets us
more easily test with different ghc versions.

Also, don't use parallel builds in any of the integration tests, as the
self-exec method will not work, and some tests need to install deps for
some ghc versions.
@23Skidoo
Copy link
Member

Merged, thanks!

@23Skidoo 23Skidoo added this to the cabal-install 1.26 milestone May 27, 2016
@ezyang ezyang modified the milestones: cabal-install 2.0, 2.0 (planned for next feature release) Sep 6, 2016
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.

3 participants