-
-
Notifications
You must be signed in to change notification settings - Fork 346
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
Respect installing modules during dependency resolution #3002
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Oops, this was also the install where I was partway through the |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Yeah, I think that's the problem, |
I moved the lines where the new modules are added to the installed modules inside the internal This should be rather safe to do, because we don't rely on I didn't encounter any freezes / deadlocks with this now (just Spectra taking a long time to install due to its size). |
Nice, it worked perfectly that time! I can go back and forth between Spectra and the default configs at will. This is some great progress! I'm seeing this in the log though:
I'll take a closer look at the code sometime in the next day or so. |
Currently when uninstalling dependencies of a mod and installing a new mod that provides these dependencies, CKAN will remove the dependent mod, even though its dependencies will be satisfied after the process completed. Example: Scatterer depends on Scatterer-config and Scatterer-sunflare. Spectra provides both of these modules. When you have Scatterer installed with its default config + sunflare and mark Spectra for installation, CKAN correctly reports conflicts. Then you de-select the dafault config + sunflare so they get uninstalled. Even though Spectra provides these modules too (which triggered the TooManyModsProvide conflict), CKAN (both GUI and ConsoleUI) wants to remove Scatterer. This is due to the mods that are about to be installed not being respected in `FindReverseDependencies()` > `FindUnsatisfiedDepends()` > `MatchesAny()`. This commit adds an optional argument to `FindUnsatisfiedDependencies()`, `IEnumerable<CkanModule> modulesToInstall`, which will be added to the list of "currently installed" mods, so `FindUnsatisfiedDepends()` considers them and their provided modules.
560ee79
to
7ae5ba6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, the subtleties of this are more clear to me now: the installing list is added temporarily and removed in each iteration just so it can satisfy other modules' dependencies. Any installing module with dependencies will probably itself be counted as "broken" since dependencies aren't added to the list, but that's fine since we remove them anyway (and re-add them in the next pass). I initially thought of this as having more resolution logic in and around it, but it's really only doing one simple thing.
Problem
Found out thanks to this comment on the Spectra forum thread.
Currently when uninstalling dependencies of a mod and installing a new mod that also provides these dependencies, CKAN will remove the dependent mod, even though its dependencies will be satisfied after the process completed, thanks to the new mod.
Example
Scatterer depends on Scatterer-config and Scatterer-sunflare.
Spectra provides both of these modules.
When you have Scatterer installed with its default config + sunflare and mark Spectra for installation, CKAN correctly reports conflicts.
Then you de-select the default config + sunflare so they get uninstalled.
Even though Spectra provides these modules too (which triggered the TooManyModsProvide conflict), CKAN (both GUI and ConsoleUI) wants to remove Scatterer.
Cause
This is due to the mods that are about to be installed not being respected in
FindReverseDependencies()
>FindUnsatisfiedDepends()
>MatchesAny()
.Only the currently installed mods are taken into account for the dependency resolution.
Changes
This commit adds an optional argument to the public
FindReverseDependencies()
,IEnumerable<CkanModule> modulesToInstall
.This list is passed to the internal
FindReverseDependencies()
(which also takes a new argument for this.In each "find broken depends" pass, this list is added to the list of already installed mods, so
FindUnsatisfiedDepends()
considers them and their provided modules.Mods that are about to be installed with dependencies will be likely reported as broken by
FindUnsatisfiedDepends()
, because their dependencies aren't yet included inmodsToInstall
(this happens later in the changeset calculation/installation process).So to make sure we only return broken modules that are already installed, we intersect
broken
withorigInstalled
.UninstallList
now takes aIEnumerable<CkanModule> installing
instead ofIEnumerable<string> installing
which it passes on toFindReverseDependencies()
.ConsoleUI/InstallScreen.Run()
andGUI/Main/MainInstall.InstallMods()
are changed to pass the list of mods that are about to be installed toUninstallList()
.GUI/MainModList.ComputeChangeSetFromModList()
also passesmodules_to_install
.I've removed the
UninstallList()
override which takes a single string instead of a list of mods to uninstall, because it was only used in one single test.This test now creates a new
List<string>
on the fly.Closes #1909