Fix #16324 More efficiently bulk unregister with ghc-pkg
This is my first substantive contribution to GHC and I am not sure how to comprehensively test my proposed changes. I am relying on the fact that it compiles, reasoning, and some limited testing with Stack using the built ghc-pkg
(that is, Stack does not seem to fail when unregistering).
The key part of the patch is that rather than the unregister
command using unregisterPackage
repeatedly (which uses modifyPackage
), it uses a new unregisterPackages
(which copies code from modifyPackage
but aims not to do things repeatedly that can be done only once - particularly the consistencyCheck
for null newly_broken
).
-
I don't expect the MR to break existing programs. -
The commit is individually buildable -
I think the commit message describes what it does, by reference to #16324. The complaint of #16324 is that #12637 (closed) did not achieve its objective (efficient bulk unregistering). -
I have added source comments.