From 7504d830cb7ba8617ab4adc4468239c8c71fa5a7 Mon Sep 17 00:00:00 2001 From: Justin Baugh Date: Thu, 20 Jul 2017 11:08:53 -0400 Subject: [PATCH 1/6] Add warning to doctor if HOMEBREW_BUILD_FROM_SOURCE is set. --- Library/Homebrew/diagnostic.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index a5adfeb63a..f5e07ac2fc 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -98,6 +98,17 @@ module Homebrew EOS end + def check_build_from_source + return if !ENV.has_key?("HOMEBREW_BUILD_FROM_SOURCE") + + <<-EOS.undent + You have HOMEBREW_BUILD_FROM_SOURCE set. This environment variable is + intended for use by Homebrew developers. If you are encountering errors, + please try unsetting this. Please do not file issues if you encounter + errors when using this environment variable. + EOS + end + # See https://github.com/Homebrew/legacy-homebrew/pull/9986 def check_path_for_trailing_slashes bad_paths = PATH.new(ENV["HOMEBREW_PATH"]).select { |p| p.end_with?("/") } From dd334a8357bc47bfb88e40bd9d3b92e454a259fb Mon Sep 17 00:00:00 2001 From: Justin Baugh Date: Thu, 20 Jul 2017 11:18:16 -0400 Subject: [PATCH 2/6] Add updated diagnostic test for build from source check. --- Library/Homebrew/test/diagnostic_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Library/Homebrew/test/diagnostic_spec.rb b/Library/Homebrew/test/diagnostic_spec.rb index 058b9823ca..8a25413ed4 100644 --- a/Library/Homebrew/test/diagnostic_spec.rb +++ b/Library/Homebrew/test/diagnostic_spec.rb @@ -12,6 +12,12 @@ describe Homebrew::Diagnostic::Checks do .to match("Some directories in your path end in a slash") end + specify "#check_build_from_source" do + ENV["HOMEBREW_BUILD_FROM_SOURCE"] = "1" + expect(subject.check_build_from_source) + .to match("You have HOMEBREW_BUILD_FROM_SOURCE set.") + end + specify "#check_for_anaconda" do mktmpdir do |path| anaconda = "#{path}/anaconda" From e077bfe6555f0e7ab10bf1f52f815e57607d040e Mon Sep 17 00:00:00 2001 From: Justin Baugh Date: Thu, 20 Jul 2017 11:57:43 -0400 Subject: [PATCH 3/6] Address rubocop issues --- Library/Homebrew/diagnostic.rb | 2 +- docs/FAQ.md | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index f5e07ac2fc..e6fecb4787 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -99,7 +99,7 @@ module Homebrew end def check_build_from_source - return if !ENV.has_key?("HOMEBREW_BUILD_FROM_SOURCE") + return unless ENV.key?("HOMEBREW_BUILD_FROM_SOURCE") <<-EOS.undent You have HOMEBREW_BUILD_FROM_SOURCE set. This environment variable is diff --git a/docs/FAQ.md b/docs/FAQ.md index 4fe11530e0..5dafaac192 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -89,16 +89,11 @@ 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 environment 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 standard `/usr/local` (although some bottles support this). -In order to completely disable bottled builds, simply add a value for -the environment variable `HOMEBREW_BUILD_FROM_SOURCE` to -your profile. - We aim to bottle everything. ## How do I get a formula from someone else’s branch? From 0a9de6b8a60252dc25fe1932666ab0de1850e060 Mon Sep 17 00:00:00 2001 From: Justin Baugh Date: Thu, 20 Jul 2017 14:44:20 -0400 Subject: [PATCH 4/6] Update source check to match style --- Library/Homebrew/diagnostic.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index e6fecb4787..36a0d83a7e 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -99,7 +99,7 @@ module Homebrew end def check_build_from_source - return unless ENV.key?("HOMEBREW_BUILD_FROM_SOURCE") + return unless ENV("HOMEBREW_BUILD_FROM_SOURCE") <<-EOS.undent You have HOMEBREW_BUILD_FROM_SOURCE set. This environment variable is From 2899132e522b604a1bebfb67eaefbc1145c5b86b Mon Sep 17 00:00:00 2001 From: Justin Baugh Date: Thu, 20 Jul 2017 14:46:35 -0400 Subject: [PATCH 5/6] Update FAQ to indicate HOMEBREW_BUILD_FROM_SOURCE can still be set --- docs/FAQ.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/FAQ.md b/docs/FAQ.md index 5dafaac192..23f53d54ce 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -89,6 +89,8 @@ 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 environment variable `HOMEBREW_BUILD_FROM_SOURCE` is set +(intended for developers only). * 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 standard From bd06a7926cbcdeb8d8d80f6eb46b5bde27b365e4 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 20 Jul 2017 20:02:34 +0100 Subject: [PATCH 6/6] diagnostic: use ENV[] --- Library/Homebrew/diagnostic.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 36a0d83a7e..ceb6ad4d1d 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -99,7 +99,7 @@ module Homebrew end def check_build_from_source - return unless ENV("HOMEBREW_BUILD_FROM_SOURCE") + return unless ENV["HOMEBREW_BUILD_FROM_SOURCE"] <<-EOS.undent You have HOMEBREW_BUILD_FROM_SOURCE set. This environment variable is