Skip to content

Hooks: use the appropriate Cabal unit ID#11429

Open
sheaf wants to merge 1 commit intohaskell:masterfrom
sheaf:T11331
Open

Hooks: use the appropriate Cabal unit ID#11429
sheaf wants to merge 1 commit intohaskell:masterfrom
sheaf:T11331

Conversation

@sheaf
Copy link
Collaborator

@sheaf sheaf commented Jan 16, 2026

This commit updates the logic in Distribution.Client.Dependency.addDefaultSetupDependencies to add an implicit Cabal dependency for the custom setup stanza of packages with build-type: Hooks.

This ensures we always pick a version of Cabal that is compatible with whatever other libraries the custom-setup stanza depends on (such as Cabal-hooks).


Template Α: This PR modifies behaviour or interface

Include the following checklist in your PR:

@sheaf
Copy link
Collaborator Author

sheaf commented Jan 29, 2026

TODO:

  • Add Cabal dependency earlier instead of in SetupWrapper, so that it participates in solving. This handles e.g. the setup stanza only depending on some other package like a Cabal-hooks-API package that re-exports Cabal-hooks
  • Testing: use a local noindex repo with two fake Cabal packages, one which is poisoned in some way (e.g. empty) and one which is sufficient to validate we are picking the right Cabal.

@sheaf sheaf force-pushed the T11331 branch 3 times, most recently from 45b37b8 to 9741319 Compare January 30, 2026 14:40
@sheaf sheaf marked this pull request as ready for review January 30, 2026 17:54
@sheaf
Copy link
Collaborator Author

sheaf commented Jan 30, 2026

This is now ready for review. The fix is quite simple, but it was quite tricky to write a test case for it! The test works by carefully crafting a package database containing a poisoned version of Cabal that we must not pick. See the T11331 test case.

Copy link
Collaborator

@geekosaur geekosaur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm only requesting a comment, so it's otherwise good to go.

This commit updates the logic in Distribution.Client.Dependency,
namely addDefaultSetupDependencies, to add an implicit Cabal dependency
for the custom setup stanza of packages with build-type: Hooks.

This ensures we always pick a version of Cabal that is compatible with
whatever other libraries the custom-setup stanza depends on (such as
Cabal-hooks).

Test in T11331.

Fixes haskell#11331
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants