Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark new deps of upgrades as auto-installed #3702

Merged
merged 1 commit into from Mar 1, 2023

Conversation

HebaruSan
Copy link
Member

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

  • Now ModuleInstaller.AddRemove has a newModulesAreAutoInstalled 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.
  • Since ModuleInstaller.AddRemove was only used internally to ModuleInstaller with all of its parameters set, it is now private and its parameters no longer have defaults, to make maintenance easier.
  • The mod list that Upgrade generates when it resolves relationships is now memoized to ensure we do not re-run the potentially expensive RelationshipResolver.ModList() logic (see Memoize lazily evaluated sequences #2953 and Install dependencies first #3667)

@HebaruSan HebaruSan added Bug Easy This is easy to fix Core (ckan.dll) Issues affecting the core part of CKAN Pull request Relationships Issues affecting depends, recommends, etc. labels Nov 11, 2022
Copy link
Member

@techman83 techman83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sensible to me, good explanation!

@HebaruSan HebaruSan merged commit 76bb1e6 into KSP-CKAN:master Mar 1, 2023
@HebaruSan HebaruSan deleted the fix/upgrade-deps-autoinst branch March 1, 2023 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Core (ckan.dll) Issues affecting the core part of CKAN Easy This is easy to fix Pull request Relationships Issues affecting depends, recommends, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants