-
Notifications
You must be signed in to change notification settings - Fork 696
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
Backtrack when no pkgconfigdb is present #7621
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another one-liner that solves world peace? Sounds legit. :D
But seriously, this could work. Any chance for a test and changelog?
Changelog, sure. I'm not quite sure how one might add a test for something like this, since it explicitly involves pkg-config not being on the path, etc. Advice in that direction is appreciated. |
You could add unit tests for solving without pkg-config, similar to the existing pkg-config tests: cabal/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs Lines 255 to 260 in 55c426f
It looks like all of the tests create a pkg-config DB by calling pkgConfigDbFromList , so you would need to add an option for no DB: cabal/cabal-install/tests/UnitTests/Distribution/Solver/Modular/DSL/TestCaseUtils.hs Line 222 in 55c426f
|
Thanks! I implemented tests as suggested |
@@ -253,10 +253,11 @@ tests = [ | |||
, runTest $ mkTest dbBuildable2 "choose version that sets buildable to false" ["A"] (solverSuccess [("A", 1), ("B", 2)]) | |||
] | |||
, testGroup "Pkg-config dependencies" [ | |||
runTest $ mkTestPCDepends [] dbPC1 "noPkgs" ["A"] anySolverFailure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be useful to also keep the empty pkg-config test case, using Just []
.
👀 |
Potentially resolves #7448
This is a one lexeme change that I would argue "fixes"
pkgconfig-depends
handling in the solver. Before, if there was nopkg-config
that could be found, the solver would optimistically succeed. But since the builder then requires usingpkg-config
to get the linking flags, this would necessarily fail on build anyway. Now, we fail. This lets a user set up an auto flag that toggles between using apkgconfig-depends
and explicitextra-libraries
etc stanza.I think this gives a nice solution that is strictly better than the prior situation.