Mark new deps of upgrades as auto-installed #3702
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.
Problem
I upgraded Sandcastle after KSP-CKAN/NetKAN#9428, and WildBlueCore was installed as intended, but it was not marked as auto-installed. It should be, because it's only installed due to Sandcastle's dependency.
Cause
ModuleInstaller.AddRemove
, which is called by Upgrade and Replace, sets the auto-installed flag to false for any module that isn't being removed in the same call. This was the most cautious thing to do when the auto-installed flag was being added (setting this flag to true unnecessarily could remove modules the user wants to keep), but on further investigation, it's not correct.Changes
ModuleInstaller.AddRemove
has anewModulesAreAutoInstalled
parameter that calling code can use to set the value of the auto-installed flag for modules that aren't being removed. Upgrade sets it to true because newly installed modules are dependencies, and replace sets it to false because newly installed modules are the replacement modules.ModuleInstaller.AddRemove
was only used internally toModuleInstaller
with all of its parameters set, it is nowprivate
and its parameters no longer have defaults, to make maintenance easier.RelationshipResolver.ModList()
logic (see Memoize lazily evaluated sequences #2953 and Install dependencies first #3667)