Skip to content

Commit

Permalink
Merge pull request #14686 from MikeMcQuaid/build_from_source_warnings
Browse files Browse the repository at this point in the history
Warn more when building from source
  • Loading branch information
MikeMcQuaid committed Feb 20, 2023
2 parents a222a5b + fbdec87 commit 25bf83e
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Library/Homebrew/brew.rb
Expand Up @@ -162,7 +162,7 @@
This build failure is expected behaviour.
Do not create issues about this on Homebrew's GitHub repositories.
Any opened issues will be immediately closed without response.
Do not ask for help from MacHomebrew on Twitter.
Do not ask for help from Homebrew or its maintainers on social media.
You may ask for help in Homebrew's discussions but are unlikely to receive a response.
Try to figure out the problem yourself and submit a fix as a pull request.
We will review it but may or may not accept it.
Expand Down
8 changes: 6 additions & 2 deletions Library/Homebrew/cmd/install.rb
Expand Up @@ -198,16 +198,20 @@ def install

# if the user's flags will prevent bottle only-installations when no
# developer tools are available, we need to stop them early on
build_flags = []
unless DevelopmentTools.installed?
build_flags = []

build_flags << "--HEAD" if args.HEAD?
build_flags << "--build-bottle" if args.build_bottle?
build_flags << "--build-from-source" if args.build_from_source?

raise BuildFlagsError.new(build_flags, bottled: formulae.all?(&:bottled?)) if build_flags.present?
end

if build_flags.present? && !Homebrew::EnvConfig.developer?
opoo "building from source is not supported!"
puts "You're on your own. Failures are expected so don't create any issues, please!"
end

installed_formulae = formulae.select do |f|
Install.install_formula?(
f,
Expand Down
11 changes: 9 additions & 2 deletions Library/Homebrew/cmd/reinstall.rb
Expand Up @@ -97,8 +97,15 @@ def reinstall
formulae, casks = args.named.to_formulae_and_casks(method: :resolve)
.partition { |o| o.is_a?(Formula) }

if args.build_from_source? && !DevelopmentTools.installed?
raise BuildFlagsError.new(["--build-from-source"], bottled: formulae.all?(&:bottled?))
if args.build_from_source?
unless DevelopmentTools.installed?
raise BuildFlagsError.new(["--build-from-source"], bottled: formulae.all?(&:bottled?))
end

unless Homebrew::EnvConfig.developer?
opoo "building from source is not supported!"
puts "You're on your own. Failures are expected so don't create any issues, please!"
end
end

Install.perform_preinstall_checks
Expand Down
11 changes: 9 additions & 2 deletions Library/Homebrew/cmd/upgrade.rb
Expand Up @@ -125,8 +125,15 @@ def upgrade
def upgrade_outdated_formulae(formulae, args:)
return false if args.cask?

if args.build_from_source? && !DevelopmentTools.installed?
raise BuildFlagsError.new(["--build-from-source"], bottled: formulae.all?(&:bottled?))
if args.build_from_source?
unless DevelopmentTools.installed?
raise BuildFlagsError.new(["--build-from-source"], bottled: formulae.all?(&:bottled?))
end

unless Homebrew::EnvConfig.developer?
opoo "building from source is not supported!"
puts "You're on your own. Failures are expected so don't create any issues, please!"
end
end

Install.perform_preinstall_checks
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/diagnostic.rb
Expand Up @@ -118,7 +118,7 @@ def please_create_pull_requests(what = "unsupported configuration")
Do not create any issues about this on Homebrew's GitHub repositories.
Do not create any issues even if you think this message is unrelated.
Any opened issues will be immediately closed without response.
Do not ask for help from MacHomebrew on Twitter.
Do not ask for help from Homebrew or its maintainers on social media.
You may ask for help in Homebrew's discussions but are unlikely to receive a response.
Try to figure out the problem yourself and submit a fix as a pull request.
We will review it but may or may not accept it.
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/formula_installer.rb
Expand Up @@ -274,7 +274,7 @@ def check_install_sanity
Do not create any issues about failures building from source on Homebrew's GitHub repositories.
Do not create any issues building from source even if you think this message is unrelated.
Any opened issues will be immediately closed without response.
Do not ask for help building from source from MacHomebrew on Twitter.
Do not ask for help from Homebrew or its maintainers on social media.
You may ask for help building from source in Homebrew's discussions but are unlikely to receive a response.
If building from source fails, try to figure out the problem yourself and submit a fix as a pull request.
We will review it but may or may not accept it.
Expand Down

0 comments on commit 25bf83e

Please sign in to comment.