Merge pull request #2919 from baughj/add-check-for-build-from-source

Add check for build from source
This commit is contained in:
Mike McQuaid 2017-07-21 09:06:50 +01:00 committed by GitHub
commit e0560ff363
3 changed files with 19 additions and 5 deletions

View File

@ -98,6 +98,17 @@ module Homebrew
EOS
end
def check_build_from_source
return unless ENV["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?("/") }

View File

@ -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"

View File

@ -89,16 +89,13 @@ following conditions:
will use a bottled version of the formula, but
`brew install <formula> --enable-bar` will trigger a source build.
* The `--build-from-source` option is invoked.
* The environment variable `HOMEBREW_BUILD_FROM_SOURCE` is set.
* 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
`/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 elses branch?