Skip to content

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

Merged
msftrubengu merged 8 commits intomicrosoft:masterfrom
msftrubengu:issue_1191
Nov 9, 2021
Merged

Print message when install technology is different in upgrade scenarios#1649
msftrubengu merged 8 commits intomicrosoft:masterfrom
msftrubengu:issue_1191

Conversation

@msftrubengu
Copy link
Copy Markdown
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
Comment thread src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw Outdated
Comment thread src/AppInstallerCLICore/Workflows/WorkflowBase.cpp Outdated
Comment thread src/AppInstallerCLICore/Workflows/ManifestComparator.h Outdated
Comment thread src/AppInstallerCLICore/Workflows/ManifestComparator.h Outdated
Comment thread src/AppInstallerCLICore/Resources.h Outdated
Comment thread src/AppInstallerCLICore/Workflows/ManifestComparator.h Outdated
Comment thread src/AppInstallerCLICore/Workflows/UpdateFlow.cpp Outdated
Comment thread src/AppInstallerCLICore/Workflows/ManifestComparator.cpp
Copy link
Copy Markdown
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:

</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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

if (m_reportUpdateNotFound)
{
context.Reporter.Info() << Resource::String::UpdateNotApplicable << std::endl;
if (inapplicabilityVersions == InapplicabilityFlags::InstalledType)
Copy link
Copy Markdown
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
Copy Markdown

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 git@github.com: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
Copy Markdown
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