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

Allow replacement by conflicting modules #2695

Merged
merged 1 commit into from
Mar 14, 2019

Conversation

HebaruSan
Copy link
Member

Problem

If a module conflicts with its replaced_by module, clicking the Replace checkbox reports the conflict and blocks installation in GUI as if we were going to install both of them:

screenshot

Noted as part of KSP-CKAN/NetKAN#7027.

Cause

This call throws because it tries to resolve relationships with both conflicting modules installed:

CKAN/GUI/MainModList.cs

Lines 689 to 702 in 6b4cd14

while (!handled_all_too_many_provides)
{
//Can't await in catch clause - doesn't seem to work in mono. Hence this flag
TooManyModsProvideKraken kraken;
try
{
new RelationshipResolver(
modules_to_install,
null,
RelationshipResolver.DependsOnlyOpts(),
registry, version);
handled_all_too_many_provides = true;
continue;
}

That null value was set in #2579, and is the parameter for modules that will be removed; previously we passed modules_to_remove, which caused a different exception to be thrown if you removed a module that other modules depend on.

Changes

Now the reverse dependency logic happens first, and adds the reverse dependencies to modules_to_remove. This then allows us to pass modules_to_remove to the RelationshipResolver of the provides loop, since removing the reverse dependencies will prevent an inconsistency from being created.

modules_to_remove is then also passed to the final RelationshipResolver which previously recalculated it independently based on the change set, to save a few extra operations.

@HebaruSan HebaruSan added Bug Something is not working as intended GUI Issues affecting the interactive GUI Pull request labels Mar 7, 2019
@politas politas merged commit 240bbcd into KSP-CKAN:master Mar 14, 2019
politas added a commit that referenced this pull request Mar 14, 2019
@HebaruSan HebaruSan deleted the fix/replace-with-conflicts branch March 14, 2019 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is not working as intended GUI Issues affecting the interactive GUI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants