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

Improve shelling out to brew #1551

Merged
merged 1 commit into from
Jan 7, 2025
Merged

Improve shelling out to brew #1551

merged 1 commit into from
Jan 7, 2025

Conversation

MikeMcQuaid
Copy link
Member

@MikeMcQuaid MikeMcQuaid commented Jan 6, 2025

Add a Bundle.brew helper to DRY things up a bit.

@MikeMcQuaid MikeMcQuaid requested a review from Bo98 January 6, 2025 17:35
Copy link
Member

@Bo98 Bo98 left a comment

Choose a reason for hiding this comment

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

HOMEBREW_BREW_FILE is fairly common everywhere else (including in brew) so I wonder if we can handle that constant better somehow.

@carlocab
Copy link
Member

carlocab commented Jan 7, 2025

HOMEBREW_BREW_FILE is fairly common everywhere else (including in brew) so I wonder if we can handle that constant better somehow.

Yea, I wonder if we should try replacing HOMEBREW_BREW_FILE in brew instead/in addition.

@MikeMcQuaid
Copy link
Member Author

Yea, I wonder if we should try replacing HOMEBREW_BREW_FILE in brew instead/in addition.

Good idea, will take a look at that.

@MikeMcQuaid MikeMcQuaid marked this pull request as draft January 7, 2025 14:27
@carlocab
Copy link
Member

carlocab commented Jan 7, 2025

Yea, I wonder if we should try replacing HOMEBREW_BREW_FILE in brew instead/in addition.

Good idea, will take a look at that.

I already have a branch that does something like this, FYI.

MikeMcQuaid added a commit to Homebrew/brew that referenced this pull request Jan 7, 2025
Allow the ability for a system administrator to use
`HOMEBREW_BREW_WRAPPER` and `HOMEBREW_FORCE_BREW_WRAPPER` variables to
enforce the usage of a particular `brew` command for non-trivial (e.g.
`brew --prefix` is considered trivial, it doesn't need to write to the
prefix) Homebrew commands.

This also introduces a `HOMEBREW_ORIGINAL_BREW_FILE` variable for some
internal usage; `HOMEBREW_BREW_FILE` was being used internally for
both "how should we shell out to Homebrew" and "what should we use
to check permissions on Homebrew". `HOMEBREW_ORIGINAL_BREW_FILE` is
now used just for the latter case.

Inspired by conversation in
Homebrew/homebrew-bundle#1551 which suggested
this was worth fixing in wider than just `brew bundle`.
@MikeMcQuaid
Copy link
Member Author

Closing in favour of Homebrew/brew#19049

@MikeMcQuaid MikeMcQuaid closed this Jan 7, 2025
@MikeMcQuaid MikeMcQuaid deleted the use_original_brew branch January 7, 2025 16:30
@MikeMcQuaid MikeMcQuaid restored the use_original_brew branch January 7, 2025 16:31
@MikeMcQuaid MikeMcQuaid reopened this Jan 7, 2025
Add a `Bundle.brew` helper to DRY things up a bit.
@MikeMcQuaid MikeMcQuaid changed the title Use original brew from PATH Improve shelling out to brew Jan 7, 2025
@MikeMcQuaid MikeMcQuaid marked this pull request as ready for review January 7, 2025 16:33
@MikeMcQuaid
Copy link
Member Author

Actually, repurposed the refactoring here to make it a no-op and just DRY things up a bit.

@MikeMcQuaid MikeMcQuaid enabled auto-merge January 7, 2025 16:33
@MikeMcQuaid MikeMcQuaid merged commit e3e11e0 into master Jan 7, 2025
2 checks passed
@MikeMcQuaid MikeMcQuaid deleted the use_original_brew branch January 7, 2025 16:34
MikeMcQuaid added a commit to Homebrew/brew that referenced this pull request Jan 7, 2025
Allow the ability for a system administrator to use
`HOMEBREW_BREW_WRAPPER` and `HOMEBREW_FORCE_BREW_WRAPPER` variables to
enforce the usage of a particular `brew` command for non-trivial (e.g.
`brew --prefix` is considered trivial, it doesn't need to write to the
prefix) Homebrew commands.

This also introduces a `HOMEBREW_ORIGINAL_BREW_FILE` variable for some
internal usage; `HOMEBREW_BREW_FILE` was being used internally for
both "how should we shell out to Homebrew" and "what should we use
to check permissions on Homebrew". `HOMEBREW_ORIGINAL_BREW_FILE` is
now used just for the latter case.

Inspired by conversation in
Homebrew/homebrew-bundle#1551 which suggested
this was worth fixing in wider than just `brew bundle`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants