Simplify plan improvement, avoid reading store ghc-pkg db
Install plan improvement is the process of replacing configured source packages with installed instances from the store. Originally we did this by reading the ghc-pkg db to get the InstalledPackageInfo for all the packages in the store. We had to do that because when we replaced configured source packages by installed instances we used the PreExisting constructor which requires an InstalledPackageInfo, which we get from the installed package db. But now that we no longer use PreExisting for packages from the store we also no longer need the InstalledPackageInfo. All we need is a set of UnitIds. Also, once support for depending on executables was added then we needed a way to do plan improvement for executable packages/components. We did this by the simple approach of grabbing the dir listing for the store and using that as a set of UnitIds. So this patch extends the approach we use for executables and uses it for all packages. This means we no longer load the package db for the store. Note that still need to create the package db in the store. Previously we would create it when getting the package db contents, but we don't do that any more, but we still need to make sure the db exists. This also relates to the locking protocol in the store. The goal for the store is to be able to access and update it concurrently. The locking protocol will include checking membership by checking if the directory entry for the package is present. So this patch gets us to the right point for the reading side, leaving the writing side to do.
Showing with 25 additions and 29 deletions