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

Add env to disable Debrew #17841

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Library/Homebrew/build.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def install
}

with_env(new_env) do
if args.debug?
if args.debug? && !Homebrew::EnvConfig.disable_debrew?
require "debrew"
formula.extend(Debrew::Formula)
end
Expand Down
4 changes: 4 additions & 0 deletions Library/Homebrew/env_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ module EnvConfig
"budding) by e.g. turning warnings into errors.",
boolean: true,
},
HOMEBREW_DISABLE_DEBREW: {
description: "If set, the interactive formula debugger available via `--debug` will be disabled.",
boolean: true,
},
HOMEBREW_DISABLE_LOAD_FORMULA: {
description: "If set, refuse to load formulae. This is useful when formulae are not trusted (such " \
"as in pull requests).",
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/postinstall.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
trap("INT", old_trap)

formula = T.must(args.named.to_resolved_formulae.first)
if args.debug?
if args.debug? && !Homebrew::EnvConfig.disable_debrew?
require "debrew"
formula.extend(Debrew::Formula)
end
Expand Down
3 changes: 3 additions & 0 deletions Library/Homebrew/sorbet/rbi/dsl/homebrew/env_config.rbi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Library/Homebrew/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
formula = T.must(args.named.to_resolved_formulae.first)
formula.extend(Homebrew::Assertions)
formula.extend(Homebrew::FreePort)
if args.debug?
if args.debug? && !Homebrew::EnvConfig.disable_debrew?
require "debrew"
formula.extend(Debrew::Formula)
end
Expand Down
5 changes: 5 additions & 0 deletions docs/Manpage.md
Original file line number Diff line number Diff line change
Expand Up @@ -3691,6 +3691,11 @@ command execution e.g. `$(cat file)`.
: If set, tweak behaviour to be more relevant for Homebrew developers (active or
budding) by e.g. turning warnings into errors.

`HOMEBREW_DISABLE_DEBREW`

: If set, the interactive formula debugger available via `--debug` will be
disabled.

`HOMEBREW_DISABLE_LOAD_FORMULA`

: If set, refuse to load formulae. This is useful when formulae are not trusted
Expand Down
3 changes: 3 additions & 0 deletions manpages/brew.1
Original file line number Diff line number Diff line change
Expand Up @@ -2395,6 +2395,9 @@ If set, always assume \fB\-\-debug\fP when running commands\.
\fBHOMEBREW_DEVELOPER\fP
If set, tweak behaviour to be more relevant for Homebrew developers (active or budding) by e\.g\. turning warnings into errors\.
.TP
\fBHOMEBREW_DISABLE_DEBREW\fP
If set, the interactive formula debugger available via \fB\-\-debug\fP will be disabled\.
.TP
\fBHOMEBREW_DISABLE_LOAD_FORMULA\fP
If set, refuse to load formulae\. This is useful when formulae are not trusted (such as in pull requests)\.
.TP
Expand Down
Loading