Treat reinstalling a changed module as an update #3828
Merged
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.
Background
If you install a module, and then we later change it in the metadata repo, you'll get this popup when you refresh your registry:
If you click Yes, the module is reinstalled. If you click No, then it's not. The idea is to keep users up to date with the latest fixes and improvements as we maintain the metadata, such as missing dependencies or broken install stanzas.
Problems
Causes
I think this line from #3344 re-installs from the current/old metadata, not the new:
CKAN/GUI/Main/MainRepo.cs
Line 164 in 4aa4db6
ModuleInstaller.Upgrade
makes promises about reinstalling, into which I read too much.Motivations
@JonnyOThan had some questions about refactoring how CKAN installs RPM. While investigating, I had a thought:
(Don't worry, it wasn't actually that hard.)
The logic here is that we sometimes need to make related changes to the metadata, for example adding a new module and updating other modules to depend on it. It makes sense to apply such changes together in the same filesystem transaction, but currently we can't do that; reinstalling changed modules happens first, during repo update, and updating to new versions of modules happens separately. This allows users to end up with inconsistent metadata, some from before we merged a PR and some from after.
Changes
IRegistryQuerier.HasUpdate
returnstrue
if the metadata for an installed module differs from the same mod version from the repo, using the same comparison logic the repo update code used previously (which has been migrated toCkanModule.MetadataEquals
)You can now freely refresh your registry and not worry about what "metadata changed" means. Any modules with changed metadata will be included in your next pass of updates, which will happen all together in one filesystem transaction. This will be easier for users (fewer steps and screens to learn) and better for maintainers (related changes will be applied together).
Fixes #3825 (I think, needs confirmation). @Silvia-Dragoness, if you have time to take a look at it, there should be a test build here under the Checks tab, Artifacts dropdown a few minutes after this is submitted.