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

Don't try to install multiple versions of the same mod #3051

Merged
merged 1 commit into from
May 15, 2020

Conversation

HebaruSan
Copy link
Member

Background

In KSP-CKAN/NetKAN#7891, Spectra removed PlanetShine-Config from its provides list because it no longer ships with a PlanetShine config. Versions v1.2.5 and earlier were released before that change, and v1.3 and later were released after.

Problem

If you install Spectra v1.3.1 (after the above change):

changeset

... and then install the PlanetShine suggestion, you will be prompted to choose between PlanetShine's default config and Spectra v1.2.5:

prompt

If you choose Spectra v1.2.5, this fails because you're already installing Spectra v1.3.1, and you can't install two different versions of the same mod at the same time.

System.ArgumentException: Already contains module:Spectra
   at CKAN.RelationshipResolver.Add(CkanModule module, SelectionReason reason)
   at CKAN.RelationshipResolver.AddModulesToInstall(IEnumerable`1 modules)
   at CKAN.ModuleInstaller.InstallList(ICollection`1 modules, RelationshipResolverOptions options, RegistryManager registry_manager, IDownloader downloader, Boolean ConfirmPrompt)
   at CKAN.Main.InstallMods(Object sender, DoWorkEventArgs e)
   at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
   at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)

Cause

When the RelationshipResolver looks for modules to satisfy a depends relationship, LatestAvailableWithProvides can find other versions of a mod we're already installing, and it doesn't account for this possibility.

Canges

Now we exclude modules if they have the same identifier as one we're already installing. This allows Spectra v1.3.1 to install with the default PlanetShine config without prompting, and Spectra v1.2.5 to install its own PlanetShine config without prompting.

@HebaruSan HebaruSan added Bug Something is not working as intended Core (ckan.dll) Issues affecting the core part of CKAN Pull request Relationships Issues affecting depends, recommends, etc. labels May 13, 2020
@HebaruSan HebaruSan requested a review from DasSkelett May 13, 2020 21:37
Copy link
Member

@DasSkelett DasSkelett left a comment

Choose a reason for hiding this comment

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

Does its job!

@HebaruSan HebaruSan merged commit bf3324f into KSP-CKAN:master May 15, 2020
@HebaruSan HebaruSan deleted the fix/same-id-prov branch May 15, 2020 18:01
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 Core (ckan.dll) Issues affecting the core part of CKAN Relationships Issues affecting depends, recommends, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants