diff --git a/Core/ModuleInstaller.cs b/Core/ModuleInstaller.cs index 4164f30da..6c69ac231 100644 --- a/Core/ModuleInstaller.cs +++ b/Core/ModuleInstaller.cs @@ -166,7 +166,9 @@ public void InstallList(ICollection modules, foreach (var module in modsToInstall) { User.RaiseMessage(" * {0}", Cache.DescribeAvailability(module)); - if (!Cache.IsMaybeCachedZip(module)) + // Alert about attempts to install DLC before downloading or installing anything + CheckKindInstallationKraken(module); + if (!module.IsMetapackage && !Cache.IsMaybeCachedZip(module)) { downloads.Add(module); } @@ -242,8 +244,7 @@ private void Install(CkanModule module, bool autoInstalled, Registry registry, ref HashSet? possibleConfigOnlyDirs, - IProgress? progress, - string? filename = null) + IProgress? progress) { CheckKindInstallationKraken(module); var version = registry.InstalledVersion(module.identifier); @@ -256,15 +257,19 @@ private void Install(CkanModule module, return; } - // Find ZIP in the cache if we don't already have it. - filename ??= Cache.GetCachedFilename(module); - - // If we *still* don't have a file, then kraken bitterly. - if (filename == null) + string? filename = null; + if (!module.IsMetapackage) { - throw new FileNotFoundKraken(null, - string.Format(Properties.Resources.ModuleInstallerZIPNotInCache, - module)); + // Find ZIP in the cache if we don't already have it. + filename ??= Cache.GetCachedFilename(module); + + // If we *still* don't have a file, then kraken bitterly. + if (filename == null) + { + throw new FileNotFoundKraken(null, + string.Format(Properties.Resources.ModuleInstallerZIPNotInCache, + module)); + } } using (var transaction = CkanTransaction.CreateTransactionScope()) @@ -285,19 +290,14 @@ private void Install(CkanModule module, // Fire our callback that we've installed a module, if we have one. onReportModInstalled?.Invoke(module); - } /// - /// Check if the given module is a metapackage: + /// Check if the given module is a DLC: /// if it is, throws a BadCommandKraken. /// private static void CheckKindInstallationKraken(CkanModule module) { - if (module.IsMetapackage) - { - throw new BadCommandKraken(Properties.Resources.ModuleInstallerMetapackage); - } if (module.IsDLC) { throw new BadCommandKraken(Properties.Resources.ModuleInstallerDLC); @@ -313,14 +313,18 @@ private static void CheckKindInstallationKraken(CkanModule module) /// Propagates a FileExistsKraken if we were going to overwrite a file. /// private List InstallModule(CkanModule module, - string zip_filename, + string? zip_filename, Registry registry, ref HashSet? possibleConfigOnlyDirs, IProgress? moduleProgress) { - CheckKindInstallationKraken(module); var createdPaths = new List(); - + if (module.IsMetapackage || zip_filename == null) + { + // It's OK to include metapackages in changesets, + // but there's no work to do for them + return createdPaths; + } using (ZipFile zipfile = new ZipFile(zip_filename)) { var filters = ServiceLocator.Container.Resolve().GlobalInstallFilters diff --git a/Core/Relationships/RelationshipResolver.cs b/Core/Relationships/RelationshipResolver.cs index 287aaee75..40c6aeb91 100644 --- a/Core/Relationships/RelationshipResolver.cs +++ b/Core/Relationships/RelationshipResolver.cs @@ -421,11 +421,6 @@ private string conflictingModDescription(CkanModule? mod, CkanModule? parent) /// private void Add(CkanModule module, SelectionReason reason) { - if (module.IsMetapackage) - { - AddReason(module, reason); - return; - } if (module.IsDLC) { throw new ModuleIsDLCKraken(module); diff --git a/GUI/Main/MainChangeset.cs b/GUI/Main/MainChangeset.cs index 537ef6757..cfe322c87 100644 --- a/GUI/Main/MainChangeset.cs +++ b/GUI/Main/MainChangeset.cs @@ -46,7 +46,7 @@ private void Changeset_OnConfirmChanges(List changeset) { Wait.StartWaiting(InstallMods, PostInstallMods, true, new InstallArgument( - // Only pass along user requested mods, so auto-installed can be determined + // Only pass along user requested mods, so auto-installed can be determined changeset.Where(ch => ch.Reasons.Any(r => r is SelectionReason.UserRequested) // Include all removes and upgrades || ch.ChangeType != GUIModChangeType.Install) diff --git a/GUI/Model/ModList.cs b/GUI/Model/ModList.cs index 6cce0b361..a2cf963fc 100644 --- a/GUI/Model/ModList.cs +++ b/GUI/Model/ModList.cs @@ -214,7 +214,6 @@ public Tuple, Dictionary, List !m.IsMetapackage) .Select(m => new ModChange(m, GUIModChangeType.Install, resolver.ReasonsFor(m)))), resolver.ConflictList, resolver.ConflictDescriptions.ToList());