WIP Auto resolve cyclic USE conflicts by trying the first suggestion #1385
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi Zac or anyone else who has a clue how the depgraph works. 😁
This is the result of several days of mostly staring and occasionally typing during our recent Hackathon at work. The idea is to automatically resolve cyclic USE conflicts like this or the infamous freetype vs harfbuzz one.
Portage tells you what to do, so why doesn't it just do that for you? This would be a great help for Gentoo users, Gentoo developers who go out of their way to keep these situations away from users (there was a lot of excitement on IRC!), and also Flatcar Linux, which hits several conflicts at once when building its image.
The initial results after my first attempt looked very encouraging.
I then found that it was only resolving the first conflict and ignoring the rest, with Flatcar's case resulting in an invalid list. A little more work got it resolving each conflict in turn, which made Flatcar's case look better, but then the ordering went a little wobbly.
Finally, I found that it wasn't adding any dependencies required by the temporary solution. While these could maybe be handled, there are unlikely to be any additional dependencies in practise as the solution is usually
USE=+build
orUSE=-some-feature
. I therefore kept it simple by only attempting automatic resolution when there are no additional dependencies.I am aware that this is probably broken in other ways too. It's not taking account of wider blockers, although again, there probably aren't any in practise, and they are unlikely to be an issue for the short period while the conflict is resolved.
Perhaps this inspires you to come up with something solid? I and many others would be extremely grateful. Failing that, perhaps you can give me some pointers.