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

Next steps for HOMEBREW_INSTALL_FROM_API #13794

Closed
12 of 14 tasks
Rylan12 opened this issue Sep 2, 2022 · 25 comments · Fixed by #14412
Closed
12 of 14 tasks

Next steps for HOMEBREW_INSTALL_FROM_API #13794

Rylan12 opened this issue Sep 2, 2022 · 25 comments · Fixed by #14412
Labels
features New features in progress Maintainers are working on this install from api Relates to API installs outdated PR was locked due to age

Comments

@Rylan12
Copy link
Member

Rylan12 commented Sep 2, 2022

Provide a detailed description of the proposed feature

Here are the tasks that need to be completed in order to consider HOMEBREW_INSTALL_FROM_API ready for official testing by maintainers and interested users:

What is the motivation for the feature?

I'm back at school so my availability over the next several months will be much more limited and less consistent. I'm opening this tracking issue to help monitor progress over time.

How will the feature be relevant to at least 90% of Homebrew users?

Eventually, HOMEBREW_INSTALL_FROM_API will be the default for everyone.

What alternatives to the feature have been considered?

None

@Rylan12 Rylan12 added the features New features label Sep 2, 2022
@MikeMcQuaid
Copy link
Member

[ ] A warning or some sort of message should be shown when installing a formula with a post_install block or a cask with a {pre,post}flight block so that users know that some things may not work at the moment (or, in the case of formulae, they need to run brew postinstall <formula>)

Is this something we expect to be fixed but just hasn't been yet? For a bottle installation, it should be able to use the post_install from within the bottle, right?

  • I think it might be a good idea to mark in the INSTALL_RECEIPT.json or .metadata directory whether the formula/cask was installed from the API in case we run into issues and it's helpful to know how a formula was installed. But, this is a lower priority and might not even be needed at all

This is a good idea 👍🏻

I'm back at school so my availability over the next several months will be much more limited and less consistent. I'm opening this tracking issue to help monitor progress over time.

No worries, thanks for opening this tracking issue!

@Rylan12
Copy link
Member Author

Rylan12 commented Sep 2, 2022

Is this something we expect to be fixed but just hasn't been yet? For a bottle installation, it should be able to use the post_install from within the bottle, right?

This requires us to build new bottles every time the postinstall method changes. And it's hard to tell whether existing bottles have outdated postinstall methods, so this might require rebottling everything. Also, style changes in the future may require rebottling all formulae that have postinstall blocks (currently 239 formulae) for the same reason. There's been some discussion in various places about the pros and cons of this as well as some other potential ways to deal with this, but I'll have to track those down

@MikeMcQuaid
Copy link
Member

This requires us to build new bottles every time the postinstall method changes.

Yeh, I think this is fine for changes we need to push to users. Don't think this needs a warning as long as maintainers are made aware with docs/Slack communication.

And it's hard to tell whether existing bottles have outdated postinstall methods, so this might require rebottling everything.

This seems overkill.

Also, style changes in the future may require rebottling all formulae that have postinstall blocks (currently 239 formulae) for the same reason.

Why would a style change need rebottling?

but I'll have to track those down

That'd be great, thanks ❤️!

@Rylan12
Copy link
Member Author

Rylan12 commented Sep 5, 2022

Why would a style change need rebottling?

I used the wrong words here. Most style changes that are truly only style changes should be fine as long as the old style isn't invalid ruby or anything like that. Really the issue is deprecations and stuff that, if not updated, might not be able to be understood by a brew version newer than the one that created the bottle.

but I'll have to track those down

We discussed this a bit on June 18 in Slack. I'll send a link over in slack to the messages. Here on GitHub, we discussed this in #12350, but there probably isn't anything in that discussion that didn't make it into the slack one.

@MikeMcQuaid
Copy link
Member

Really the issue is deprecations and stuff that, if not updated, might not be able to be understood by a brew version newer than the one that created the bottle.

Gotcha 👍🏻

@github-actions
Copy link

github-actions bot commented Oct 3, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale No recent activity label Oct 3, 2022
@MikeMcQuaid MikeMcQuaid added in progress Maintainers are working on this help wanted We want help addressing this labels Oct 3, 2022
@github-actions github-actions bot removed the stale No recent activity label Oct 4, 2022
@hyuraku
Copy link
Contributor

hyuraku commented Oct 5, 2022

@Rylan12

Migrate all casks to use on_{macos_version} blocks instead of if MacOS.version conditionals

I guess we need a new issue on https://github.com/Homebrew/homebrew-cask
to get the word out to people and have them modify the casks. How about it?

@p-linnane
Copy link
Member

@hyuraku I am game to start working on these.

@Rylan12
Copy link
Member Author

Rylan12 commented Oct 8, 2022

@hyuraku and @p-linnane, thanks for taking the initiative on this!

I think an issue in homebrew/cask would be great, but only once we've started the process and made sure all of its kinks are worked out (clearly from the past few days, we're not quite there yet 😅)


The immediate next steps that I think we need to take to get this ready are:

  • Make brew readall simulate every OS/arch combination
  • Fix homebrew/cask CI to not rely on checking the cask's contents for if MacOS.version conditionals

I plan on working on both of these soon, but if anyone else is interested feel free to give it a go

@hyuraku
Copy link
Contributor

hyuraku commented Oct 9, 2022

I think an issue in homebrew/cask would be great, but only once we've started the process and made sure all of its kinks are worked out (clearly from the past few days, we're not quite there yet 😅)

Understood, I will try to solve the other task.

@hyuraku
Copy link
Contributor

hyuraku commented Oct 13, 2022

@Rylan12
I have a question about We need to handle download errors of the formula.json and cask.json files
I couldn't find the code where we download cask.json; should we add the code to download cask.json by any chance?

@Rylan12
Copy link
Member Author

Rylan12 commented Oct 13, 2022

We will once all casks are migrated to use on_monterey and friends. Only then (and maybe after some more fixes) will we be able to load casks from the JSON API. Right now, the existing cask API doesn't contain enough information to do so.

@carlocab

This comment was marked as resolved.

@carlocab

This comment was marked as resolved.

@carlocab

This comment was marked as resolved.

@Rylan12 Rylan12 added install from api Relates to API installs and removed help wanted We want help addressing this labels Jan 28, 2023
@apainintheneck
Copy link
Contributor

I just realized that service blocks don't work with HOMEBREW_INSTALL_FROM_API just like the different *flight blocks. It'd be good to notify the user about that too.

@miccal

This comment was marked as resolved.

@carlocab

This comment was marked as resolved.

@gromgit
Copy link
Contributor

gromgit commented Feb 1, 2023

Another issue from way out in left field: https://github.com/orgs/Homebrew/discussions/4135

Cask install logs here: https://gist.github.com/gromgit/6a332888b9a77084cf40ae2e8c28d0c6

In a nutshell, the dotnet-sdk cask contains the following stanza:

  binary "/usr/local/share/dotnet/dotnet"

With HOMEBREW_INSTALL FROM API, what seems to be happening is Homebrew replaces /usr/local with $HOMEBREW_PREFIX, causing the symlinking to /opt/homebrew/bin on M1 Macs to fail. HOMEBREW_NO_INSTALL_FROM_API does not seem to do this, and therefore works correctly.

@carlocab
Copy link
Member

carlocab commented Feb 1, 2023

Uninstalling casks when sudo is required seems to be broken with HOMEBREW_INSTALL_FROM_API. See Homebrew/homebrew-cask#140436.

@vincentisambart
Copy link

vincentisambart commented Feb 1, 2023

I have another probably that is very likely related to this: when brew upgrade builds code from source, I end up with an Empty installation error. Running it multiple times, or running brew update does not change anything. Adding a few prints here and there, some part of Homebrew is using an old version number of the formula, some part the most recent one. As the install path used and expected one do not match, the check if the installation is empty fails.

brew outdated tells me that my copy of some library is outdated, but looking at the local copy of the core tap it was not up to date (even if I run brew update manually). My guess is that due to this change towards using the API the copy of the tap is not updated. And when building from source, part of the Homebrew code uses the version from the API and part of it still uses the version number (or whole formula) from the local copy of the tap so that does not go well.

By the way running HOMEBREW_NO_INSTALL_FROM_API=1 brew upgrade did update the local copy and so fixed the problem so I guess I will have to rely on it until this problem is fixed.

@MikeMcQuaid
Copy link
Member

when brew upgrade builds code from source

@vincentisambart Can you dump your brew config and brew doctor somewhere (even if there are warnings etc.) as we need to ensure that we never try to use the API when building from source.

@vincentisambart
Copy link

vincentisambart commented Feb 3, 2023

@MikeMcQuaid Today, a normal brew upgrade did upgrade some formulae that required building but this time everything went well... There might be an additional condition for the problem to appear (or some change in Homebrew itself might have fixed it). I still did a brew config and brew doctor: https://gist.github.com/vincentisambart/61284b0f4cd31ac7a04d5431a7ec1321

I should probably come back with brew config and brew doctor when the bug occurs again (if it does).

Update: Thinking more about it, it might have mainly happened not for patch version changes but only revision version changes (the ones that happen not when the package itself changed but when its dependencies do).

@MikeMcQuaid
Copy link
Member

@vincentisambart Thanks. I may have fixed the underlying issue here.

@miccal
Copy link
Contributor

miccal commented Feb 4, 2023

Possibly related?

#14505

sreya added a commit to coder/images that referenced this issue Feb 14, 2023
- There are some default libraries that contain test code that triggers
  our security scanners. Having homebrew installed should be sufficient
  for users. This will eventually be the default for all brew users anyway.
  See Homebrew/brew#13794 (comment)
sreya added a commit to coder/images that referenced this issue Feb 14, 2023
- There are some default libraries that contain test code that triggers
  our security scanners. Having homebrew installed should be sufficient
  for users. This will eventually be the default for all brew users anyway.
  See Homebrew/brew#13794 (comment)
- Update installed Go to 1.20
- Update Ruby to 2.7.7
- Update docker-compose to 2.16.0
@github-actions github-actions bot added the outdated PR was locked due to age label Mar 8, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
features New features in progress Maintainers are working on this install from api Relates to API installs outdated PR was locked due to age
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants