Fix installation of metapackages on cmdline #3362
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
When trying to install metapackages from cmdline, using
ckan.exe -c metapackage.ckan
, it doesn't actually install any mods:whereas the GUI installs them correctly.
Cause
In
InstallList(List<string> modules, ...)
, we are running theRelationshipResolver
for the identifier list, to get back a list ofCkanModule
to install. Then we filter out all modules installed as dependencies, to make sure the resolver running inInstallList(ICollection<CkanModule> modules, ...)
can re-detect them as dependencies, so we can mark them as auto-installed.CKAN/Core/ModuleInstaller.cs
Lines 108 to 113 in 72c4a56
The problem with metapackages is, that the first RR filters them out of the mod list (we don't want to actually install the metapackage after all). Thus the list of mods passed to
InstallList(ICollection<CkanModule> modules, ...)
is empty.Changes
Now we also keep modules whose selection reason is "I'm a dependency|recommendation|suggestion of a metapackage" in the list passed to
InstallList(ICollection<CkanModule> modules, ...)
.The
InstallList(List<string> modules, ...)
method is only used in the CmdLine; GUI sends the metapackage asCkanModule
toInstallList(ICollection<CkanModule> modules, ...)
, and the ConsoleUI pretty much only deals inCkanModule
s (and doesn't have a "Install from .ckan" feature).InstallList()
is now also returning early if there are no mods to install, no need to go through the whole transaction and registry saving shebang.I was considering two other solutions:
b) make
CmdLine.Install.RunCommand())
call the otherInstallList()
passing a list ofCkanModule
instead of identifier+version combos. This might or might not have introduced other issues causing installation of outdated modules (I think we moved to a list of strings some time ago deliberately?)c) make
RelationshipResolver.Resolve()
mark dependencies of metapackages asSelectionReason.UserRequested
, notDepends
. Might have had other side effects as well.