Skip to content

Add support for markets - #1806

Merged
Flor Chacón (florelis) merged 5 commits into
microsoft:masterfrom
florelis:markets
Jan 24, 2022
Merged

Flor Chacón (florelis) merged 5 commits into
microsoft:masterfrom
florelis:markets

Conversation

@florelis

@florelis Flor Chacón (florelis) commented Dec 15, 2021 •

Copy link
Copy Markdown
Member

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
Flor Chacón (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
Flor Chacón (florelis) marked this pull request as draft January 5, 2022 19:05
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@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
Flor Chacón (florelis) marked this pull request as ready for review January 22, 2022 06:09
strstr << ", ";
}

strstr << toString(item);

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.

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
Copy Markdown
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
Flor Chacón (florelis) merged commit 71c73d2 into microsoft:master Jan 24, 2022
@florelis
Flor Chacón (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