Merge pull request #15042 from MikeMcQuaid/skip_post_install

Add `brew install --skip-post-install`
This commit is contained in:
Mike McQuaid 2023-03-23 15:37:06 +00:00 committed by GitHub
commit c31da2b3c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 30 additions and 4 deletions

View File

@ -98,6 +98,9 @@ module Homebrew
description: "Prepare the formula for eventual bottling during installation, skipping any " \ description: "Prepare the formula for eventual bottling during installation, skipping any " \
"post-install steps.", "post-install steps.",
}], }],
[:switch, "--skip-post-install", {
description: "Install but skip any post-install steps.",
}],
[:flag, "--bottle-arch=", { [:flag, "--bottle-arch=", {
depends_on: "--build-bottle", depends_on: "--build-bottle",
description: "Optimise bottles for the specified architecture rather than the oldest " \ description: "Optimise bottles for the specified architecture rather than the oldest " \

View File

@ -49,6 +49,7 @@ class FormulaInstaller
installed_on_request: true, installed_on_request: true,
show_header: false, show_header: false,
build_bottle: false, build_bottle: false,
skip_post_install: false,
force_bottle: false, force_bottle: false,
bottle_arch: nil, bottle_arch: nil,
ignore_deps: false, ignore_deps: false,
@ -80,6 +81,7 @@ class FormulaInstaller
@only_deps = only_deps @only_deps = only_deps
@build_from_source_formulae = build_from_source_formulae @build_from_source_formulae = build_from_source_formulae
@build_bottle = build_bottle @build_bottle = build_bottle
@skip_post_install = skip_post_install
@bottle_arch = bottle_arch @bottle_arch = bottle_arch
@formula.force_bottle ||= force_bottle @formula.force_bottle ||= force_bottle
@force_bottle = @formula.force_bottle @force_bottle = @formula.force_bottle
@ -140,6 +142,11 @@ class FormulaInstaller
@build_bottle.present? @build_bottle.present?
end end
sig { returns(T::Boolean) }
def skip_post_install?
@skip_post_install.present?
end
sig { params(output_warning: T::Boolean).returns(T::Boolean) } sig { params(output_warning: T::Boolean).returns(T::Boolean) }
def pour_bottle?(output_warning: false) def pour_bottle?(output_warning: false)
return false if !formula.bottle_tag? && !formula.local_bottle_path return false if !formula.bottle_tag? && !formula.local_bottle_path
@ -782,8 +789,12 @@ on_request: installed_on_request?, options: options)
Homebrew::Install.global_post_install Homebrew::Install.global_post_install
if build_bottle? if build_bottle? || skip_post_install?
ohai "Not running 'post_install' as we're building a bottle" if build_bottle?
ohai "Not running 'post_install' as we're building a bottle"
elsif skip_post_install?
ohai "Skipping 'post_install' on request"
end
puts "You can run it manually using:" puts "You can run it manually using:"
puts " brew postinstall #{formula.full_name}" puts " brew postinstall #{formula.full_name}"
else else

View File

@ -1178,6 +1178,7 @@ _brew_instal() {
--screen-saverdir --screen-saverdir
--servicedir --servicedir
--skip-cask-deps --skip-cask-deps
--skip-post-install
--verbose --verbose
--vst-plugindir --vst-plugindir
--vst3-plugindir --vst3-plugindir
@ -1239,6 +1240,7 @@ _brew_install() {
--screen-saverdir --screen-saverdir
--servicedir --servicedir
--skip-cask-deps --skip-cask-deps
--skip-post-install
--verbose --verbose
--vst-plugindir --vst-plugindir
--vst3-plugindir --vst3-plugindir

View File

@ -848,6 +848,7 @@ __fish_brew_complete_arg 'instal' -l require-sha -d 'Require all casks to have a
__fish_brew_complete_arg 'instal' -l screen-saverdir -d 'Target location for Screen Savers (default: `~/Library/Screen Savers`)' __fish_brew_complete_arg 'instal' -l screen-saverdir -d 'Target location for Screen Savers (default: `~/Library/Screen Savers`)'
__fish_brew_complete_arg 'instal' -l servicedir -d 'Target location for Services (default: `~/Library/Services`)' __fish_brew_complete_arg 'instal' -l servicedir -d 'Target location for Services (default: `~/Library/Services`)'
__fish_brew_complete_arg 'instal' -l skip-cask-deps -d 'Skip installing cask dependencies' __fish_brew_complete_arg 'instal' -l skip-cask-deps -d 'Skip installing cask dependencies'
__fish_brew_complete_arg 'instal' -l skip-post-install -d 'Install but skip any post-install steps'
__fish_brew_complete_arg 'instal' -l verbose -d 'Print the verification and postinstall steps' __fish_brew_complete_arg 'instal' -l verbose -d 'Print the verification and postinstall steps'
__fish_brew_complete_arg 'instal' -l vst-plugindir -d 'Target location for VST Plugins (default: `~/Library/Audio/Plug-Ins/VST`)' __fish_brew_complete_arg 'instal' -l vst-plugindir -d 'Target location for VST Plugins (default: `~/Library/Audio/Plug-Ins/VST`)'
__fish_brew_complete_arg 'instal' -l vst3-plugindir -d 'Target location for VST3 Plugins (default: `~/Library/Audio/Plug-Ins/VST3`)' __fish_brew_complete_arg 'instal' -l vst3-plugindir -d 'Target location for VST3 Plugins (default: `~/Library/Audio/Plug-Ins/VST3`)'
@ -900,6 +901,7 @@ __fish_brew_complete_arg 'install' -l require-sha -d 'Require all casks to have
__fish_brew_complete_arg 'install' -l screen-saverdir -d 'Target location for Screen Savers (default: `~/Library/Screen Savers`)' __fish_brew_complete_arg 'install' -l screen-saverdir -d 'Target location for Screen Savers (default: `~/Library/Screen Savers`)'
__fish_brew_complete_arg 'install' -l servicedir -d 'Target location for Services (default: `~/Library/Services`)' __fish_brew_complete_arg 'install' -l servicedir -d 'Target location for Services (default: `~/Library/Services`)'
__fish_brew_complete_arg 'install' -l skip-cask-deps -d 'Skip installing cask dependencies' __fish_brew_complete_arg 'install' -l skip-cask-deps -d 'Skip installing cask dependencies'
__fish_brew_complete_arg 'install' -l skip-post-install -d 'Install but skip any post-install steps'
__fish_brew_complete_arg 'install' -l verbose -d 'Print the verification and postinstall steps' __fish_brew_complete_arg 'install' -l verbose -d 'Print the verification and postinstall steps'
__fish_brew_complete_arg 'install' -l vst-plugindir -d 'Target location for VST Plugins (default: `~/Library/Audio/Plug-Ins/VST`)' __fish_brew_complete_arg 'install' -l vst-plugindir -d 'Target location for VST Plugins (default: `~/Library/Audio/Plug-Ins/VST`)'
__fish_brew_complete_arg 'install' -l vst3-plugindir -d 'Target location for VST3 Plugins (default: `~/Library/Audio/Plug-Ins/VST3`)' __fish_brew_complete_arg 'install' -l vst3-plugindir -d 'Target location for VST3 Plugins (default: `~/Library/Audio/Plug-Ins/VST3`)'

View File

@ -1041,6 +1041,7 @@ _brew_instal() {
'(--formula)--screen-saverdir[Target location for Screen Savers (default: `~/Library/Screen Savers`)]' \ '(--formula)--screen-saverdir[Target location for Screen Savers (default: `~/Library/Screen Savers`)]' \
'(--formula)--servicedir[Target location for Services (default: `~/Library/Services`)]' \ '(--formula)--servicedir[Target location for Services (default: `~/Library/Services`)]' \
'(--formula)--skip-cask-deps[Skip installing cask dependencies]' \ '(--formula)--skip-cask-deps[Skip installing cask dependencies]' \
'(--cask)--skip-post-install[Install but skip any post-install steps]' \
'--verbose[Print the verification and postinstall steps]' \ '--verbose[Print the verification and postinstall steps]' \
'(--formula)--vst-plugindir[Target location for VST Plugins (default: `~/Library/Audio/Plug-Ins/VST`)]' \ '(--formula)--vst-plugindir[Target location for VST Plugins (default: `~/Library/Audio/Plug-Ins/VST`)]' \
'(--formula)--vst3-plugindir[Target location for VST3 Plugins (default: `~/Library/Audio/Plug-Ins/VST3`)]' \ '(--formula)--vst3-plugindir[Target location for VST3 Plugins (default: `~/Library/Audio/Plug-Ins/VST3`)]' \
@ -1049,7 +1050,7 @@ _brew_instal() {
'(--casks --binaries --require-sha --quarantine --adopt --skip-cask-deps --zap --appdir --colorpickerdir --prefpanedir --qlplugindir --mdimporterdir --dictionarydir --fontdir --servicedir --input-methoddir --internet-plugindir --audio-unit-plugindir --vst-plugindir --vst3-plugindir --screen-saverdir --language)--formula[Treat all named arguments as formulae]' \ '(--casks --binaries --require-sha --quarantine --adopt --skip-cask-deps --zap --appdir --colorpickerdir --prefpanedir --qlplugindir --mdimporterdir --dictionarydir --fontdir --servicedir --input-methoddir --internet-plugindir --audio-unit-plugindir --vst-plugindir --vst3-plugindir --screen-saverdir --language)--formula[Treat all named arguments as formulae]' \
'*::formula:__brew_formulae' \ '*::formula:__brew_formulae' \
- cask \ - cask \
'(--formulae --env --ignore-dependencies --only-dependencies --cc --build-from-source --force-bottle --include-test --HEAD --fetch-HEAD --keep-tmp --debug-symbols --build-bottle --bottle-arch --display-times --interactive --git --overwrite)--cask[Treat all named arguments as casks]' \ '(--formulae --env --ignore-dependencies --only-dependencies --cc --build-from-source --force-bottle --include-test --HEAD --fetch-HEAD --keep-tmp --debug-symbols --build-bottle --skip-post-install --bottle-arch --display-times --interactive --git --overwrite)--cask[Treat all named arguments as casks]' \
'*::cask:__brew_casks' '*::cask:__brew_casks'
} }
@ -1097,6 +1098,7 @@ _brew_install() {
'(--formula)--screen-saverdir[Target location for Screen Savers (default: `~/Library/Screen Savers`)]' \ '(--formula)--screen-saverdir[Target location for Screen Savers (default: `~/Library/Screen Savers`)]' \
'(--formula)--servicedir[Target location for Services (default: `~/Library/Services`)]' \ '(--formula)--servicedir[Target location for Services (default: `~/Library/Services`)]' \
'(--formula)--skip-cask-deps[Skip installing cask dependencies]' \ '(--formula)--skip-cask-deps[Skip installing cask dependencies]' \
'(--cask)--skip-post-install[Install but skip any post-install steps]' \
'--verbose[Print the verification and postinstall steps]' \ '--verbose[Print the verification and postinstall steps]' \
'(--formula)--vst-plugindir[Target location for VST Plugins (default: `~/Library/Audio/Plug-Ins/VST`)]' \ '(--formula)--vst-plugindir[Target location for VST Plugins (default: `~/Library/Audio/Plug-Ins/VST`)]' \
'(--formula)--vst3-plugindir[Target location for VST3 Plugins (default: `~/Library/Audio/Plug-Ins/VST3`)]' \ '(--formula)--vst3-plugindir[Target location for VST3 Plugins (default: `~/Library/Audio/Plug-Ins/VST3`)]' \
@ -1105,7 +1107,7 @@ _brew_install() {
'(--casks --binaries --require-sha --quarantine --adopt --skip-cask-deps --zap --appdir --colorpickerdir --prefpanedir --qlplugindir --mdimporterdir --dictionarydir --fontdir --servicedir --input-methoddir --internet-plugindir --audio-unit-plugindir --vst-plugindir --vst3-plugindir --screen-saverdir --language)--formula[Treat all named arguments as formulae]' \ '(--casks --binaries --require-sha --quarantine --adopt --skip-cask-deps --zap --appdir --colorpickerdir --prefpanedir --qlplugindir --mdimporterdir --dictionarydir --fontdir --servicedir --input-methoddir --internet-plugindir --audio-unit-plugindir --vst-plugindir --vst3-plugindir --screen-saverdir --language)--formula[Treat all named arguments as formulae]' \
'*::formula:__brew_formulae' \ '*::formula:__brew_formulae' \
- cask \ - cask \
'(--formulae --env --ignore-dependencies --only-dependencies --cc --build-from-source --force-bottle --include-test --HEAD --fetch-HEAD --keep-tmp --debug-symbols --build-bottle --bottle-arch --display-times --interactive --git --overwrite)--cask[Treat all named arguments as casks]' \ '(--formulae --env --ignore-dependencies --only-dependencies --cc --build-from-source --force-bottle --include-test --HEAD --fetch-HEAD --keep-tmp --debug-symbols --build-bottle --skip-post-install --bottle-arch --display-times --interactive --git --overwrite)--cask[Treat all named arguments as casks]' \
'*::cask:__brew_casks' '*::cask:__brew_casks'
} }

View File

@ -352,6 +352,8 @@ is already installed but outdated.
Generate debug symbols on build. Source will be retained in a cache directory. Generate debug symbols on build. Source will be retained in a cache directory.
* `--build-bottle`: * `--build-bottle`:
Prepare the formula for eventual bottling during installation, skipping any post-install steps. Prepare the formula for eventual bottling during installation, skipping any post-install steps.
* `--skip-post-install`:
Install but skip any post-install steps.
* `--bottle-arch`: * `--bottle-arch`:
Optimise bottles for the specified architecture rather than the oldest architecture supported by the version of macOS the bottles are built on. Optimise bottles for the specified architecture rather than the oldest architecture supported by the version of macOS the bottles are built on.
* `--display-times`: * `--display-times`:

View File

@ -480,6 +480,10 @@ Generate debug symbols on build\. Source will be retained in a cache directory\.
Prepare the formula for eventual bottling during installation, skipping any post\-install steps\. Prepare the formula for eventual bottling during installation, skipping any post\-install steps\.
. .
.TP .TP
\fB\-\-skip\-post\-install\fR
Install but skip any post\-install steps\.
.
.TP
\fB\-\-bottle\-arch\fR \fB\-\-bottle\-arch\fR
Optimise bottles for the specified architecture rather than the oldest architecture supported by the version of macOS the bottles are built on\. Optimise bottles for the specified architecture rather than the oldest architecture supported by the version of macOS the bottles are built on\.
. .