Skip to content

Commit

Permalink
Merge KSP-CKAN#3362 Fix installation of metapackages on cmdline
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed May 13, 2021
2 parents 72c4a56 + 2584615 commit 5a2cd8e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -25,6 +25,7 @@ All notable changes to this project will be documented in this file.
- [Multiple] Replace repo-reinst with kraken, handle in UIs (#3344 by: HebaruSan; reviewed: DasSkelett)
- [Multiple] Make ModuleInstaller a non-singleton (#3356 by: HebaruSan; reviewed: DasSkelett)
- [Core] Better recovery when registry.json is corrupted (#3351 by: HebaruSan; reviewed: DasSkelett)
- [CLI] Fix installation of metapackages on cmdline (#3362 by: DasSkelett; reviewed: HebaruSan)

### Internal

Expand Down
16 changes: 14 additions & 2 deletions Core/ModuleInstaller.cs
Expand Up @@ -108,8 +108,15 @@ public static string CachedOrDownload(CkanModule module, NetModuleCache cache, s
public void InstallList(List<string> modules, RelationshipResolverOptions options, RegistryManager registry_manager, ref HashSet<string> possibleConfigOnlyDirs, IDownloader downloader = null)
{
var resolver = new RelationshipResolver(modules, null, options, registry_manager.registry, ksp.VersionCriteria());
// Only pass the CkanModules of the parameters, so we can tell which are auto
InstallList(resolver.ModList().Where(m => resolver.ReasonFor(m) is SelectionReason.UserRequested).ToList(), options, registry_manager, ref possibleConfigOnlyDirs, downloader);
// Only pass the CkanModules of the parameters, so we can tell which are auto-installed,
// and relationships of metapackages, since metapackages aren't included in the RR modlist.
var list = resolver.ModList().Where(
m =>
{
var reason = resolver.ReasonFor(m);
return reason is SelectionReason.UserRequested || (reason.Parent?.IsMetapackage ?? false);
}).ToList();
InstallList(list, options, registry_manager, ref possibleConfigOnlyDirs, downloader);
}

/// <summary>
Expand All @@ -123,6 +130,11 @@ public void InstallList(List<string> modules, RelationshipResolverOptions option
public void InstallList(ICollection<CkanModule> modules, RelationshipResolverOptions options, RegistryManager registry_manager, ref HashSet<string> possibleConfigOnlyDirs, IDownloader downloader = null, bool ConfirmPrompt = true)
{
// TODO: Break this up into smaller pieces! It's huge!
if (modules.Count == 0)
{
User.RaiseProgress("Nothing to install.", 100);
return;
}
var resolver = new RelationshipResolver(modules, null, options, registry_manager.registry, ksp.VersionCriteria());
var modsToInstall = resolver.ModList().ToList();
List<CkanModule> downloads = new List<CkanModule>();
Expand Down

0 comments on commit 5a2cd8e

Please sign in to comment.