Skip to content

Commit

Permalink
Merge pull request #17841 from Homebrew/debrew-disable
Browse files Browse the repository at this point in the history
  • Loading branch information
carlocab authored Jul 24, 2024
2 parents 8e8ce4a + 93dbb95 commit cfb4bf7
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 3 deletions.
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

0 comments on commit cfb4bf7

Please sign in to comment.