Backtrack when no pkgconfigdb is present#7621
Conversation
Mikolaj
left a comment
There was a problem hiding this comment.
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: |
|
Thanks! I implemented tests as suggested |
| , 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.
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-dependshandling in the solver. Before, if there was nopkg-configthat could be found, the solver would optimistically succeed. But since the builder then requires usingpkg-configto 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-dependsand explicitextra-librariesetc stanza.I think this gives a nice solution that is strictly better than the prior situation.