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

Support languages when installing from the API #14456

Merged
merged 2 commits into from
Feb 3, 2023
Merged

Support languages when installing from the API #14456

merged 2 commits into from
Feb 3, 2023

Conversation

Rylan12
Copy link
Member

@Rylan12 Rylan12 commented Jan 28, 2023

Fixes Homebrew/homebrew-cask#140264

This PR allows languages to be used when installing casks from the API. When a cask has multiple language options, just use the source file to load the cask. This is exactly what we do for casks with *_flight blocks, and I think it makes sense to do here as well. There are currently 41 casks with language blocks.

In theory, we could check whether the current language is different from the default and only use this method when they differ, but I found that detection to be more complicated than I felt was justified, but I can look into that more if we think that will be valuable.

Note: this requires #14453 to be merged and put through a formulae.brew.sh run before this can be merged (hence the do not merge label).

@Rylan12 Rylan12 added critical Critical change which should be shipped as soon as possible. do not merge labels Jan 28, 2023
@BrewTestBot
Copy link
Member

BrewTestBot commented Jan 28, 2023

Review period ended.

@Rylan12 Rylan12 added the install from api Relates to API installs label Jan 28, 2023
@lkul2912
Copy link

Install

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Thanks again @Rylan12!

if json_cask[:artifacts].any? { |artifact| FLIGHT_STANZAS.include?(artifact.keys.first) }
# Use the cask-source API if there are any `*flight` blocks or the cask has multiple languages
if json_cask[:artifacts].any? { |artifact| FLIGHT_STANZAS.include?(artifact.keys.first) } ||
json_cask[:languages].any?
Copy link
Member

Choose a reason for hiding this comment

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

For post-this PR: this makes me wonder if we actually want to include all artefacts and languages in the JSON. It's could to bloat it quite a bit unnecessarily?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, it might be okay to do. Some casks like firefox have 51 languages, but most casks don't have any at all. Think it's worth doing it that way?

Copy link
Member

Choose a reason for hiding this comment

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

@Rylan12 Perhaps just compare the size of the overall (gzipped) JSON output? It's it's noticeable then optimise, if not: leave it as-is.

Copy link
Member Author

Choose a reason for hiding this comment

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

Why gzipped? We don't currently compress the JSON files before downloading, right?

I will compare later when I have some more time.

Copy link
Member

Choose a reason for hiding this comment

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

@Rylan12 I think/thought we're downloading them gziped. If not and we can do that transparently (a non-trivial number of web servers will do this): we should.

Copy link
Member

Choose a reason for hiding this comment

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

I will compare later when I have some more time.

Cool, no rush! Happy to ship this as-is for now?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, sorry for the delay. Let's merge and re-evaluate

Copy link
Member

Choose a reason for hiding this comment

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

I checked: we use --compressed which means we will download files gzipped by the server.

@lkul2912

This comment was marked as off-topic.

@Rylan12 Rylan12 enabled auto-merge February 3, 2023 09:22
@Rylan12 Rylan12 merged commit af9ba41 into Homebrew:master Feb 3, 2023
@Rylan12 Rylan12 deleted the api-language-support branch February 3, 2023 10:23
@github-actions github-actions bot added the outdated PR was locked due to age label Mar 6, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
critical Critical change which should be shipped as soon as possible. install from api Relates to API installs outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

brew [re]install firefox started to ignore system language and even --language=de
4 participants