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

Add support for markets #1806

Merged
merged 5 commits into from
Jan 24, 2022
Merged

Add support for markets #1806

merged 5 commits into from
Jan 24, 2022

Conversation

florelis
Copy link
Member

@florelis florelis commented Dec 15, 2021

Adding support for filtering installers based on markets in the manifest.

  • Added new field filter for markets to ManifestComparator. Filter uses the current market as returned by GetUserDefaultGeoName().
  • Added unit tests for new filter.

Closes #1241

Microsoft Reviewers: Open in CodeFlow

@florelis florelis requested a review from a team as a code owner December 15, 2021 23:38
@ghost ghost added Area-Manifest This may require a change to the manifest Issue-Feature This is a feature request for the Windows Package Manager client. labels Dec 15, 2021
@florelis florelis marked this pull request as draft January 5, 2022 19:05
src/AppInstallerCLICore/Workflows/ManifestComparator.cpp Outdated Show resolved Hide resolved
if (!installer.Markets.AllowedMarkets.empty())
{
// Inapplicable if NOT found
if (installer.Markets.AllowedMarkets.end() == std::find(installer.Markets.AllowedMarkets.begin(), installer.Markets.AllowedMarkets.end(), m_market))
Copy link
Member

Choose a reason for hiding this comment

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

Are these market strings normalized to allow for this direct equality comparison? Most likely not, and we need to either normalize them or perform a normalizing comparison. Either way, I would suggest a helper type to make it easier.

Copy link
Member Author

Choose a reason for hiding this comment

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

I made the comparison case insensitive, but after re-reading your comment I'm not sure if that was what you meant. The manifest schema requires the markets to be two uppercase letters, so we shouldn't need any normalization there, although I'm not sure if the region from the OS could not be uppercase.

Copy link
Member

Choose a reason for hiding this comment

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

Unless this is a performance critical path and we find this to be an issue, I would leave it as case insensitive (also unless it turns out that case sensitivity is actual part of the definition of markets). We don't own the validation on both sides, so better to be safe.

src/AppInstallerCLICore/Workflows/ManifestComparator.cpp Outdated Show resolved Hide resolved
src/AppInstallerCLICore/Workflows/ManifestComparator.cpp Outdated Show resolved Hide resolved
src/AppInstallerCLICore/Workflows/ManifestComparator.cpp Outdated Show resolved Hide resolved
@ghost ghost added the Needs-Author-Feedback Issue needs attention from issue or PR author label Jan 20, 2022
@ghost ghost removed the Needs-Author-Feedback Issue needs attention from issue or PR author label Jan 21, 2022
@florelis florelis marked this pull request as ready for review January 22, 2022 06:09
strstr << ", ";
}

strstr << toString(item);
Copy link
Member

Choose a reason for hiding this comment

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

Which type(s) were not being output properly by the <<? I would expect any stringish type we use to work without a coercion function.

Not critical, but I like to understand 😄

Copy link
Member Author

Choose a reason for hiding this comment

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

Utility::Architecture for the applicable architectures filter. It was coming out as an integer.

@florelis florelis merged commit 71c73d2 into microsoft:master Jan 24, 2022
@florelis florelis deleted the markets branch January 25, 2022 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Manifest This may require a change to the manifest Issue-Feature This is a feature request for the Windows Package Manager client.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Markets to manifest
2 participants