From 952f95f1090580a7cf7df699b9ac29df895e578b Mon Sep 17 00:00:00 2001 From: Bryce Glover Date: Tue, 3 Nov 2020 18:38:16 -0500 Subject: [PATCH] Reintroduce and adapt commit `49aceb152`. Account for differences between upstream versions 1.9.3 and 3.3.3 (the latter being the latest stable one upstream as of this commit,) namely with respect to how argument parsing is implemented. --- Summary of old changes prior to manual rebase/adaptation: brew.rb: Undeprecate `HOMEBREW_BUILD_FROM_SOURCE`. Partially revert Homebrew/brew#5477. --- Additionally, restore and/or add documentation relevant to this environment va- riable. **IMPORTANT NOTE!!!**: _Neither this commit nor the one it's based on restores or restored the funcitonality which setting `HOMEBREW_BUILD_FROM_SOURCE` trig- gered before that got removed later!_ This shortcoming will be addressed in the future in one or more commits. --- Library/Homebrew/cmd/install.rb | 4 ++++ Library/Homebrew/cmd/reinstall.rb | 4 ++++ Library/Homebrew/cmd/upgrade.rb | 4 ++++ Library/Homebrew/env_config.rb | 6 ++++++ docs/FAQ.md | 1 + docs/Manpage.md | 15 +++++++++++++++ manpages/brew.1 | 13 +++++++++++++ 7 files changed, 47 insertions(+) diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 0b4f433b1d5c8d..f2de2bbe97f44a 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -27,6 +27,10 @@ def install_args Install a or . Additional options specific to a may be appended to the command. + If `HOMEBREW_BUILD_FROM_SOURCE` is set, then both and any dependencies installed while + installing it are built from source even if bottles are available for them, regardless of whether + `--build-from-source` was passed or not. + Unless `HOMEBREW_NO_INSTALL_CLEANUP` is set, `brew cleanup` will then be run for the installed formulae or, every 30 days, for all formulae. EOS diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb index c29675f3f77d43..7e7325ce123ed7 100644 --- a/Library/Homebrew/cmd/reinstall.rb +++ b/Library/Homebrew/cmd/reinstall.rb @@ -26,6 +26,10 @@ def reinstall_args Uninstall and then reinstall a or using the same options it was originally installed with, plus any appended options specific to a . + If `HOMEBREW_BUILD_FROM_SOURCE` is set, then both and any dependencies reinstalled while + reinstalling it are built from source even if bottles are available for them, regardless of whether + `--build-from-source` was passed or not. + Unless `HOMEBREW_NO_INSTALL_CLEANUP` is set, `brew cleanup` will then be run for the reinstalled formulae or, every 30 days, for all formulae. EOS diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index 6c4514acd18fdd..e651b2fc00bded 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -23,6 +23,10 @@ def upgrade_args installed with, plus any appended brew formula options. If or are specified, upgrade only the given or kegs (unless they are pinned; see `pin`, `unpin`). + If `HOMEBREW_BUILD_FROM_SOURCE` is set, then both and any dependencies upgraded while + upgrading it are built from source even if bottles are available for them, regardless of whether + `--build-from-source` was passed or not. + Unless `HOMEBREW_NO_INSTALL_CLEANUP` is set, `brew cleanup` will then be run for the upgraded formulae or, every 30 days, for all formulae. EOS diff --git a/Library/Homebrew/env_config.rb b/Library/Homebrew/env_config.rb index 007b80a302709f..e4cce245c481d0 100644 --- a/Library/Homebrew/env_config.rb +++ b/Library/Homebrew/env_config.rb @@ -61,6 +61,12 @@ module EnvConfig description: "Use this as the browser when opening project homepages.", default_text: "`$BROWSER` or the OS's default browser.", }, + HOMEBREW_BUILD_FROM_SOURCE: { + description: "If set, then all supplied formulae, along with their (recursive) dependencies, are built " \ + "from source even if bottles are available for them, regardless of whether " \ + "`--build-from-source` was passed or not.", + boolean: true, + }, HOMEBREW_CACHE: { description: "Use this directory as the download cache.", default_text: "macOS: `$HOME/Library/Caches/Homebrew`, " \ diff --git a/docs/FAQ.md b/docs/FAQ.md index 15b08e60b091bf..2a0ec47a73fb58 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -72,6 +72,7 @@ following conditions: will use a bottled version of the formula, but `brew install --enable-bar ` will trigger a source build. * The `--build-from-source` option is invoked. +* The environement variable `HOMEBREW_BUILD_FROM_SOURCE` is set. * The machine is not running a supported version of macOS as all bottled builds are generated only for supported macOS versions. * Homebrew is installed to a prefix other than the default diff --git a/docs/Manpage.md b/docs/Manpage.md index 3163a3ce7afe90..e3c511c53c7330 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -297,6 +297,10 @@ If a *`formula`* or *`cask`* is provided, show summary of information about it. Install a *`formula`* or *`cask`*. Additional options specific to a *`formula`* may be appended to the command. +If `HOMEBREW_BUILD_FROM_SOURCE` is set, then both *`formula`* and any dependencies installed while +installing it are built from source even if bottles are available for them, regardless of whether +`--build-from-source` was passed or not. + Unless `HOMEBREW_NO_INSTALL_CLEANUP` is set, `brew cleanup` will then be run for the installed formulae or, every 30 days, for all formulae. @@ -503,6 +507,10 @@ all items or checking if any current formulae/casks have Ruby issues. Uninstall and then reinstall a *`formula`* or *`cask`* using the same options it was originally installed with, plus any appended options specific to a *`formula`*. +If `HOMEBREW_BUILD_FROM_SOURCE` is set, then both *`formula`* and any dependencies reinstalled while +reinstalling it are built from source even if bottles are available for them, regardless of whether +`--build-from-source` was passed or not. + Unless `HOMEBREW_NO_INSTALL_CLEANUP` is set, `brew cleanup` will then be run for the reinstalled formulae or, every 30 days, for all formulae. @@ -679,6 +687,10 @@ Upgrade outdated casks and outdated, unpinned formulae using the same options th installed with, plus any appended brew formula options. If *`cask`* or *`formula`* are specified, upgrade only the given *`cask`* or *`formula`* kegs (unless they are pinned; see `pin`, `unpin`). +If `HOMEBREW_BUILD_FROM_SOURCE` is set, then both *`formula`* and any dependencies upgraded while +upgrading it are built from source even if bottles are available for them, regardless of whether +`--build-from-source` was passed or not. + Unless `HOMEBREW_NO_INSTALL_CLEANUP` is set, `brew cleanup` will then be run for the upgraded formulae or, every 30 days, for all formulae. @@ -1924,6 +1936,9 @@ example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just *Default:* `$BROWSER` or the OS's default browser. + * `HOMEBREW_BUILD_FROM_SOURCE`: + If set, then all supplied formulae, along with their (recursive) dependencies, are built from source even if bottles are available for them, regardless of whether `--build-from-source` was passed or not. + - `HOMEBREW_CACHE`
Use this directory as the download cache. diff --git a/manpages/brew.1 b/manpages/brew.1 index 3830731697f202..36cc075be314a3 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -381,6 +381,9 @@ Treat all named arguments as casks\. Install a \fIformula\fR or \fIcask\fR\. Additional options specific to a \fIformula\fR may be appended to the command\. . .P +If \fBHOMEBREW_BUILD_FROM_SOURCE\fR is set, then both \fIformula\fR and any dependencies installed while installing it are built from source even if bottles are available for them, regardless of whether \fB\-\-build\-from\-source\fR was passed or not\. +. +.P Unless \fBHOMEBREW_NO_INSTALL_CLEANUP\fR is set, \fBbrew cleanup\fR will then be run for the installed formulae or, every 30 days, for all formulae\. . .TP @@ -683,6 +686,9 @@ Syntax\-check all of Homebrew\'s Ruby files (if no \fB\fR is passed)\. Uninstall and then reinstall a \fIformula\fR or \fIcask\fR using the same options it was originally installed with, plus any appended options specific to a \fIformula\fR\. . .P +If \fBHOMEBREW_BUILD_FROM_SOURCE\fR is set, then both \fIformula\fR and any dependencies reinstalled while reinstalling it are built from source even if bottles are available for them, regardless of whether \fB\-\-build\-from\-source\fR was passed or not\. +. +.P Unless \fBHOMEBREW_NO_INSTALL_CLEANUP\fR is set, \fBbrew cleanup\fR will then be run for the reinstalled formulae or, every 30 days, for all formulae\. . .TP @@ -925,6 +931,9 @@ Fetch and reset Homebrew and all tap repositories (or any specified \fIrepositor Upgrade outdated casks and outdated, unpinned formulae using the same options they were originally installed with, plus any appended brew formula options\. If \fIcask\fR or \fIformula\fR are specified, upgrade only the given \fIcask\fR or \fIformula\fR kegs (unless they are pinned; see \fBpin\fR, \fBunpin\fR)\. . .P +If \fBHOMEBREW_BUILD_FROM_SOURCE\fR is set, then both \fIformula\fR and any dependencies upgraded while upgrading it are built from source even if bottles are available for them, regardless of whether \fB\-\-build\-from\-source\fR was passed or not\. +. +.P Unless \fBHOMEBREW_NO_INSTALL_CLEANUP\fR is set, \fBbrew cleanup\fR will then be run for the upgraded formulae or, every 30 days, for all formulae\. . .TP @@ -2730,6 +2739,10 @@ Use this as the browser when opening project homepages\. \fIDefault:\fR \fB$BROWSER\fR or the OS\'s default browser\. . .TP +\fBHOMEBREW_BUILD_FROM_SOURCE\fR +If set, then all supplied formulae, along with their (recursive) dependencies, are built from source even if bottles are available for them, regardless of whether \fB\-\-build\-from\-source\fR was passed or not\. +. +.TP \fBHOMEBREW_CACHE\fR . .br