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

Install formulae from JSON files #11648

Merged
merged 9 commits into from Jul 13, 2021
Merged

Conversation

Rylan12
Copy link
Member

@Rylan12 Rylan12 commented Jul 4, 2021

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

This PR incorporates the JSON functionality from homebrew/json into this repo. Now, if HOMEBREW_JSON_CORE is set, you can untap homebrew/core and install/reinstall/upgrade formulae using the default install, reinstall, and upgrade commands.

Additionally, brew outdated is now setup to work using the new versions API proposed in Homebrew/formulae.brew.sh#497 (so this PR should not be merged until the formulae.brew.sh one is merged). This will also mean that brew update will show the appropriate message if a formula is out of date, even without the homebrew/core tap installed.

@BrewTestBot
Copy link
Member

Review period will end on 2021-07-06 at 00:00:00 UTC.

1 similar comment
@BrewTestBot
Copy link
Member

Review period will end on 2021-07-06 at 00:00:00 UTC.

@BrewTestBot BrewTestBot added the waiting for feedback Merging is blocked until sufficient time has passed for review label Jul 4, 2021
@dawidd6
Copy link
Member

dawidd6 commented Jul 4, 2021

Could you explain the reasoning for this? Are we going to switch from git based taps to REST API ones? What about third-party taps?

@Rylan12
Copy link
Member Author

Rylan12 commented Jul 4, 2021

The idea is that users shouldn't need to have homebrew/core (and probably homebrew/cask, eventually) tapped in order to install a formula (or cask). These repos are huge and annoying to update, so it slows down brew update a lot to have them tapped. Instead, we can use the /api/bottle/{FORMULA}.json API from https://formulae.brew.sh to download formula bottles and use the embedded formula files to install the formula.

Third party taps would still need to be installed locally, and this wouldn't remove the need for HOMEBREW_DEVELOPERs and devcmdrun users to have a full clone, but for the average user it's designed to reduce Homebrew's disk usage and speed up Homebrew updates.

I don't know about the future, I don't think we're planning on totally scrapping git-based taps any time soon (although @MikeMcQuaid may have a different vision). I could see us creating a way for third-party taps to use this API-based install process but for the moment, its designed just for homebrew/core.

@MikeMcQuaid
Copy link
Member

I don't know about the future, I don't think we're planning on totally scrapping git-based taps any time soon (although @MikeMcQuaid may have a different vision).

No, I don't have any plans personally to ever do this. As you've mentioned, this approach is pretty much just for homebrew-core and homebrew-cask (and would be for linuxbrew-core were we not so close to the migration) because:

  1. they are expensive to git fetch and git clone and GitHub would rather we didn't do that
  2. they are slow to git fetch and git clone and this provides a bad experience to end users
  3. we auto-run brew update in many cases and the (by far) slowest part of this is git fetch on homebrew-core and homebrew-cask

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.

Looking great! A few comments.

Library/Homebrew/utils/bottle_api.rb Outdated Show resolved Hide resolved
Library/Homebrew/utils/bottle_api.rb Outdated Show resolved Hide resolved
Library/Homebrew/utils/bottle_api.rb Outdated Show resolved Hide resolved
@BrewTestBot BrewTestBot removed the waiting for feedback Merging is blocked until sufficient time has passed for review label Jul 6, 2021
@BrewTestBot
Copy link
Member

Review period ended.

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.

Some suggested/optional tweaks (that may not be needed if I've misunderstood). Merge when you're happy! Great work as usual.

Library/Homebrew/cmd/outdated.rb Outdated Show resolved Hide resolved
Library/Homebrew/formula.rb Outdated Show resolved Hide resolved
Library/Homebrew/cmd/outdated.rb Outdated Show resolved Hide resolved
Library/Homebrew/bottle_api.rb Show resolved Hide resolved
Library/Homebrew/cli/named_args.rb Outdated Show resolved Hide resolved
@Rylan12
Copy link
Member Author

Rylan12 commented Jul 12, 2021

My latest push adds tests for the BottleAPI class and changes the prioritization so that installing from a JSON file is preferred even if homebrew/core is tapped (as long as HOMEBREW_JSON_CORE is set).

To-do items for future PRs:

  • Don't have brew update update homebrew/core if the env variable is set and it's auto-run
  • Have brew info show the latest version info instead of whatever is tapped locally
  • Don't have brew install, brew reinstall, and brew upgrade download bottles for every dependency unless the dependency is already installed (and at the latest version)
  • Create command to un-dev-cmd yourself

@Rylan12 Rylan12 enabled auto-merge July 13, 2021 06:29
@Rylan12 Rylan12 merged commit e344cb6 into Homebrew:master Jul 13, 2021
@Rylan12 Rylan12 deleted the homebrew-json branch July 13, 2021 06:54
@github-actions github-actions bot added the outdated PR was locked due to age label Aug 14, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants