winget-cli icon indicating copy to clipboard operation
winget-cli copied to clipboard

Use `UpgradeCode` for matching MSI apps

Open florelis opened this issue 3 years ago • 2 comments

This change adds support for using an installer's UpgradeCode from the AppsAndFeaturesEntries for matching against the installed apps.

  • Added a new version of the index interface to create a new table for holding the UpgradeCode and a new version of the SearchResultsTable
  • Added UpgradeCode as a PackageVersionMultiProperty and SystemReferenceString
  • Updated ARP correlation to also consider UpgradeCode
  • Updated the ProductCode and PackageFamilyName tables to also include the data from AppsAndFeaturesEntries
  • Added extraction of the UpgradeCode for MSI apps when reading the ARP

Closes #1145

Microsoft Reviewers: Open in CodeFlow

florelis avatar Aug 04 '22 21:08 florelis

@check-spelling-bot Report

Unrecognized words, please review:

  • BEFACEF
  • BEFACEFE
  • FECAFEB
  • isxdigit
Previously acknowledged words that are now absent Amd Cfg cgmanifest CSharp kp mytool NETFX pdp vstest
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]:lechacon/winget-cli.git repository on the upgradeCode 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/1209879217" > "$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

github-actions[bot] avatar Aug 09 '22 20:08 github-actions[bot]

@check-spelling-bot Report

Unrecognized words, please review:

  • amd
  • Kp
To accept these unrecognized words as correct, run the following commands

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

update_files() {
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/1209952327" > "$comment_json"
comment_body=$(mktemp)
jq -r .body < "$comment_json" > $comment_body
rm $comment_json

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

github-actions[bot] avatar Aug 09 '22 22:08 github-actions[bot]

/azp run

JohnMcPMS avatar Aug 12 '22 17:08 JohnMcPMS

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Aug 12 '22 17:08 azure-pipelines[bot]