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

Print message when install technology is different in upgrade scenarios #1649

Merged
merged 8 commits into from
Nov 9, 2021

Conversation

msftrubengu
Copy link
Contributor

@msftrubengu msftrubengu commented Oct 27, 2021

It is possible that the winget shows an available update via winget upgrade but doing winget upgrade <id> results in "No applicable update found." The details of why already shown in the logs.

Based on #1191, one of the common patterns we've seen is when the installed technology of the installed version is different to the update version. This change bubbles up the error to make it more visible to users.

The current recommendation is to uninstall and install the new version. In the future, #1640 will provide a way to do it automatically if desired.

Microsoft Reviewers: Open in CodeFlow

@msftrubengu msftrubengu requested a review from a team as a code owner October 27, 2021 19:50
Copy link
Contributor

@yao-msft yao-msft left a comment

Choose a reason for hiding this comment

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

:shipit:

@@ -1236,4 +1236,10 @@ Please specify one of them using the `--source` option to proceed.</value>
<data name="CountOutOfBoundsError" xml:space="preserve">
<value>The requested number of results must be between 1 and 1000.</value>
</data>
</root>
<data name="UpgradeDifferentInstallTechnologyInNewerVersions" xml:space="preserve">
<value>At least a newer package was found but the install technology is different from the current version installed. Please uninstall the package and install a newer version.</value>
Copy link
Member

@JohnMcPMS JohnMcPMS Oct 28, 2021

Choose a reason for hiding this comment

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

Suggested change
<value>At least a newer package was found but the install technology is different from the current version installed. Please uninstall the package and install a newer version.</value>
<value>A newer version was found, but the install technology is different from the current version installed. Please uninstall the package and install the newer version.</value>
``` #Resolved

<data name="UpgradeDifferentInstallTechnologyInNewerVersions" xml:space="preserve">
<value>At least a newer package was found but the install technology is different from the current version installed. Please uninstall the package and install a newer version.</value>
</data>
<data name="UpgradeDifferentInstallTechnology" xml:space="preserve">
Copy link
Member

Choose a reason for hiding this comment

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

It is not clear to me when this would be used over the other string.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

UpgradeDifferentInstallTechnologyInNewerVersions is for winget upgrade <id> and we just look at all versions

UpgradeDifferentInstallTechnology is for specific version winget upgrade <id> -v 2.0

it is different codepaths and i thought it was weird showing "At least a newer package was found..." when a version is specified.

struct InstallerAndInapplicability
{
std::optional<Manifest::ManifestInstaller> installer;
InapplicabilityFlags inapplicabilityFlags;
Copy link
Member

@JohnMcPMS JohnMcPMS Oct 28, 2021

Choose a reason for hiding this comment

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

My intention was that there would be a reason for every installer that was not applicable. #Resolved

Copy link
Member

Choose a reason for hiding this comment

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

And ORing all of the reasons together makes for a very strange experience, breaking most of our ability to reason about what could be done to change things.

{
AICLI_LOG(CLI, Info, << "Installer " << installer << " not applicable: " << filter->ExplainInapplicable(installer));
return false;
return inapplicability;
Copy link
Member

@JohnMcPMS JohnMcPMS Oct 28, 2021

Choose a reason for hiding this comment

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

We should run all of them and OR the results together. That way we can confidently say "This is not applicable for this specific reason" rather than telling them then finding out there are also others. #Resolved

@@ -65,8 +67,16 @@ namespace AppInstaller::CLI::Workflow
{
if (m_reportUpdateNotFound)
{
context.Reporter.Info() << Resource::String::UpdateNotApplicable << std::endl;
if (inapplicabilityVersions == InapplicabilityFlags::InstalledType)
Copy link
Member

@JohnMcPMS JohnMcPMS Oct 28, 2021

Choose a reason for hiding this comment

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

This should be "If there is at least one installer whose only reason is InstalledType". That way we know that in fact the only thing blocking us is the installed version. #Resolved

@ghost ghost added the Needs-Author-Feedback Issue needs attention from issue or PR author label Oct 28, 2021
@ghost ghost removed the Needs-Author-Feedback Issue needs attention from issue or PR author label Oct 28, 2021
@github-actions
Copy link

github-actions bot commented Oct 28, 2021

@check-spelling-bot Report

Unrecognized words, please review:

  • inapplicabilities
Previously acknowledged words that are now absent activatable Globals mytool URIs Utils
To accept these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the [email protected]:msftrubengu/winget-cli.git repository
on the issue_1191 branch:

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spelling/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spelling/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
}

comment_json=$(mktemp)
curl -L -s -S \
  --header "Content-Type: application/json" \
  "https://api.github.com/repos/microsoft/winget-cli/issues/comments/954232646" > "$comment_json"
comment_body=$(mktemp)
jq -r .body < "$comment_json" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")
  

patch_add=$(perl -e '$/=undef;
$_=<>;
s{<details>.*}{}s;
s{^#.*}{};
s{\n##.*}{};
s{(?:^|\n)\s*\*}{}g;
s{\s+}{ }g;
print' < "$comment_body")
  
update_files
rm $comment_body
git add -u

{
std::optional<Manifest::ManifestInstaller> installer;
InapplicabilityFlags inapplicabilityFlags;
std::vector<InapplicabilityFlags> inapplicabilitiesInstaller;
Copy link
Member

Choose a reason for hiding this comment

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

It probably doesn't matter right now, but it seems odd to not know which installer each goes with.

@msftrubengu msftrubengu merged commit a14de79 into microsoft:master Nov 9, 2021
@denelon denelon linked an issue Nov 18, 2021 that may be closed by this pull request
@msftrubengu msftrubengu linked an issue Apr 1, 2022 that may be closed by this pull request
@msftrubengu msftrubengu deleted the issue_1191 branch November 15, 2022 00:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warning for different InstallerType Winget upgrade package, No applicable update found
3 participants