diff --git a/Library/Homebrew/bottle_publisher.rb b/Library/Homebrew/bottle_publisher.rb index 9911f99235..92a4e82aeb 100644 --- a/Library/Homebrew/bottle_publisher.rb +++ b/Library/Homebrew/bottle_publisher.rb @@ -28,10 +28,10 @@ class BottlePublisher end def publish_changed_formula_bottles - raise "Need to load formulae to publish them!" if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"] + raise "Need to load formulae to publish them!" if Homebrew::EnvConfig.disable_load_formula? published = [] - bintray_creds = { user: ENV["HOMEBREW_BINTRAY_USER"], key: ENV["HOMEBREW_BINTRAY_KEY"] } + bintray_creds = { user: Homebrew::EnvConfig.bintray_user, key: Homebrew::EnvConfig.bintray_key } if bintray_creds[:user] && bintray_creds[:key] @changed_formulae_names.each do |name| f = Formula[name] @@ -82,7 +82,7 @@ class BottlePublisher def verify_bintray_published(formulae_names) return if formulae_names.empty? - raise "Need to load formulae to verify their publication!" if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"] + raise "Need to load formulae to verify their publication!" if Homebrew::EnvConfig.disable_load_formula? ohai "Verifying bottles published on Bintray" formulae = formulae_names.map { |n| Formula[n] } diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index de6823300e..b141390a0f 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -76,7 +76,7 @@ begin internal_cmd = Commands.valid_internal_cmd?(cmd) internal_cmd ||= begin internal_dev_cmd = Commands.valid_internal_dev_cmd?(cmd) - if internal_dev_cmd && !ARGV.homebrew_developer? + if internal_dev_cmd && !Homebrew::EnvConfig.developer? if (HOMEBREW_REPOSITORY/".git/config").exist? system "git", "config", "--file=#{HOMEBREW_REPOSITORY}/.git/config", "--replace-all", "homebrew.devcmdrun", "true" @@ -172,7 +172,7 @@ rescue MethodDeprecatedError => e rescue Exception => e # rubocop:disable Lint/RescueException onoe e if internal_cmd && defined?(OS::ISSUES_URL) && - !ENV["HOMEBREW_NO_AUTO_UPDATE"] + !Homebrew::EnvConfig.no_auto_update? $stderr.puts "#{Tty.bold}Please report this issue:#{Tty.reset}" $stderr.puts " #{Formatter.url(OS::ISSUES_URL)}" end diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index de3d5b5e54..3a43c7a1b4 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -136,9 +136,9 @@ then HOMEBREW_FORCE_BREWED_GIT="1" fi - HOMEBREW_CACHE="${HOMEBREW_CACHE:-${HOME}/Library/Caches/Homebrew}" - HOMEBREW_LOGS="${HOMEBREW_LOGS:-${HOME}/Library/Logs/Homebrew}" - HOMEBREW_SYSTEM_TEMP="/private/tmp" + HOMEBREW_DEFAULT_CACHE="${HOME}/Library/Caches/Homebrew" + HOMEBREW_DEFAULT_LOGS="${HOME}/Library/Logs/Homebrew" + HOMEBREW_DEFAULT_TEMP="/private/tmp" # Set a variable when the macOS system Ruby is new enough to avoid spawning # a Ruby process unnecessarily. @@ -180,9 +180,9 @@ else fi CACHE_HOME="${XDG_CACHE_HOME:-${HOME}/.cache}" - HOMEBREW_CACHE="${HOMEBREW_CACHE:-${CACHE_HOME}/Homebrew}" - HOMEBREW_LOGS="${HOMEBREW_LOGS:-${CACHE_HOME}/Homebrew/Logs}" - HOMEBREW_SYSTEM_TEMP="/tmp" + HOMEBREW_DEFAULT_CACHE="${CACHE_HOME}/Homebrew" + HOMEBREW_DEFAULT_LOGS="${CACHE_HOME}/Homebrew/Logs" + HOMEBREW_DEFAULT_TEMP="/tmp" unset HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH fi @@ -194,7 +194,9 @@ else HOMEBREW_BOTTLE_DEFAULT_DOMAIN="https://linuxbrew.bintray.com" fi -HOMEBREW_TEMP="${HOMEBREW_TEMP:-${HOMEBREW_SYSTEM_TEMP}}" +HOMEBREW_CACHE="${HOMEBREW_CACHE:-${HOMEBREW_DEFAULT_CACHE}}" +HOMEBREW_LOGS="${HOMEBREW_LOGS:-${HOMEBREW_DEFAULT_LOGS}}" +HOMEBREW_TEMP="${HOMEBREW_TEMP:-${HOMEBREW_DEFAULT_TEMP}}" if [[ -n "$HOMEBREW_FORCE_BREWED_CURL" && -x "$HOMEBREW_PREFIX/opt/curl/bin/curl" ]] && @@ -230,13 +232,15 @@ export HOMEBREW_BREW_FILE export HOMEBREW_PREFIX export HOMEBREW_REPOSITORY export HOMEBREW_LIBRARY -export HOMEBREW_SYSTEM_TEMP -export HOMEBREW_TEMP # Declared in brew.sh export HOMEBREW_VERSION +export HOMEBREW_DEFAULT_CACHE export HOMEBREW_CACHE +export HOMEBREW_DEFAULT_LOGS export HOMEBREW_LOGS +export HOMEBREW_DEFAULT_TEMP +export HOMEBREW_TEMP export HOMEBREW_CELLAR export HOMEBREW_SYSTEM export HOMEBREW_CURL @@ -374,23 +378,24 @@ then export HOMEBREW_BOTTLE_DOMAIN="$HOMEBREW_BOTTLE_DEFAULT_DOMAIN" fi -HOMEBREW_DEFAULT_BREW_GIT_REMOTE="https://github.com/Homebrew/brew" +export HOMEBREW_BREW_DEFAULT_GIT_REMOTE="https://github.com/Homebrew/brew" if [[ -z "$HOMEBREW_BREW_GIT_REMOTE" ]] then - HOMEBREW_BREW_GIT_REMOTE="$HOMEBREW_DEFAULT_BREW_GIT_REMOTE" + HOMEBREW_BREW_GIT_REMOTE="$HOMEBREW_BREW_DEFAULT_GIT_REMOTE" fi export HOMEBREW_BREW_GIT_REMOTE if [[ -n "$HOMEBREW_MACOS" ]] || [[ -n "$HOMEBREW_FORCE_HOMEBREW_ON_LINUX" ]] then - HOMEBREW_DEFAULT_CORE_GIT_REMOTE="https://github.com/Homebrew/homebrew-core" + HOMEBREW_CORE_DEFAULT_GIT_REMOTE="https://github.com/Homebrew/homebrew-core" else - HOMEBREW_DEFAULT_CORE_GIT_REMOTE="https://github.com/Homebrew/linuxbrew-core" + HOMEBREW_CORE_DEFAULT_GIT_REMOTE="https://github.com/Homebrew/linuxbrew-core" fi +export HOMEBREW_CORE_DEFAULT_GIT_REMOTE if [[ -z "$HOMEBREW_CORE_GIT_REMOTE" ]] then - HOMEBREW_CORE_GIT_REMOTE="$HOMEBREW_DEFAULT_CORE_GIT_REMOTE" + HOMEBREW_CORE_GIT_REMOTE="$HOMEBREW_CORE_DEFAULT_GIT_REMOTE" fi export HOMEBREW_CORE_GIT_REMOTE diff --git a/Library/Homebrew/cask/installer.rb b/Library/Homebrew/cask/installer.rb index 0b664485f1..212e40720a 100644 --- a/Library/Homebrew/cask/installer.rb +++ b/Library/Homebrew/cask/installer.rb @@ -140,7 +140,7 @@ module Cask def summary s = +"" - s << "#{Emoji.install_badge} " if Emoji.enabled? + s << "#{Homebrew::EnvConfig.install_badge} " unless Homebrew::EnvConfig.no_emoji? s << "#{@cask} was successfully #{upgrade? ? "upgraded" : "installed"}!" s.freeze end diff --git a/Library/Homebrew/cleanup.rb b/Library/Homebrew/cleanup.rb index 89b3fc2b37..0503882cc7 100644 --- a/Library/Homebrew/cleanup.rb +++ b/Library/Homebrew/cleanup.rb @@ -138,7 +138,7 @@ module Homebrew end def self.install_formula_clean!(f) - return if ENV["HOMEBREW_NO_INSTALL_CLEANUP"] + return if Homebrew::EnvConfig.no_install_cleanup? cleanup = Cleanup.new if cleanup.periodic_clean_due? @@ -149,7 +149,7 @@ module Homebrew end def periodic_clean_due? - return false if ENV["HOMEBREW_NO_INSTALL_CLEANUP"] + return false if Homebrew::EnvConfig.no_install_cleanup? return true unless PERIODIC_CLEAN_FILE.exist? PERIODIC_CLEAN_FILE.mtime < CLEANUP_DEFAULT_DAYS.days.ago @@ -337,7 +337,7 @@ module Homebrew .chomp use_system_ruby = ( Gem::Version.new(system_ruby_version) >= Gem::Version.new(RUBY_VERSION) - ) && ENV["HOMEBREW_FORCE_VENDOR_RUBY"].nil? + ) && !Homebrew::EnvConfig.force_vendor_ruby? vendor_path = HOMEBREW_LIBRARY/"Homebrew/vendor" portable_ruby_version_file = vendor_path/"portable-ruby-version" portable_ruby_version = if portable_ruby_version_file.exist? diff --git a/Library/Homebrew/cli/parser.rb b/Library/Homebrew/cli/parser.rb index d1b0d4ba43..e3e59de199 100644 --- a/Library/Homebrew/cli/parser.rb +++ b/Library/Homebrew/cli/parser.rb @@ -83,7 +83,11 @@ module Homebrew alias switch_option switch def env?(env) - env.present? && ENV["HOMEBREW_#{env.to_s.upcase}"].present? + return false if env.blank? + + Homebrew::EnvConfig.send("#{env}?") + rescue NoMethodError + false end def usage_banner(text) diff --git a/Library/Homebrew/cmd/cat.rb b/Library/Homebrew/cmd/cat.rb index 47b8faf150..f593f371fe 100644 --- a/Library/Homebrew/cmd/cat.rb +++ b/Library/Homebrew/cmd/cat.rb @@ -20,10 +20,10 @@ module Homebrew cat_args.parse cd HOMEBREW_REPOSITORY - pager = if ENV["HOMEBREW_BAT"].nil? - "cat" - else + pager = if Homebrew::EnvConfig.bat? "#{HOMEBREW_PREFIX}/bin/bat" + else + "cat" end safe_system pager, args.formulae.first.path, *args.passthrough end diff --git a/Library/Homebrew/cmd/fetch.rb b/Library/Homebrew/cmd/fetch.rb index b0242cdaaf..2f5045bccf 100644 --- a/Library/Homebrew/cmd/fetch.rb +++ b/Library/Homebrew/cmd/fetch.rb @@ -68,7 +68,7 @@ module Homebrew rescue Interrupt raise rescue => e - raise if ARGV.homebrew_developer? + raise if Homebrew::EnvConfig.developer? fetched_bottle = false onoe e.message diff --git a/Library/Homebrew/cmd/link.rb b/Library/Homebrew/cmd/link.rb index 1376599b9a..b637858510 100644 --- a/Library/Homebrew/cmd/link.rb +++ b/Library/Homebrew/cmd/link.rb @@ -98,7 +98,7 @@ module Homebrew puts "#{n} symlinks created" end - puts_keg_only_path_message(keg) if keg_only && !ARGV.homebrew_developer? + puts_keg_only_path_message(keg) if keg_only && !Homebrew::EnvConfig.developer? end end end diff --git a/Library/Homebrew/cmd/uninstall.rb b/Library/Homebrew/cmd/uninstall.rb index 5637d72c4b..9d4e77a699 100644 --- a/Library/Homebrew/cmd/uninstall.rb +++ b/Library/Homebrew/cmd/uninstall.rb @@ -110,7 +110,7 @@ module Homebrew def check_for_dependents(kegs) return false unless result = Keg.find_some_installed_dependents(kegs) - if ARGV.homebrew_developer? + if Homebrew::EnvConfig.developer? DeveloperDependentsMessage.new(*result).output else NondeveloperDependentsMessage.new(*result).output diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb index be4034c764..844517773f 100644 --- a/Library/Homebrew/cmd/update-report.rb +++ b/Library/Homebrew/cmd/update-report.rb @@ -97,7 +97,7 @@ module Homebrew begin reporter = Reporter.new(tap) rescue Reporter::ReporterRevisionUnsetError => e - onoe "#{e.message}\n#{e.backtrace.join "\n"}" if ARGV.homebrew_developer? + onoe "#{e.message}\n#{e.backtrace.join "\n"}" if Homebrew::EnvConfig.developer? next end if reporter.updated? @@ -225,7 +225,7 @@ class Reporter # Don't care if the formula isn't available right now. nil rescue Exception => e # rubocop:disable Lint/RescueException - onoe "#{e.message}\n#{e.backtrace.join "\n"}" if ARGV.homebrew_developer? + onoe "#{e.message}\n#{e.backtrace.join "\n"}" if Homebrew::EnvConfig.developer? end @report[:M] << tap.formula_file_to_name(src) when /^R\d{0,3}/ @@ -316,7 +316,7 @@ class Reporter system HOMEBREW_BREW_FILE, "link", new_full_name, "--overwrite" end rescue Exception => e # rubocop:disable Lint/RescueException - onoe "#{e.message}\n#{e.backtrace.join "\n"}" if ARGV.homebrew_developer? + onoe "#{e.message}\n#{e.backtrace.join "\n"}" if Homebrew::EnvConfig.developer? end next end @@ -380,7 +380,7 @@ class Reporter begin f = Formulary.factory(new_full_name) rescue Exception => e # rubocop:disable Lint/RescueException - onoe "#{e.message}\n#{e.backtrace.join "\n"}" if ARGV.homebrew_developer? + onoe "#{e.message}\n#{e.backtrace.join "\n"}" if Homebrew::EnvConfig.developer? next end diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh index 3ccf7905d3..a7c384a5af 100644 --- a/Library/Homebrew/cmd/update.sh +++ b/Library/Homebrew/cmd/update.sh @@ -30,7 +30,7 @@ git_init_if_necessary() { trap '{ rm -rf .git; exit 1; }' EXIT git init git config --bool core.autocrlf false - if [[ "$HOMEBREW_DEFAULT_BREW_GIT_REMOTE" != "$HOMEBREW_BREW_GIT_REMOTE" ]] + if [[ "$HOMEBREW_BREW_DEFAULT_GIT_REMOTE" != "$HOMEBREW_BREW_GIT_REMOTE" ]] then echo "HOMEBREW_BREW_GIT_REMOTE set: using $HOMEBREW_BREW_GIT_REMOTE for Homebrew/brew Git remote URL." fi @@ -52,7 +52,7 @@ git_init_if_necessary() { trap '{ rm -rf .git; exit 1; }' EXIT git init git config --bool core.autocrlf false - if [[ "$HOMEBREW_DEFAULT_CORE_GIT_REMOTE" != "$HOMEBREW_CORE_GIT_REMOTE" ]] + if [[ "$HOMEBREW_CORE_DEFAULT_GIT_REMOTE" != "$HOMEBREW_CORE_GIT_REMOTE" ]] then echo "HOMEBREW_CORE_GIT_REMOTE set: using $HOMEBREW_CORE_GIT_REMOTE for Homebrew/core Git remote URL." fi @@ -414,7 +414,7 @@ EOS git_init_if_necessary - if [[ "$HOMEBREW_DEFAULT_BREW_GIT_REMOTE" != "$HOMEBREW_BREW_GIT_REMOTE" ]] + if [[ "$HOMEBREW_BREW_DEFAULT_GIT_REMOTE" != "$HOMEBREW_BREW_GIT_REMOTE" ]] then safe_cd "$HOMEBREW_REPOSITORY" echo "HOMEBREW_BREW_GIT_REMOTE set: using $HOMEBREW_BREW_GIT_REMOTE for Homebrew/brew Git remote." @@ -424,7 +424,7 @@ EOS git fetch --force origin --shallow-since="$latest_tag" fi - if [[ "$HOMEBREW_DEFAULT_CORE_GIT_REMOTE" != "$HOMEBREW_CORE_GIT_REMOTE" ]] && + if [[ "$HOMEBREW_CORE_DEFAULT_GIT_REMOTE" != "$HOMEBREW_CORE_GIT_REMOTE" ]] && [[ -d "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" ]] then safe_cd "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index 510cdc3348..7660a938e9 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -114,7 +114,7 @@ module Homebrew ENV["PATH"] = ENV["HOMEBREW_PATH"] # Use the user's browser, too. - ENV["BROWSER"] = ENV["HOMEBREW_BROWSER"] + ENV["BROWSER"] = Homebrew::EnvConfig.browser formula = args.formulae.first diff --git a/Library/Homebrew/dev-cmd/extract.rb b/Library/Homebrew/dev-cmd/extract.rb index 76af1c4a3e..0a4e60a5fe 100644 --- a/Library/Homebrew/dev-cmd/extract.rb +++ b/Library/Homebrew/dev-cmd/extract.rb @@ -108,7 +108,7 @@ module Homebrew end destination_tap = Tap.fetch(args.named.second) - unless ARGV.homebrew_developer? + unless Homebrew::EnvConfig.developer? odie "Cannot extract formula to homebrew/core!" if destination_tap.core_tap? odie "Cannot extract formula to the same tap!" if destination_tap == source_tap end diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb index 6747996bd9..d6d616a0f1 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -63,6 +63,7 @@ module Homebrew variables[:developer_commands] = generate_cmd_manpages(Commands.internal_developer_commands_paths) variables[:official_external_commands] = generate_cmd_manpages(Commands.official_external_commands_paths) variables[:global_options] = global_options_manpage + variables[:environment_variables] = env_vars_manpage readme = HOMEBREW_REPOSITORY/"README.md" variables[:lead] = @@ -207,9 +208,24 @@ module Homebrew lines.join("\n") end + def env_vars_manpage + lines = Homebrew::EnvConfig::ENVS.flat_map do |env, hash| + entry = " * `#{env}`:\n #{hash[:description]}\n" + default = hash[:default_text] + default ||= "`#{hash[:default]}`." if hash[:default] + entry += "\n\n *Default:* #{default}\n" if default + + entry + end + lines.join("\n") + end + def generate_option_doc(short, long, desc) comma = (short && long) ? ", " : "" - "* #{format_short_opt(short)}" + comma + "#{format_long_opt(long)}:" + "\n " + desc + "\n" + <<~EOS + * #{format_short_opt(short)}#{comma}#{format_long_opt(long)}: + #{desc} + EOS end def format_short_opt(opt) diff --git a/Library/Homebrew/dev-cmd/mirror.rb b/Library/Homebrew/dev-cmd/mirror.rb index d7bf5b512c..b12bb8c1f7 100644 --- a/Library/Homebrew/dev-cmd/mirror.rb +++ b/Library/Homebrew/dev-cmd/mirror.rb @@ -22,8 +22,8 @@ module Homebrew def mirror mirror_args.parse - bintray_user = ENV["HOMEBREW_BINTRAY_USER"] - bintray_key = ENV["HOMEBREW_BINTRAY_KEY"] + bintray_user = Homebrew::EnvConfig.bintray_user + bintray_key = Homebrew::EnvConfig.bintray_key raise "Missing HOMEBREW_BINTRAY_USER or HOMEBREW_BINTRAY_KEY variables!" if !bintray_user || !bintray_key args.formulae.each do |f| diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb index ddf8560e8a..6756be8eec 100644 --- a/Library/Homebrew/dev-cmd/pull.rb +++ b/Library/Homebrew/dev-cmd/pull.rb @@ -72,8 +72,7 @@ module Homebrew pull_args.parse # Passthrough Git environment variables for e.g. git am - ENV["GIT_COMMITTER_NAME"] = ENV["HOMEBREW_GIT_NAME"] if ENV["HOMEBREW_GIT_NAME"] - ENV["GIT_COMMITTER_EMAIL"] = ENV["HOMEBREW_GIT_EMAIL"] if ENV["HOMEBREW_GIT_EMAIL"] + Utils.set_git_name_email!(author: false, committer: true) # Depending on user configuration, git may try to invoke gpg. if Utils.popen_read("git config --get --bool commit.gpgsign").chomp == "true" @@ -168,7 +167,7 @@ module Homebrew fetch_bottles = false changed_formulae_names.each do |name| - next if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"] + next if Homebrew::EnvConfig.disable_load_formula? begin f = Formula[name] @@ -213,7 +212,7 @@ module Homebrew end is_bumpable = false if args.clean? - is_bumpable = false if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"] + is_bumpable = false if Homebrew::EnvConfig.disable_load_formula? if is_bumpable formula = Formula[changed_formulae_names.first] diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index e0e175169a..53475f3dab 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -538,11 +538,11 @@ module Homebrew end def check_brew_git_origin - examine_git_origin(HOMEBREW_REPOSITORY, HOMEBREW_BREW_GIT_REMOTE) + examine_git_origin(HOMEBREW_REPOSITORY, Homebrew::EnvConfig.brew_git_remote) end def check_coretap_git_origin - examine_git_origin(CoreTap.instance.path, HOMEBREW_CORE_GIT_REMOTE) + examine_git_origin(CoreTap.instance.path, Homebrew::EnvConfig.core_git_remote) end def check_casktap_git_origin diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 58a454f5a7..2ed5684828 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -345,8 +345,8 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy @resolved_info_cache ||= {} return @resolved_info_cache[url] if @resolved_info_cache.include?(url) - if ENV["HOMEBREW_ARTIFACT_DOMAIN"] - url = url.sub(%r{^((ht|f)tps?://)?}, ENV["HOMEBREW_ARTIFACT_DOMAIN"].chomp("/") + "/") + if (domain = Homebrew::EnvConfig.artifact_domain) + url = url.sub(%r{^((ht|f)tps?://)?}, domain.chomp("/") + "/") end out, _, status= curl_output("--location", "--silent", "--head", "--request", "GET", url.to_s) @@ -402,7 +402,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy def _fetch(url:, resolved_url:) ohai "Downloading from #{resolved_url}" if url != resolved_url - if ENV["HOMEBREW_NO_INSECURE_REDIRECT"] && + if Homebrew::EnvConfig.no_insecure_redirect? && url.start_with?("https://") && !resolved_url.start_with?("https://") $stderr.puts "HTTPS to HTTP redirect detected & HOMEBREW_NO_INSECURE_REDIRECT is set." raise CurlDownloadStrategyError, url @@ -784,7 +784,7 @@ class GitDownloadStrategy < VCSDownloadStrategy git_dir = dot_git.read.chomp[/^gitdir: (.*)$/, 1] if git_dir.nil? - onoe "Failed to parse '#{dot_git}'." if ARGV.homebrew_developer? + onoe "Failed to parse '#{dot_git}'." if Homebrew::EnvConfig.developer? next end @@ -809,7 +809,7 @@ class GitHubGitDownloadStrategy < GitDownloadStrategy end def github_last_commit - return if ENV["HOMEBREW_NO_GITHUB_API"] + return if Homebrew::EnvConfig.no_github_api? output, _, status = curl_output( "--silent", "--head", "--location", @@ -825,7 +825,7 @@ class GitHubGitDownloadStrategy < GitDownloadStrategy end def multiple_short_commits_exist?(commit) - return if ENV["HOMEBREW_NO_GITHUB_API"] + return if Homebrew::EnvConfig.no_github_api? output, _, status = curl_output( "--silent", "--head", "--location", diff --git a/Library/Homebrew/emoji.rb b/Library/Homebrew/emoji.rb deleted file mode 100644 index 68e015630a..0000000000 --- a/Library/Homebrew/emoji.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module Emoji - class << self - def install_badge - ENV["HOMEBREW_INSTALL_BADGE"] || "🍺" - end - - def enabled? - !ENV["HOMEBREW_NO_EMOJI"] - end - end -end diff --git a/Library/Homebrew/env_config.rb b/Library/Homebrew/env_config.rb new file mode 100644 index 0000000000..468addf98e --- /dev/null +++ b/Library/Homebrew/env_config.rb @@ -0,0 +1,308 @@ +# frozen_string_literal: true + +module Homebrew + module EnvConfig + module_function + + ENVS = { + HOMEBREW_ARCH: { + description: "Linux only: Homebrew will pass the set value to type name to the compiler's `-march` option.", + default: "native", + }, + HOMEBREW_ARTIFACT_DOMAIN: { + description: "Instructs Homebrew to prefix all download URLs, including those for bottles, with this " \ + "variable. For example, `HOMEBREW_ARTIFACT_DOMAIN=http://localhost:8080` will cause a " \ + "formula with the URL `https://example.com/foo.tar.gz` to instead download from " \ + "`http://localhost:8080/example.com/foo.tar.gz`.", + }, + HOMEBREW_AUTO_UPDATE_SECS: { + description: "Homebrew will only check for autoupdates once per this seconds interval.", + default: 300, + }, + HOMEBREW_BAT: { + description: "Homebrew will use `bat` for the `brew cat` command.", + boolean: true, + }, + HOMEBREW_BINTRAY_KEY: { + description: "Homebrew uses this API key when accessing the Bintray API (where bottles are stored).", + }, + HOMEBREW_BINTRAY_USER: { + description: "Homebrew uses this username when accessing the Bintray API (where bottles are stored).", + }, + HOMEBREW_BOTTLE_DOMAIN: { + description: "Instructs Homebrew to use the specified URL as its download mirror for bottles. " \ + "For example, `HOMEBREW_BOTTLE_DOMAIN=http://localhost:8080` will cause all bottles to " \ + "download from the prefix `http://localhost:8080/`.", + default_text: "macOS: `https://homebrew.bintray.com/`, Linux: `https://linuxbrew.bintray.com/`.", + default: HOMEBREW_BOTTLE_DEFAULT_DOMAIN, + }, + HOMEBREW_BREW_GIT_REMOTE: { + description: "Instructs Homebrew to use the specified URL as its Homebrew/brew `git`(1) remote.", + default: HOMEBREW_BREW_DEFAULT_GIT_REMOTE, + }, + HOMEBREW_BROWSER: { + description: "Homebrew uses this setting as the browser when opening project homepages.", + default_text: "`$BROWSER` or the OS's default browser.", + }, + HOMEBREW_CACHE: { + description: "Instructs Homebrew to use the specified directory as the download cache.", + default_text: "macOS: `$HOME/Library/Caches/Homebrew`, " \ + "Linux: `$XDG_CACHE_HOME/Homebrew` or `$HOME/.cache/Homebrew`.", + default: HOMEBREW_DEFAULT_CACHE, + }, + HOMEBREW_COLOR: { + description: "Homebrew force colour output on non-TTY outputs.", + boolean: true, + }, + HOMEBREW_CORE_GIT_REMOTE: { + description: "instructs Homebrew to use the specified URL as its Homebrew/homebrew-core `git`(1) remote.", + default_text: "macOS: `https://github.com/Homebrew/homebrew-core`, " \ + "Linux: `https://github.com/Homebrew/linuxbrew-core`.", + default: HOMEBREW_CORE_DEFAULT_GIT_REMOTE, + }, + HOMEBREW_CURLRC: { + description: "Homebrew will not pass `--disable` when invoking `curl`(1), which disables the " \ + "use of `curlrc`.", + boolean: true, + }, + HOMEBREW_CURL_RETRIES: { + description: "Homebrew will pass the given retry count to `--retry` when invoking `curl`(1).", + default: 3, + }, + HOMEBREW_CURL_VERBOSE: { + description: "Homebrew will pass `--verbose` when invoking `curl`(1).", + boolean: true, + }, + HOMEBREW_DEVELOPER: { + description: "Homebrew will tweak behaviour to be more relevant for Homebrew developers (active or " \ + "budding), e.g. turning warnings into errors.", + boolean: true, + }, + HOMEBREW_DISABLE_LOAD_FORMULA: { + description: "Homebrew will refuse to load formulae. This is useful when formulae are not trusted (such " \ + "as in pull requests).", + boolean: true, + }, + HOMEBREW_DISPLAY: { + description: "Homebrew will use this X11 display when opening a page in a browser, for example with " \ + "`brew home`. Primarily useful on Linux.", + default_text: "`$DISPLAY`.", + }, + HOMEBREW_DISPLAY_INSTALL_TIMES: { + description: "Homebrew will print install times for each formula at the end of the run.", + boolean: true, + }, + HOMEBREW_EDITOR: { + description: "Homebrew will use this editor when editing a single formula, or several formulae in the " \ + "same directory.\n\n *Note:* `brew edit` will open all of Homebrew as discontinuous files " \ + "and directories. Visual Studio Code can handle this correctly in project mode, but many " \ + "editors will do strange things in this case.", + default_text: "`$EDITOR` or `$VISUAL`.", + }, + HOMEBREW_FAIL_LOG_LINES: { + description: "Homebrew will output this many lines of output on formula `system` failures.", + default: 15, + }, + HOMEBREW_FORCE_BREWED_CURL: { + description: "Homebrew will always use a Homebrew-installed `curl`(1) rather than the system version. " \ + "Automatically set if the system version of `curl` is too old.", + }, + HOMEBREW_FORCE_BREWED_GIT: { + description: "Homebrew will always use a Homebrew-installed `git`(1) rather than the system version. " \ + "Automatically set if the system version of `git` is too old.", + }, + HOMEBREW_FORCE_HOMEBREW_ON_LINUX: { + description: "Homebrew running on Linux will use URLs for Homebrew on macOS. This is useful when merging" \ + "pull requests on Linux for macOS.", + boolean: true, + }, + HOMEBREW_FORCE_VENDOR_RUBY: { + description: "Homebrew will always use its vendored, relocatable Ruby version even if the system version " \ + "of Ruby is new enough.", + boolean: true, + }, + HOMEBREW_GITHUB_API_PASSWORD: { + description: "GitHub password for authentication with the GitHub API, used by Homebrew for features" \ + "such as `brew search`. We strongly recommend using `HOMEBREW_GITHUB_API_TOKEN` instead.", + }, + HOMEBREW_GITHUB_API_TOKEN: { + description: "A personal access token for the GitHub API, used by Homebrew for features such as " \ + "`brew search`. You can create one at . If set, " \ + "GitHub will allow you a greater number of API requests. For more information, see: " \ + "\n\n *Note:* Homebrew doesn't " \ + "require permissions for any of the scopes.", + }, + HOMEBREW_GITHUB_API_USERNAME: { + description: "GitHub username for authentication with the GitHub API, used by Homebrew for features " \ + "such as `brew search`. We strongly recommend using `HOMEBREW_GITHUB_API_TOKEN` instead.", + }, + HOMEBREW_GIT_EMAIL: { + description: "Homebrew will set the Git author and committer name to this value.", + }, + HOMEBREW_GIT_NAME: { + description: "Homebrew will set the Git author and committer email to this value.", + }, + HOMEBREW_INSTALL_BADGE: { + description: "Text printed before the installation summary of each successful build.", + default_text: 'The "Beer Mug" emoji.', + default: "🍺", + }, + HOMEBREW_LOGS: { + description: "IHomebrew will use the specified directory to store log files.", + default_text: "macOS: `$HOME/Library/Logs/Homebrew`, "\ + "Linux: `$XDG_CACHE_HOME/Homebrew/Logs` or `$HOME/.cache/Homebrew/Logs`.", + default: HOMEBREW_DEFAULT_LOGS, + }, + HOMEBREW_MAKE_JOBS: { + description: "Instructs Homebrew to use the value of `HOMEBREW_MAKE_JOBS` as the number of " \ + "parallel jobs to run when building with `make`(1).", + default_text: "The number of available CPU cores.", + default: lambda { + require "os" + require "hardware" + Hardware::CPU.cores + }, + }, + HOMEBREW_NO_ANALYTICS: { + description: "Homebrew will not send analytics. See: .", + boolean: true, + }, + HOMEBREW_NO_AUTO_UPDATE: { + description: "Homebrew will not auto-update before running `brew install`, `brew upgrade` or `brew tap`.", + boolean: true, + }, + HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: { + description: "Homebrew will fail on the failure of installation from a bottle rather than " \ + "falling back to building from source.", + boolean: true, + }, + HOMEBREW_NO_COLOR: { + description: "Homebrew will not print text with colour added.", + default_text: "`$NO_COLOR`.", + boolean: true, + }, + HOMEBREW_NO_COMPAT: { + description: "Homebrew disables all use of legacy compatibility code.", + boolean: true, + }, + HOMEBREW_NO_EMOJI: { + description: "Homebrew will not print the `HOMEBREW_INSTALL_BADGE` on a successful build." \ + "\n\n *Note:* Homebrew will only try to print emoji on OS X Lion or newer.", + boolean: true, + }, + HOMEBREW_NO_GITHUB_API: { + description: "Homebrew will not use the GitHub API, e.g. for searches or fetching relevant issues " \ + "on a failed install.", + boolean: true, + }, + HOMEBREW_NO_INSECURE_REDIRECT: { + description: "Homebrew will not permit redirects from secure HTTPS to insecure HTTP." \ + "\n\n *Note:* While ensuring your downloads are fully secure, this is likely to cause " \ + "from-source SourceForge, some GNU & GNOME based formulae to fail to download.", + boolean: true, + }, + HOMEBREW_NO_INSTALL_CLEANUP: { + description: "`brew install`, `brew upgrade` and `brew reinstall` will never automatically cleanup " \ + "installed/upgraded/reinstalled formulae or all formulae every 30 days.", + boolean: true, + }, + HOMEBREW_PRY: { + description: "Homebrew will use Pry for the `brew irb` command.", + boolean: true, + }, + HOMEBREW_SKIP_OR_LATER_BOTTLES: { + description: "Along with `HOMEBREW_DEVELOPER` Homebrew will not use bottles from older versions of macOS. " \ + "This is useful in Homebrew development on new macOS versions.", + boolean: true, + }, + HOMEBREW_SVN: { + description: "Forces Homebrew to use a particular `svn` binary. Otherwise, a Homebrew-built Subversion " \ + "if installed, or the system-provided binary.", + }, + HOMEBREW_TEMP: { + description: "Instructs Homebrew to use `HOMEBREW_TEMP` as the temporary directory for building " \ + "packages. This may be needed if your system temp directory and Homebrew prefix are on " \ + "different volumes, as macOS has trouble moving symlinks across volumes when the target" \ + "does not yet exist. This issue typically occurs when using FileVault or custom SSD" \ + "configurations.", + default_text: "macOS: `/private/tmp`, Linux: `/tmp`.", + default: HOMEBREW_DEFAULT_TEMP, + }, + HOMEBREW_UPDATE_TO_TAG: { + description: "Instructs Homebrew to always use the latest stable tag (even if developer commands " \ + "have been run).", + boolean: true, + }, + HOMEBREW_VERBOSE: { + description: "Homebrew always assumes `--verbose` when running commands.", + boolean: true, + }, + HOMEBREW_VERBOSE_USING_DOTS: { + boolean: true, + description: "Homebrew's verbose output will print a `.` no more than once a minute. This can be " \ + "useful to avoid long-running Homebrew commands being killed due to no output.", + }, + all_proxy: { + description: "Sets the SOCKS5 proxy to be used by `curl`(1), `git`(1) and `svn`(1) when downloading " \ + "through Homebrew.", + }, + ftp_proxy: { + description: "Sets the FTP proxy to be used by `curl`(1), `git`(1) and `svn`(1) when downloading " \ + "through Homebrew.", + }, + http_proxy: { + description: "Sets the HTTP proxy to be used by `curl`(1), `git`(1) and `svn`(1) when downloading " \ + "through Homebrew.", + }, + https_proxy: { + description: "Sets the HTTPS proxy to be used by `curl`(1), `git`(1) and `svn`(1) when downloading " \ + "through Homebrew.", + }, + no_proxy: { + description: "Sets the comma-separated list of hostnames and domain names that should be excluded " \ + "from proxying by `curl`(1), `git`(1) and `svn`(1) when downloading through Homebrew.", + }, + }.freeze + + def env_method_name(env, hash) + method_name = env.to_s + .sub(/^HOMEBREW_/, "") + .downcase + method_name = "#{method_name}?" if hash[:boolean] + method_name + end + + ENVS.each do |env, hash| + method_name = env_method_name(env, hash) + env = env.to_s + + if hash[:boolean] + define_method(method_name) do + ENV[env].present? + end + elsif hash[:default].present? + # Needs a custom implementation. + next if env == "HOMEBREW_MAKE_JOBS" + + define_method(method_name) do + ENV[env].presence || hash.fetch(:default).to_s + end + else + define_method(method_name) do + ENV[env].presence + end + end + end + + # Needs a custom implementation. + def make_jobs + jobs = ENV["HOMEBREW_MAKE_JOBS"].to_i + return jobs.to_s if jobs.positive? + + ENVS.fetch(:HOMEBREW_MAKE_JOBS) + .fetch(:default) + .call + .to_s + end + end +end diff --git a/Library/Homebrew/extend/ARGV.rb b/Library/Homebrew/extend/ARGV.rb index ff1bd86a8f..f2372e3c57 100644 --- a/Library/Homebrew/extend/ARGV.rb +++ b/Library/Homebrew/extend/ARGV.rb @@ -31,18 +31,6 @@ module HomebrewArgvExtension flag?("--debug") || !ENV["HOMEBREW_DEBUG"].nil? end - def homebrew_developer? - !ENV["HOMEBREW_DEVELOPER"].nil? - end - - def skip_or_later_bottles? - homebrew_developer? && !ENV["HOMEBREW_SKIP_OR_LATER_BOTTLES"].nil? - end - - def no_sandbox? - include?("--no-sandbox") || !ENV["HOMEBREW_NO_SANDBOX"].nil? - end - def build_bottle? include?("--build-bottle") end diff --git a/Library/Homebrew/extend/ENV/std.rb b/Library/Homebrew/extend/ENV/std.rb index 06f4e50d37..8c2c2a6c10 100644 --- a/Library/Homebrew/extend/ENV/std.rb +++ b/Library/Homebrew/extend/ENV/std.rb @@ -169,7 +169,7 @@ module Stdenv # Sets architecture-specific flags for every environment variable # given in the list `flags`. # @private - def set_cpu_flags(flags, map = Hardware::CPU.optimization_flags) # rubocop:disable Naming/AccessorMethodName + def set_cpu_flags(flags, map = Hardware::CPU.optimization_flags) cflags =~ /(-Xarch_#{Hardware::CPU.arch_32_bit} )-march=/ xarch = Regexp.last_match(1).to_s remove flags, /(-Xarch_#{Hardware::CPU.arch_32_bit} )?-march=\S*/ @@ -188,12 +188,7 @@ module Stdenv end def make_jobs - # '-j' requires a positive integral argument - if (jobs = self["HOMEBREW_MAKE_JOBS"].to_i).positive? - jobs - else - Hardware::CPU.cores - end + Homebrew::EnvConfig.make_jobs end # This method does nothing in stdenv since there's no arg refurbishment diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb index 2aa440689b..c23314922d 100644 --- a/Library/Homebrew/extend/ENV/super.rb +++ b/Library/Homebrew/extend/ENV/super.rb @@ -217,11 +217,7 @@ module Superenv end def determine_make_jobs - if (j = self["HOMEBREW_MAKE_JOBS"].to_i) < 1 - Hardware::CPU.cores - else - j - end + Homebrew::EnvConfig.make_jobs end def determine_optflags diff --git a/Library/Homebrew/extend/os/linux/hardware/cpu.rb b/Library/Homebrew/extend/os/linux/hardware/cpu.rb index 94472e9fce..99ede69a0b 100644 --- a/Library/Homebrew/extend/os/linux/hardware/cpu.rb +++ b/Library/Homebrew/extend/os/linux/hardware/cpu.rb @@ -3,9 +3,8 @@ module Hardware class CPU class << self - native_arch = (ENV["HOMEBREW_ARCH"] || "native").freeze OPTIMIZATION_FLAGS_LINUX = { - native: "-march=#{native_arch}", + native: "-march=#{Homebrew::EnvConfig.arch}", nehalem: "-march=nehalem", core2: "-march=core2", core: "-march=prescott", diff --git a/Library/Homebrew/extend/os/linux/keg_relocate.rb b/Library/Homebrew/extend/os/linux/keg_relocate.rb index 34fcb9b5cc..0ec90cac9a 100644 --- a/Library/Homebrew/extend/os/linux/keg_relocate.rb +++ b/Library/Homebrew/extend/os/linux/keg_relocate.rb @@ -93,7 +93,7 @@ class Keg @bottle_dependencies ||= begin formulae = relocation_formulae gcc = Formula["gcc"] - if !ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"] && + if !Homebrew::EnvConfig.force_homebrew_on_linux? && DevelopmentTools.non_apple_gcc_version("gcc") < gcc.version.to_i formulae += gcc.recursive_dependencies.map(&:name) formulae << gcc.name diff --git a/Library/Homebrew/extend/os/linux/tap.rb b/Library/Homebrew/extend/os/linux/tap.rb index 854a3d9eb4..4a3ab97092 100644 --- a/Library/Homebrew/extend/os/linux/tap.rb +++ b/Library/Homebrew/extend/os/linux/tap.rb @@ -4,6 +4,6 @@ class CoreTap < Tap # @private def initialize super "Homebrew", "core" - @full_name = "Homebrew/linuxbrew-core" unless ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"] + @full_name = "Homebrew/linuxbrew-core" unless Homebrew::EnvConfig.force_homebrew_on_linux? end end diff --git a/Library/Homebrew/extend/os/linux/utils/analytics.rb b/Library/Homebrew/extend/os/linux/utils/analytics.rb index 67e33b2dd6..00058e64d3 100644 --- a/Library/Homebrew/extend/os/linux/utils/analytics.rb +++ b/Library/Homebrew/extend/os/linux/utils/analytics.rb @@ -4,13 +4,13 @@ module Utils module Analytics class << self def formula_path - return generic_formula_path if ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"] + return generic_formula_path if Homebrew::EnvConfig.force_homebrew_on_linux? "formula-linux" end def analytics_path - return generic_analytics_path if ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"] + return generic_analytics_path if Homebrew::EnvConfig.force_homebrew_on_linux? "analytics-linux" end diff --git a/Library/Homebrew/extend/os/mac/diagnostic.rb b/Library/Homebrew/extend/os/mac/diagnostic.rb index caf672790b..e6ebdeceed 100644 --- a/Library/Homebrew/extend/os/mac/diagnostic.rb +++ b/Library/Homebrew/extend/os/mac/diagnostic.rb @@ -45,7 +45,7 @@ module Homebrew end def check_for_unsupported_macos - return if ARGV.homebrew_developer? + return if Homebrew::EnvConfig.developer? who = +"We" if OS::Mac.prerelease? @@ -141,7 +141,7 @@ module Homebrew def check_ruby_version ruby_version = "2.6.3" return if RUBY_VERSION == ruby_version - return if ARGV.homebrew_developer? && OS::Mac.prerelease? + return if Homebrew::EnvConfig.developer? && OS::Mac.prerelease? <<~EOS Ruby version #{RUBY_VERSION} is unsupported on #{MacOS.version}. Homebrew diff --git a/Library/Homebrew/extend/os/mac/utils/bottles.rb b/Library/Homebrew/extend/os/mac/utils/bottles.rb index a2bf49f923..b6c6bd3efe 100644 --- a/Library/Homebrew/extend/os/mac/utils/bottles.rb +++ b/Library/Homebrew/extend/os/mac/utils/bottles.rb @@ -17,7 +17,8 @@ module Utils def find_matching_tag(tag) # Used primarily by developers testing beta macOS releases. - if OS::Mac.prerelease? && ARGV.skip_or_later_bottles? + if OS::Mac.prerelease? && Homebrew::EnvConfig.developer? && + Homebrew::EnvConfig.skip_or_later_bottles? generic_find_matching_tag(tag) else generic_find_matching_tag(tag) || diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 45ebd50254..705c868bca 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -1891,7 +1891,7 @@ class Formula # system "make", "install" def system(cmd, *args) verbose = Homebrew.args.verbose? - verbose_using_dots = !ENV["HOMEBREW_VERBOSE_USING_DOTS"].nil? + verbose_using_dots = Homebrew::EnvConfig.verbose_using_dots? # remove "boring" arguments so that the important ones are more likely to # be shown considering that we trim long ohai lines to the terminal width @@ -1962,8 +1962,7 @@ class Formula $stdout.flush unless $CHILD_STATUS.success? - log_lines = ENV["HOMEBREW_FAIL_LOG_LINES"] - log_lines ||= "15" + log_lines = Homebrew::EnvConfig.fail_log_lines log.flush if !verbose || verbose_using_dots diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index bb7f2bdca5..b5ba33d8de 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -11,7 +11,6 @@ require "formula_cellar_checks" require "install_renamed" require "debrew" require "sandbox" -require "emoji" require "development_tools" require "cache_store" require "linkage_checker" @@ -306,9 +305,9 @@ class FormulaInstaller end formula.rack.rmdir_if_possible end - raise if ARGV.homebrew_developer? || - e.is_a?(Interrupt) || - ENV["HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK"] + raise if Homebrew::EnvConfig.developer? || + Homebrew::EnvConfig.no_bottle_source_fallback? || + e.is_a?(Interrupt) @pour_failed = true onoe e.message @@ -372,7 +371,7 @@ class FormulaInstaller 'conflicts_with \"#{c.name}\"' should be removed from #{formula.path.basename}. EOS - raise if ARGV.homebrew_developer? + raise if Homebrew::EnvConfig.developer? $stderr.puts "Please report this issue to the #{formula.tap} tap (not Homebrew/brew or Homebrew/core)!" false @@ -621,7 +620,7 @@ class FormulaInstaller def caveats return if only_deps? - audit_installed if ARGV.homebrew_developer? + audit_installed if Homebrew::EnvConfig.developer? caveats = Caveats.new(formula) @@ -684,7 +683,7 @@ class FormulaInstaller def summary s = +"" - s << "#{Emoji.install_badge} " if Emoji.enabled? + s << "#{Homebrew::EnvConfig.install_badge} " unless Homebrew::EnvConfig.no_emoji? s << "#{formula.prefix.resolved_path}: #{formula.prefix.abv}" s << ", built in #{pretty_duration build_time}" if build_time s.freeze @@ -943,7 +942,7 @@ class FormulaInstaller rescue Exception => e # rubocop:disable Lint/RescueException opoo "The post-install step did not complete successfully" puts "You can try again using `brew postinstall #{formula.full_name}`" - ohai e, e.backtrace if debug? || ARGV.homebrew_developer? + ohai e, e.backtrace if debug? || Homebrew::EnvConfig.developer? Homebrew.failed = true @show_summary_heading = true end diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index c62c843a17..83565d1a49 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -26,7 +26,7 @@ module Formulary end def self.load_formula(name, path, contents, namespace) - raise "Formula loading disabled by HOMEBREW_DISABLE_LOAD_FORMULA!" if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"] + raise "Formula loading disabled by HOMEBREW_DISABLE_LOAD_FORMULA!" if Homebrew::EnvConfig.disable_load_formula? mod = Module.new const_set(namespace, mod) diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb index 97eeba275b..bd8f745f03 100644 --- a/Library/Homebrew/global.rb +++ b/Library/Homebrew/global.rb @@ -25,6 +25,14 @@ ActiveSupport::Inflector.inflections(:en) do |inflect| inflect.irregular "it", "they" end +HOMEBREW_BOTTLE_DEFAULT_DOMAIN = ENV["HOMEBREW_BOTTLE_DEFAULT_DOMAIN"] +HOMEBREW_BREW_DEFAULT_GIT_REMOTE = ENV["HOMEBREW_BREW_DEFAULT_GIT_REMOTE"] +HOMEBREW_CORE_DEFAULT_GIT_REMOTE = ENV["HOMEBREW_CORE_DEFAULT_GIT_REMOTE"] +HOMEBREW_DEFAULT_CACHE = ENV["HOMEBREW_DEFAULT_CACHE"] +HOMEBREW_DEFAULT_LOGS = ENV["HOMEBREW_DEFAULT_LOGS"] +HOMEBREW_DEFAULT_TEMP = ENV["HOMEBREW_DEFAULT_TEMP"] +require "env_config" + require "config" require "os" require "extend/ARGV" @@ -51,12 +59,6 @@ HOMEBREW_USER_AGENT_FAKE_SAFARI = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 " \ "(KHTML, like Gecko) Version/10.0.3 Safari/602.4.8" -HOMEBREW_BOTTLE_DEFAULT_DOMAIN = ENV["HOMEBREW_BOTTLE_DEFAULT_DOMAIN"] -HOMEBREW_BOTTLE_DOMAIN = ENV["HOMEBREW_BOTTLE_DOMAIN"] - -HOMEBREW_BREW_GIT_REMOTE = ENV["HOMEBREW_BREW_GIT_REMOTE"] -HOMEBREW_CORE_GIT_REMOTE = ENV["HOMEBREW_CORE_GIT_REMOTE"] - HOMEBREW_DEFAULT_PREFIX = "/usr/local" LINUXBREW_DEFAULT_PREFIX = "/home/linuxbrew/.linuxbrew" @@ -134,4 +136,4 @@ require "official_taps" require "tap" require "tap_constants" -require "compat" if !ARGV.include?("--no-compat") && !ENV["HOMEBREW_NO_COMPAT"] +require "compat" unless Homebrew::EnvConfig.no_compat? diff --git a/Library/Homebrew/hardware.rb b/Library/Homebrew/hardware.rb index 37fd2c49c6..9c9c00ce0d 100644 --- a/Library/Homebrew/hardware.rb +++ b/Library/Homebrew/hardware.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "utils/popen" + module Hardware class CPU INTEL_32BIT_ARCHS = [:i386].freeze diff --git a/Library/Homebrew/help.rb b/Library/Homebrew/help.rb index 140933af72..7e45247b75 100644 --- a/Library/Homebrew/help.rb +++ b/Library/Homebrew/help.rb @@ -83,7 +83,7 @@ module Homebrew output ||= comment_help(path) output ||= if output.blank? - opoo "No help text in: #{path}" if ARGV.homebrew_developer? + opoo "No help text in: #{path}" if Homebrew::EnvConfig.developer? HOMEBREW_HELP end diff --git a/Library/Homebrew/language/go.rb b/Library/Homebrew/language/go.rb index 7dbbf5bf8a..84188c0ef4 100644 --- a/Library/Homebrew/language/go.rb +++ b/Library/Homebrew/language/go.rb @@ -10,7 +10,7 @@ module Language # e.g. `resource "github.com/foo/bar"` def self.stage_deps(resources, target) if resources.empty? - if ARGV.homebrew_developer? + if Homebrew::EnvConfig.developer? odie "tried to stage empty Language::Go resources array" else opoo "tried to stage empty Language::Go resources array" diff --git a/Library/Homebrew/manpages/brew.1.md.erb b/Library/Homebrew/manpages/brew.1.md.erb index 5581f2f6c8..26d439a213 100644 --- a/Library/Homebrew/manpages/brew.1.md.erb +++ b/Library/Homebrew/manpages/brew.1.md.erb @@ -109,205 +109,7 @@ Note that environment variables must have a value set to be detected. For exampl `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just `export HOMEBREW_NO_INSECURE_REDIRECT`. - * `HOMEBREW_ARCH`: - Linux only: If set, Homebrew will pass the set value to type name to the compiler's - `-march` option instead of using the default (`-march=native`). - - * `HOMEBREW_ARTIFACT_DOMAIN`: - If set, instructs Homebrew to prefix all download URLs, including those for bottles, - with this variable. For example, `HOMEBREW_ARTIFACT_DOMAIN=http://localhost:8080` - will cause a formula with the URL `https://example.com/foo.tar.gz` to instead - download from `http://localhost:8080/example.com/foo.tar.gz`. - - * `HOMEBREW_AUTO_UPDATE_SECS`: - If set, Homebrew will only check for autoupdates once per this seconds interval. - - *Default:* `300`. - - * `HOMEBREW_AWS_ACCESS_KEY_ID`, `HOMEBREW_AWS_SECRET_ACCESS_KEY`: - When using the `S3` download strategy, Homebrew will look in - these variables for access credentials (see - - to retrieve these access credentials from AWS). If they are not set, - the `S3` download strategy will download with a public (unsigned) URL. - - * `HOMEBREW_BAT`: - If set, Homebrew will use `bat` for the `brew cat` command. - - * `HOMEBREW_BOTTLE_DOMAIN`: - By default, Homebrew uses `https://homebrew.bintray.com/` as its download - mirror for bottles. If set, instructs Homebrew to instead use the specified - URL. For example, `HOMEBREW_BOTTLE_DOMAIN=http://localhost:8080` will - cause all bottles to download from the prefix `http://localhost:8080/`. - - * `HOMEBREW_BREW_GIT_REMOTE`: - By default, Homebrew uses `https://github.com/Homebrew/brew` as its - Homebrew/brew `git`(1) remote. If set, instructs Homebrew to instead use - the specified URL. - - * `HOMEBREW_BROWSER`: - If set, Homebrew uses this setting as the browser when opening project - homepages, instead of the OS default browser. - - * `HOMEBREW_CACHE`: - If set, instructs Homebrew to use the specified directory as the download cache. - - *Default:* `~/Library/Caches/Homebrew`. - - * `HOMEBREW_CORE_GIT_REMOTE`: - By default, Homebrew uses `https://github.com/Homebrew/homebrew-core` (or - `https://github.com/Homebrew/linuxbrew-core`) as its Homebrew/homebrew-core - `git`(1) remote. If set, instructs Homebrew to instead use the specified URL. - - * `HOMEBREW_CURLRC`: - If set, Homebrew will not pass `--disable` when invoking `curl`(1), which disables - the use of `curlrc`. - - * `HOMEBREW_CURL_VERBOSE`: - If set, Homebrew will pass `--verbose` when invoking `curl`(1). - - * `HOMEBREW_CURL_RETRIES`: - If set, Homebrew will pass the given retry count to `--retry` when invoking `curl`(1). - By default, `curl`(1) is invoked with `--retry 3`. - - * `HOMEBREW_DEBUG`: - If set, any commands that can emit debugging information will do so. - - * `HOMEBREW_DEVELOPER`: - If set, Homebrew will tweak behaviour to be more relevant for Homebrew - developers (active or budding), e.g. turning warnings into errors. - - * `HOMEBREW_DISPLAY`: - If set, Homebrew will use this X11 display when opening a page in a browser, - for example with `brew home`. Primarily useful on Linux. - - *Default:* the value of the user's `DISPLAY` environment variable. - - * `HOMEBREW_DISPLAY_INSTALL_TIMES`: - If set, Homebrew will print install times for each formula at the end of the run. - - * `HOMEBREW_EDITOR`: - If set, Homebrew will use this editor when editing a single formula, or - several formulae in the same directory. - - *Note:* `brew edit` will open all of Homebrew as discontinuous files and - directories. TextMate can handle this correctly in project mode, but many - editors will do strange things in this case. - - * `HOMEBREW_FORCE_BREWED_CURL`: - If set, Homebrew will always use a Homebrew-installed `curl` rather than the - system version. Automatically set if the system version of `curl` is too old. - - * `HOMEBREW_FORCE_VENDOR_RUBY`: - If set, Homebrew will always use its vendored, relocatable Ruby version - even if the system version of Ruby is new enough. - - * `HOMEBREW_FORCE_BREWED_GIT`: - If set, Homebrew will always use a Homebrew-installed `git`(1) rather than the - system version. Automatically set if the system version of `git` is too old. - - * `HOMEBREW_GITHUB_API_TOKEN`: - A personal access token for the GitHub API, used by Homebrew for features - such as `brew search`. You can create one at . - If set, GitHub will allow you a greater number of API requests. For more - information, see: - - *Note:* Homebrew doesn't require permissions for any of the scopes. - - * `HOMEBREW_INSTALL_BADGE`: - Text printed before the installation summary of each successful build. - - *Default:* the beer emoji. - - * `HOMEBREW_LOGS`: - If set, Homebrew will use the specified directory to store log files. - - * `HOMEBREW_MAKE_JOBS`: - If set, instructs Homebrew to use the value of `HOMEBREW_MAKE_JOBS` as - the number of parallel jobs to run when building with `make`(1). - - *Default:* the number of available CPU cores. - - * `HOMEBREW_NO_ANALYTICS`: - If set, Homebrew will not send analytics. See: - - * `HOMEBREW_NO_AUTO_UPDATE`: - If set, Homebrew will not auto-update before running `brew install`, - `brew upgrade` or `brew tap`. - - * `HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK`: - If set, Homebrew will fail on the failure of installation from a bottle - rather than falling back to building from source. - - * `HOMEBREW_NO_COLOR`: - If set, Homebrew will not print text with colour added. - - * `HOMEBREW_NO_EMOJI`: - If set, Homebrew will not print the `HOMEBREW_INSTALL_BADGE` on a - successful build. - - *Note:* Homebrew will only try to print emoji on OS X Lion or newer. - - * `HOMEBREW_NO_INSECURE_REDIRECT`: - If set, Homebrew will not permit redirects from secure HTTPS - to insecure HTTP. - - While ensuring your downloads are fully secure, this is likely - to cause from-source SourceForge, some GNU & GNOME based - formulae to fail to download. - - * `HOMEBREW_NO_GITHUB_API`: - If set, Homebrew will not use the GitHub API, e.g. for searches or - fetching relevant issues on a failed install. - - * `HOMEBREW_NO_INSTALL_CLEANUP`: - If set, `brew install`, `brew upgrade` and `brew reinstall` will never - automatically cleanup the installed/upgraded/reinstalled formulae or all - formulae every 30 days. - - * `HOMEBREW_PRY`: - If set, Homebrew will use Pry for the `brew irb` command. - - * `HOMEBREW_SVN`: - When exporting from Subversion, Homebrew will use `HOMEBREW_SVN` if set, - a Homebrew-built Subversion if installed, or the system-provided binary. - - Set this to force Homebrew to use a particular `svn` binary. - - * `HOMEBREW_TEMP`: - If set, instructs Homebrew to use `HOMEBREW_TEMP` as the temporary directory - for building packages. This may be needed if your system temp directory and - Homebrew prefix are on different volumes, as macOS has trouble moving - symlinks across volumes when the target does not yet exist. - - This issue typically occurs when using FileVault or custom SSD configurations. - - * `HOMEBREW_UPDATE_TO_TAG`: - If set, instructs Homebrew to always use the latest stable tag (even if - developer commands have been run). - - * `HOMEBREW_VERBOSE`: - If set, Homebrew always assumes `--verbose` when running commands. - - * `http_proxy`: - Sets the HTTP proxy to be used by `curl`, `git` and `svn` when downloading - through Homebrew. - - * `https_proxy`: - Sets the HTTPS proxy to be used by `curl`, `git` and `svn` when downloading - through Homebrew. - - * `all_proxy`: - Sets the SOCKS5 proxy to be used by `curl`, `git` and `svn` when downloading - through Homebrew. - - * `ftp_proxy`: - Sets the FTP proxy to be used by `curl`, `git` and `svn` when downloading - through Homebrew. - - * `no_proxy`: - Sets the comma-separated list of hostnames and domain names that should be excluded - from proxying by `curl`, `git` and `svn` when downloading through Homebrew. +<%= environment_variables %> ## USING HOMEBREW BEHIND A PROXY diff --git a/Library/Homebrew/os/linux/global.rb b/Library/Homebrew/os/linux/global.rb index ba0d2a969d..e0b8724930 100644 --- a/Library/Homebrew/os/linux/global.rb +++ b/Library/Homebrew/os/linux/global.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Homebrew - DEFAULT_PREFIX ||= if ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"] + DEFAULT_PREFIX ||= if Homebrew::EnvConfig.force_homebrew_on_linux? HOMEBREW_DEFAULT_PREFIX else LINUXBREW_DEFAULT_PREFIX diff --git a/Library/Homebrew/os/mac/mach.rb b/Library/Homebrew/os/mac/mach.rb index aa8baa5423..93cab7de4f 100644 --- a/Library/Homebrew/os/mac/mach.rb +++ b/Library/Homebrew/os/mac/mach.rb @@ -50,7 +50,7 @@ module MachOShim rescue # ... but complain about other (parse) errors for further investigation. onoe "Failed to read Mach-O binary: #{self}" - raise if ARGV.homebrew_developer? + raise if Homebrew::EnvConfig.developer? [] end diff --git a/Library/Homebrew/sandbox.rb b/Library/Homebrew/sandbox.rb index f461629661..5d0a3f030f 100644 --- a/Library/Homebrew/sandbox.rb +++ b/Library/Homebrew/sandbox.rb @@ -10,16 +10,16 @@ class Sandbox OS.mac? && File.executable?(SANDBOX_EXEC) end - def self.formula?(_formula) + def self.formula?(_) return false unless available? - !ARGV.no_sandbox? + !Homebrew.args.no_sandbox? end def self.test? return false unless available? - !ARGV.no_sandbox? + !Homebrew.args.no_sandbox? end def initialize @@ -127,7 +127,7 @@ class Sandbox end end - if @failed && ENV["HOMEBREW_VERBOSE"].present? + if @failed && Homebrew::EnvConfig.verbose? ohai "Sandbox log" puts logs $stdout.flush # without it, brew test-bot would fail to catch the log diff --git a/Library/Homebrew/search.rb b/Library/Homebrew/search.rb index 1da53e64a4..7bfb9edba3 100644 --- a/Library/Homebrew/search.rb +++ b/Library/Homebrew/search.rb @@ -30,7 +30,7 @@ module Homebrew results = { formulae: [], casks: [] } - return results if ENV["HOMEBREW_NO_GITHUB_API"] + return results if Homebrew::EnvConfig.no_github_api? unless silent # Use stderr to avoid breaking parsed output diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index f22a97f5bd..03cdd2762b 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -346,7 +346,7 @@ class BottleSpecification def root_url(var = nil, specs = {}) if var.nil? - @root_url ||= "#{HOMEBREW_BOTTLE_DOMAIN}/#{Utils::Bottles::Bintray.repository(tap)}" + @root_url ||= "#{Homebrew::EnvConfig.bottle_domain}/#{Utils::Bottles::Bintray.repository(tap)}" else @root_url = var @root_url_specs.merge!(specs) diff --git a/Library/Homebrew/system_config.rb b/Library/Homebrew/system_config.rb index 70c4f44484..def1702154 100644 --- a/Library/Homebrew/system_config.rb +++ b/Library/Homebrew/system_config.rb @@ -119,67 +119,37 @@ class SystemConfig else f.puts "Core tap: N/A" end - defaults_hash = { - HOMEBREW_PREFIX: Homebrew::DEFAULT_PREFIX, - HOMEBREW_REPOSITORY: Homebrew::DEFAULT_REPOSITORY, - HOMEBREW_CELLAR: Homebrew::DEFAULT_CELLAR, - HOMEBREW_CACHE: "#{ENV["HOME"]}/Library/Caches/Homebrew", - HOMEBREW_LOGS: "#{ENV["HOME"]}/Library/Logs/Homebrew", - HOMEBREW_TEMP: ENV["HOMEBREW_SYSTEM_TEMP"], - HOMEBREW_RUBY_WARNINGS: "-W0", - }.freeze - boring_keys = %w[ - HOMEBREW_BROWSER - HOMEBREW_EDITOR - - HOMEBREW_ANALYTICS_ID - HOMEBREW_ANALYTICS_USER_UUID - HOMEBREW_AUTO_UPDATE_CHECKED - HOMEBREW_BOTTLE_DEFAULT_DOMAIN - HOMEBREW_BOTTLE_DOMAIN - HOMEBREW_BREW_FILE - HOMEBREW_BREW_GIT_REMOTE - HOMEBREW_COMMAND_DEPTH - HOMEBREW_CORE_GIT_REMOTE - HOMEBREW_CURL - HOMEBREW_DISPLAY - HOMEBREW_GIT - HOMEBREW_GIT_CONFIG_FILE - HOMEBREW_LIBRARY - HOMEBREW_MACOS_VERSION - HOMEBREW_MACOS_VERSION_NUMERIC - HOMEBREW_MINIMUM_GIT_VERSION - HOMEBREW_RUBY_PATH - HOMEBREW_SYSTEM - HOMEBREW_SYSTEM_TEMP - HOMEBREW_OS_VERSION - HOMEBREW_PATH - HOMEBREW_PROCESSOR - HOMEBREW_PRODUCT - HOMEBREW_USER_AGENT - HOMEBREW_USER_AGENT_CURL - HOMEBREW_VERSION - ].freeze f.puts "HOMEBREW_PREFIX: #{HOMEBREW_PREFIX}" - [:HOMEBREW_CELLAR, :HOMEBREW_CACHE, :HOMEBREW_LOGS, :HOMEBREW_REPOSITORY, - :HOMEBREW_TEMP].each do |key| + { + HOMEBREW_REPOSITORY: Homebrew::DEFAULT_REPOSITORY, + HOMEBREW_CELLAR: Homebrew::DEFAULT_CELLAR, + }.freeze.each do |key, default| value = Object.const_get(key) - f.puts "#{key}: #{value}" if defaults_hash[key] != value.to_s + f.puts "#{key}: #{value}" if value.to_s != default.to_s end - if defaults_hash[:HOMEBREW_RUBY_WARNINGS] != ENV["HOMEBREW_RUBY_WARNINGS"].to_s - f.puts "HOMEBREW_RUBY_WARNINGS: #{ENV["HOMEBREW_RUBY_WARNINGS"]}" - end - unless ENV["HOMEBREW_ENV"] - ENV.sort.each do |key, value| - next unless key.start_with?("HOMEBREW_") - next if key.start_with?("HOMEBREW_BUNDLE_") - next if boring_keys.include?(key) - next if defaults_hash[key.to_sym] - value = "set" if ENV.sensitive?(key) - f.puts "#{key}: #{value}" + Homebrew::EnvConfig::ENVS.each do |env, hash| + method_name = Homebrew::EnvConfig.env_method_name(env, hash) + + if hash[:boolean] + f.puts "#{env}: set" if Homebrew::EnvConfig.send(method_name) + next + end + + value = Homebrew::EnvConfig.send(method_name) + next unless value + + if (default = hash[:default].presence) + next if value.to_s == default.to_s + end + + if ENV.sensitive?(env) + f.puts "#{env}: set" + else + f.puts "#{env}: #{value}" end end + f.puts hardware if hardware f.puts "Homebrew Ruby: #{describe_homebrew_ruby}" f.print "Clang: " diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index f89ae6be01..8721bbe0e7 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -272,7 +272,7 @@ class Tap begin safe_system "git", *args unless Readall.valid_tap?(self, aliases: true) - raise "Cannot tap #{name}: invalid syntax in tap!" unless ARGV.homebrew_developer? + raise "Cannot tap #{name}: invalid syntax in tap!" unless Homebrew::EnvConfig.developer? end rescue Interrupt, RuntimeError ignore_interrupts do @@ -641,12 +641,9 @@ class CoreTap < Tap end def install(full_clone: true, quiet: false, clone_target: nil, force_auto_update: nil) - if HOMEBREW_CORE_GIT_REMOTE != default_remote - puts "HOMEBREW_CORE_GIT_REMOTE set: using #{HOMEBREW_CORE_GIT_REMOTE} " \ - "for Homebrew/core Git remote URL." - clone_target ||= HOMEBREW_CORE_GIT_REMOTE - end - super(full_clone: full_clone, quiet: quiet, clone_target: clone_target, force_auto_update: force_auto_update) + remote = Homebrew::EnvConfig.core_git_remote + puts "HOMEBREW_CORE_GIT_REMOTE set: using #{remote} for Homebrew/core Git remote URL." if remote != default_remote + super(full_clone: full_clone, quiet: quiet, clone_target: remote, force_auto_update: force_auto_update) end # @private diff --git a/Library/Homebrew/test/.rubocop_todo.yml b/Library/Homebrew/test/.rubocop_todo.yml index 5d4d426c9c..1d91188e32 100644 --- a/Library/Homebrew/test/.rubocop_todo.yml +++ b/Library/Homebrew/test/.rubocop_todo.yml @@ -30,6 +30,7 @@ RSpec/FilePath: - 'checksum_verification_spec.rb' - 'cxxstdlib_spec.rb' - 'diagnostic_checks_spec.rb' + - 'env_config_spec.rb' - 'missing_formula_spec.rb' - 'os/linux/diagnostic_spec.rb' - 'os/mac/diagnostic_spec.rb' diff --git a/Library/Homebrew/test/cli/parser_spec.rb b/Library/Homebrew/test/cli/parser_spec.rb index 3061e484e8..0c3a90084d 100644 --- a/Library/Homebrew/test/cli/parser_spec.rb +++ b/Library/Homebrew/test/cli/parser_spec.rb @@ -13,8 +13,7 @@ describe Homebrew::CLI::Parser do } before do - allow(ENV).to receive(:[]) - allow(ENV).to receive(:[]).with("HOMEBREW_PRY").and_return("1") + allow(Homebrew::EnvConfig).to receive(:pry?).and_return(true) end it "parses short option" do @@ -181,18 +180,16 @@ describe Homebrew::CLI::Parser do end it "prioritizes cli arguments over env vars when they conflict" do - allow(ENV).to receive(:[]) - allow(ENV).to receive(:[]).with("HOMEBREW_SWITCH_A").and_return("1") - allow(ENV).to receive(:[]).with("HOMEBREW_SWITCH_B").and_return(nil) + allow(Homebrew::EnvConfig).to receive(:switch_a?).and_return(true) + allow(Homebrew::EnvConfig).to receive(:switch_b?).and_return(false) parser.parse(["--switch-b"]) expect(Homebrew.args.switch_a).to be_falsy expect(Homebrew.args).to be_switch_b end it "raises an exception on constraint violation when both are env vars" do - allow(ENV).to receive(:[]) - allow(ENV).to receive(:[]).with("HOMEBREW_SWITCH_A").and_return("1") - allow(ENV).to receive(:[]).with("HOMEBREW_SWITCH_B").and_return("1") + allow(Homebrew::EnvConfig).to receive(:switch_a?).and_return(true) + allow(Homebrew::EnvConfig).to receive(:switch_b?).and_return(true) expect { parser.parse([]) }.to raise_error(Homebrew::CLI::OptionConflictError) end end diff --git a/Library/Homebrew/test/emoji_spec.rb b/Library/Homebrew/test/emoji_spec.rb deleted file mode 100644 index 4343c37d11..0000000000 --- a/Library/Homebrew/test/emoji_spec.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -require "emoji" - -describe Emoji do - describe "#install_badge" do - subject { described_class.install_badge } - - before do - ENV.delete("HOMEBREW_INSTALL_BADGE") - end - - it "returns 🍺 by default" do - expect(subject).to eq "🍺" - end - - it "returns the contents of HOMEBREW_INSTALL_BADGE if set" do - ENV["HOMEBREW_INSTALL_BADGE"] = "foo" - expect(subject).to eq "foo" - end - end -end diff --git a/Library/Homebrew/test/env_config_spec.rb b/Library/Homebrew/test/env_config_spec.rb new file mode 100644 index 0000000000..cdc65adb98 --- /dev/null +++ b/Library/Homebrew/test/env_config_spec.rb @@ -0,0 +1,66 @@ +# frozen_string_literal: true + +require "diagnostic" + +describe Homebrew::EnvConfig do + subject(:env_config) { described_class } + + describe ".env_method_name" do + it "generates method names" do + expect(env_config.env_method_name("HOMEBREW_FOO", {})).to eql("foo") + end + + it "generates boolean method names" do + expect(env_config.env_method_name("HOMEBREW_BAR", boolean: true)).to eql("bar?") + end + end + + describe ".artifact_domain" do + it "returns value if set" do + ENV["HOMEBREW_ARTIFACT_DOMAIN"] = "https://brew.sh" + expect(env_config.artifact_domain).to eql("https://brew.sh") + end + + it "returns nil if empty" do + ENV["HOMEBREW_ARTIFACT_DOMAIN"] = "" + expect(env_config.artifact_domain).to be_nil + end + end + + describe ".auto_update_secs" do + it "returns value if set" do + ENV["HOMEBREW_AUTO_UPDATE_SECS"] = "360" + expect(env_config.auto_update_secs).to eql("360") + end + + it "returns default if unset" do + ENV["HOMEBREW_AUTO_UPDATE_SECS"] = nil + expect(env_config.auto_update_secs).to eql("300") + end + end + + describe ".bat?" do + it "returns true if set" do + ENV["HOMEBREW_BAT"] = "1" + expect(env_config.bat?).to be(true) + end + + it "returns false if unset" do + ENV["HOMEBREW_BAT"] = nil + expect(env_config.bat?).to be(false) + end + end + + describe ".make_jobs" do + it "returns value if positive" do + ENV["HOMEBREW_MAKE_JOBS"] = "4" + expect(env_config.make_jobs).to eql("4") + end + + it "returns default if negative" do + ENV["HOMEBREW_MAKE_JOBS"] = "-1" + expect(Hardware::CPU).to receive(:cores).and_return(16) + expect(env_config.make_jobs).to eql("16") + end + end +end diff --git a/Library/Homebrew/test/utils/bottles/collector_spec.rb b/Library/Homebrew/test/utils/bottles/collector_spec.rb index 8a438193dd..91a1a25b34 100644 --- a/Library/Homebrew/test/utils/bottles/collector_spec.rb +++ b/Library/Homebrew/test/utils/bottles/collector_spec.rb @@ -26,7 +26,8 @@ describe Utils::Bottles::Collector do end it "does not use older tags when requested not to", :needs_macos do - allow(ARGV).to receive(:skip_or_later_bottles?).and_return(true) + allow(Homebrew::EnvConfig).to receive(:developer?).and_return(true) + allow(Homebrew::EnvConfig).to receive(:skip_or_later_bottles?).and_return(true) allow(OS::Mac).to receive(:prerelease?).and_return(true) subject[:mavericks] = "foo" expect(subject.send(:find_matching_tag, :mavericks)).to eq(:mavericks) diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 65f6492a15..d4e8fa2536 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true -require "emoji" require "utils/analytics" require "utils/curl" require "utils/fork" @@ -177,7 +176,7 @@ module Kernel message << tap_message if tap_message message.freeze - if ARGV.homebrew_developer? || disable || Homebrew.raise_deprecation_exceptions? + if Homebrew::EnvConfig.developer? || disable || Homebrew.raise_deprecation_exceptions? exception = MethodDeprecatedError.new(message) exception.set_backtrace(backtrace) raise exception @@ -194,20 +193,20 @@ module Kernel def pretty_installed(f) if !$stdout.tty? f.to_s - elsif Emoji.enabled? - "#{Tty.bold}#{f} #{Formatter.success("✔")}#{Tty.reset}" - else + elsif Homebrew::EnvConfig.no_emoji? Formatter.success("#{Tty.bold}#{f} (installed)#{Tty.reset}") + else + "#{Tty.bold}#{f} #{Formatter.success("✔")}#{Tty.reset}" end end def pretty_uninstalled(f) if !$stdout.tty? f.to_s - elsif Emoji.enabled? - "#{Tty.bold}#{f} #{Formatter.error("✘")}#{Tty.reset}" - else + elsif Homebrew::EnvConfig.no_emoji? Formatter.error("#{Tty.bold}#{f} (uninstalled)#{Tty.reset}") + else + "#{Tty.bold}#{f} #{Formatter.error("✘")}#{Tty.reset}" end end @@ -304,10 +303,7 @@ module Kernel end def which_editor - editor = ENV.values_at("HOMEBREW_EDITOR", "HOMEBREW_VISUAL") - .compact - .reject(&:empty?) - .first + editor = Homebrew::EnvConfig.editor return editor if editor # Find Atom, Sublime Text, Textmate, BBEdit / TextWrangler, or vim @@ -331,11 +327,11 @@ module Kernel end def exec_browser(*args) - browser = ENV["HOMEBREW_BROWSER"] + browser = Homebrew::EnvConfig.browser browser ||= OS::PATH_OPEN if defined?(OS::PATH_OPEN) return unless browser - ENV["DISPLAY"] = ENV["HOMEBREW_DISPLAY"] + ENV["DISPLAY"] = Homebrew::EnvConfig.display safe_system(browser, *args) end diff --git a/Library/Homebrew/utils/analytics.rb b/Library/Homebrew/utils/analytics.rb index 882f11315e..eea5d8fe18 100644 --- a/Library/Homebrew/utils/analytics.rb +++ b/Library/Homebrew/utils/analytics.rb @@ -12,7 +12,7 @@ module Utils args = [] # do not load .curlrc unless requested (must be the first argument) - args << "--disable" unless ENV["HOMEBREW_CURLRC"] + args << "--disable" unless Homebrew::EnvConfig.curlrc? args += %W[ --max-time 3 @@ -78,7 +78,7 @@ module Utils end def disabled? - return true if ENV["HOMEBREW_NO_ANALYTICS"] + return true if Homebrew::EnvConfig.no_analytics? config_true?(:analyticsdisabled) end @@ -308,7 +308,7 @@ module Utils end def formulae_api_json(endpoint) - return if ENV["HOMEBREW_NO_ANALYTICS"] || ENV["HOMEBREW_NO_GITHUB_API"] + return if Homebrew::EnvConfig.no_analytics? || Homebrew::EnvConfig.no_github_api? output, = curl_output("--max-time", "5", "https://formulae.brew.sh/api/#{endpoint}") diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb index d8ff9a0984..25d5e2235b 100644 --- a/Library/Homebrew/utils/curl.rb +++ b/Library/Homebrew/utils/curl.rb @@ -17,7 +17,7 @@ def curl_args(*extra_args, show_output: false, user_agent: :default) args = [] # do not load .curlrc unless requested (must be the first argument) - args << "--disable" unless ENV["HOMEBREW_CURLRC"] + args << "--disable" unless Homebrew::EnvConfig.curlrc? args << "--globoff" @@ -35,12 +35,11 @@ def curl_args(*extra_args, show_output: false, user_agent: :default) unless show_output args << "--fail" args << "--progress-bar" unless Homebrew.args.verbose? - args << "--verbose" if ENV["HOMEBREW_CURL_VERBOSE"] + args << "--verbose" if Homebrew::EnvConfig.curl_verbose? args << "--silent" unless $stdout.tty? end - # When changing the default value, the manpage has to be updated. - args << "--retry" << (ENV["HOMEBREW_CURL_RETRIES"] || "3") + args << "--retry" << Homebrew::EnvConfig.curl_retries args + extra_args end @@ -128,7 +127,7 @@ def curl_check_http_content(url, user_agents: [:default], check_content: false, return "The URL #{url} is not reachable (HTTP status code #{details[:status]})" end - if url.start_with?("https://") && ENV["HOMEBREW_NO_INSECURE_REDIRECT"] && + if url.start_with?("https://") && Homebrew::EnvConfig.no_insecure_redirect? && !details[:final_url].start_with?("https://") return "The URL #{url} redirects back to HTTP" end diff --git a/Library/Homebrew/utils/git.rb b/Library/Homebrew/utils/git.rb index 289fc64fdd..fadc35de36 100644 --- a/Library/Homebrew/utils/git.rb +++ b/Library/Homebrew/utils/git.rb @@ -103,11 +103,15 @@ module Utils quiet_system "git", "ls-remote", url end - def self.set_git_name_email! - return unless ENV["HOMEBREW_GIT_NAME"] - return unless ENV["HOMEBREW_GIT_EMAIL"] + def self.set_git_name_email!(author: true, committer: true) + if Homebrew::EnvConfig.git_name + ENV["GIT_AUTHOR_NAME"] = Homebrew::EnvConfig.git_name if author + ENV["GIT_COMMITTER_NAME"] = Homebrew::EnvConfig.git_name if committer + end - ENV["GIT_AUTHOR_NAME"] = ENV["GIT_COMMITTER_NAME"] = ENV["HOMEBREW_GIT_NAME"] - ENV["GIT_AUTHOR_EMAIL"] = ENV["GIT_COMMITTER_EMAIL"] = ENV["HOMEBREW_GIT_EMAIL"] + return unless Homebrew::EnvConfig.git_email + + ENV["GIT_AUTHOR_EMAIL"] = Homebrew::EnvConfig.git_email if author + ENV["GIT_COMMITTER_EMAIL"] = Homebrew::EnvConfig.git_email if committer end end diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index e84a68d2f2..acce9e5bde 100644 --- a/Library/Homebrew/utils/github.rb +++ b/Library/Homebrew/utils/github.rb @@ -49,7 +49,7 @@ module GitHub def initialize(github_message) @github_message = github_message message = +"GitHub #{github_message}:" - message << if ENV["HOMEBREW_GITHUB_API_TOKEN"] + message << if Homebrew::EnvConfig.github_api_token <<~EOS HOMEBREW_GITHUB_API_TOKEN may be invalid or expired; check: #{Formatter.url("https://github.com/settings/tokens")} @@ -80,15 +80,11 @@ module GitHub end end - def env_token - ENV["HOMEBREW_GITHUB_API_TOKEN"].presence - end - def env_username_password - return if ENV["HOMEBREW_GITHUB_API_USERNAME"].blank? - return if ENV["HOMEBREW_GITHUB_API_PASSWORD"].blank? + return unless Homebrew::EnvConfig.github_api_username + return unless Homebrew::EnvConfig.github_api_password - [ENV["HOMEBREW_GITHUB_API_PASSWORD"], ENV["HOMEBREW_GITHUB_API_USERNAME"]] + [Homebrew::EnvConfig.github_api_password, Homebrew::EnvConfig.github_api_username] end def keychain_username_password @@ -117,12 +113,12 @@ module GitHub def api_credentials @api_credentials ||= begin - env_token || env_username_password || keychain_username_password + Homebrew::EnvConfig.github_api_token || env_username_password || keychain_username_password end end def api_credentials_type - if env_token + if Homebrew::EnvConfig.github_api_token :env_token elsif env_username_password :env_username_password @@ -174,7 +170,7 @@ module GitHub def open_api(url, data: nil, request_method: nil, scopes: [].freeze, parse_json: true) # This is a no-op if the user is opting out of using the GitHub API. - return block_given? ? yield({}) : {} if ENV["HOMEBREW_NO_GITHUB_API"] + return block_given? ? yield({}) : {} if Homebrew::EnvConfig.no_github_api? args = ["--header", "Accept: application/vnd.github.v3+json", "--write-out", "\n%\{http_code}"] args += ["--header", "Accept: application/vnd.github.antiope-preview+json"] diff --git a/Library/Homebrew/utils/tty.rb b/Library/Homebrew/utils/tty.rb index 3f69e508f5..4e7044c857 100644 --- a/Library/Homebrew/utils/tty.rb +++ b/Library/Homebrew/utils/tty.rb @@ -72,8 +72,8 @@ module Tty end def color? - return false if ENV["HOMEBREW_NO_COLOR"] - return true if ENV["HOMEBREW_COLOR"] + return false if Homebrew::EnvConfig.no_color? + return true if Homebrew::EnvConfig.color? $stdout.tty? end diff --git a/bin/brew b/bin/brew index 5206997402..ef4cc6ef49 100755 --- a/bin/brew +++ b/bin/brew @@ -62,8 +62,7 @@ HOMEBREW_LIBRARY="$HOMEBREW_REPOSITORY/Library" # Whitelist and copy to HOMEBREW_* all variables previously mentioned in # manpage or used elsewhere by Homebrew. -for VAR in AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY BINTRAY_USER BINTRAY_KEY \ - BROWSER DISPLAY EDITOR GIT NO_COLOR PATH VISUAL +for VAR in BROWSER DISPLAY EDITOR NO_COLOR PATH do # Skip if variable value is empty. [[ -z "${!VAR}" ]] && continue @@ -74,6 +73,12 @@ do export "$VAR_NEW"="${!VAR}" done +# Use VISUAL if HOMEBREW_EDITOR and EDITOR are unset. +if [[ -z "$HOMEBREW_EDITOR" && -n "$VISUAL" ]] +then + export HOMEBREW_EDITOR="$VISUAL" +fi + # Set CI variable for GitHub Actions, Azure Pipelines, Jenkins # (Set by default on Circle and Travis CI) if [[ -n "$GITHUB_ACTIONS" || -n "$TF_BUILD" || -n "$JENKINS_HOME" ]] @@ -90,7 +95,7 @@ then # Filter all but the specific variables. for VAR in HOME SHELL PATH TERM TERMINFO COLUMNS DISPLAY LOGNAME USER CI SSH_AUTH_SOCK SUDO_ASKPASS \ http_proxy https_proxy ftp_proxy no_proxy all_proxy HTTPS_PROXY FTP_PROXY ALL_PROXY \ - "${!HOMEBREW_@}" "${!TRAVIS_@}" + "${!HOMEBREW_@}" do # Skip if variable value is empty. [[ -z "${!VAR}" ]] && continue diff --git a/docs/Manpage.md b/docs/Manpage.md index 2982e3ff79..d333fd1e2c 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -1176,204 +1176,206 @@ Note that environment variables must have a value set to be detected. For exampl `export HOMEBREW_NO_INSECURE_REDIRECT`. * `HOMEBREW_ARCH`: - Linux only: If set, Homebrew will pass the set value to type name to the compiler's - `-march` option instead of using the default (`-march=native`). + Linux only: Homebrew will pass the set value to type name to the compiler's `-march` option. + + *Default:* `native`. * `HOMEBREW_ARTIFACT_DOMAIN`: - If set, instructs Homebrew to prefix all download URLs, including those for bottles, - with this variable. For example, `HOMEBREW_ARTIFACT_DOMAIN=http://localhost:8080` - will cause a formula with the URL `https://example.com/foo.tar.gz` to instead - download from `http://localhost:8080/example.com/foo.tar.gz`. + Instructs Homebrew to prefix all download URLs, including those for bottles, with this variable. For example, `HOMEBREW_ARTIFACT_DOMAIN=http://localhost:8080` will cause a formula with the URL `https://example.com/foo.tar.gz` to instead download from `http://localhost:8080/example.com/foo.tar.gz`. * `HOMEBREW_AUTO_UPDATE_SECS`: - If set, Homebrew will only check for autoupdates once per this seconds interval. + Homebrew will only check for autoupdates once per this seconds interval. *Default:* `300`. - * `HOMEBREW_AWS_ACCESS_KEY_ID`, `HOMEBREW_AWS_SECRET_ACCESS_KEY`: - When using the `S3` download strategy, Homebrew will look in - these variables for access credentials (see - - to retrieve these access credentials from AWS). If they are not set, - the `S3` download strategy will download with a public (unsigned) URL. - * `HOMEBREW_BAT`: - If set, Homebrew will use `bat` for the `brew cat` command. + Homebrew will use `bat` for the `brew cat` command. + + * `HOMEBREW_BINTRAY_KEY`: + Homebrew uses this API key when accessing the Bintray API (where bottles are stored). + + * `HOMEBREW_BINTRAY_USER`: + Homebrew uses this username when accessing the Bintray API (where bottles are stored). * `HOMEBREW_BOTTLE_DOMAIN`: - By default, Homebrew uses `https://homebrew.bintray.com/` as its download - mirror for bottles. If set, instructs Homebrew to instead use the specified - URL. For example, `HOMEBREW_BOTTLE_DOMAIN=http://localhost:8080` will - cause all bottles to download from the prefix `http://localhost:8080/`. + Instructs Homebrew to use the specified URL as its download mirror for bottles. For example, `HOMEBREW_BOTTLE_DOMAIN=http://localhost:8080` will cause all bottles to download from the prefix `http://localhost:8080/`. + + *Default:* macOS: `https://homebrew.bintray.com/`, Linux: `https://linuxbrew.bintray.com/`. * `HOMEBREW_BREW_GIT_REMOTE`: - By default, Homebrew uses `https://github.com/Homebrew/brew` as its - Homebrew/brew `git`(1) remote. If set, instructs Homebrew to instead use - the specified URL. + Instructs Homebrew to use the specified URL as its Homebrew/brew `git`(1) remote. + + *Default:* `https://github.com/Homebrew/brew`. * `HOMEBREW_BROWSER`: - If set, Homebrew uses this setting as the browser when opening project - homepages, instead of the OS default browser. + Homebrew uses this setting as the browser when opening project homepages. + + *Default:* `$BROWSER` or the OS's default browser. * `HOMEBREW_CACHE`: - If set, instructs Homebrew to use the specified directory as the download cache. + Instructs Homebrew to use the specified directory as the download cache. - *Default:* `~/Library/Caches/Homebrew`. + *Default:* macOS: `$HOME/Library/Caches/Homebrew`, Linux: `$XDG_CACHE_HOME/Homebrew` or `$HOME/.cache/Homebrew`. + + * `HOMEBREW_COLOR`: + Homebrew force colour output on non-TTY outputs. * `HOMEBREW_CORE_GIT_REMOTE`: - By default, Homebrew uses `https://github.com/Homebrew/homebrew-core` (or - `https://github.com/Homebrew/linuxbrew-core`) as its Homebrew/homebrew-core - `git`(1) remote. If set, instructs Homebrew to instead use the specified URL. + instructs Homebrew to use the specified URL as its Homebrew/homebrew-core `git`(1) remote. + + *Default:* macOS: `https://github.com/Homebrew/homebrew-core`, Linux: `https://github.com/Homebrew/linuxbrew-core`. * `HOMEBREW_CURLRC`: - If set, Homebrew will not pass `--disable` when invoking `curl`(1), which disables - the use of `curlrc`. - - * `HOMEBREW_CURL_VERBOSE`: - If set, Homebrew will pass `--verbose` when invoking `curl`(1). + Homebrew will not pass `--disable` when invoking `curl`(1), which disables the use of `curlrc`. * `HOMEBREW_CURL_RETRIES`: - If set, Homebrew will pass the given retry count to `--retry` when invoking `curl`(1). - By default, `curl`(1) is invoked with `--retry 3`. + Homebrew will pass the given retry count to `--retry` when invoking `curl`(1). - * `HOMEBREW_DEBUG`: - If set, any commands that can emit debugging information will do so. + *Default:* `3`. + + * `HOMEBREW_CURL_VERBOSE`: + Homebrew will pass `--verbose` when invoking `curl`(1). * `HOMEBREW_DEVELOPER`: - If set, Homebrew will tweak behaviour to be more relevant for Homebrew - developers (active or budding), e.g. turning warnings into errors. + Homebrew will tweak behaviour to be more relevant for Homebrew developers (active or budding), e.g. turning warnings into errors. + + * `HOMEBREW_DISABLE_LOAD_FORMULA`: + Homebrew will refuse to load formulae. This is useful when formulae are not trusted (such as in pull requests). * `HOMEBREW_DISPLAY`: - If set, Homebrew will use this X11 display when opening a page in a browser, - for example with `brew home`. Primarily useful on Linux. + Homebrew will use this X11 display when opening a page in a browser, for example with `brew home`. Primarily useful on Linux. - *Default:* the value of the user's `DISPLAY` environment variable. + *Default:* `$DISPLAY`. * `HOMEBREW_DISPLAY_INSTALL_TIMES`: - If set, Homebrew will print install times for each formula at the end of the run. + Homebrew will print install times for each formula at the end of the run. * `HOMEBREW_EDITOR`: - If set, Homebrew will use this editor when editing a single formula, or - several formulae in the same directory. + Homebrew will use this editor when editing a single formula, or several formulae in the same directory. - *Note:* `brew edit` will open all of Homebrew as discontinuous files and - directories. TextMate can handle this correctly in project mode, but many - editors will do strange things in this case. + *Note:* `brew edit` will open all of Homebrew as discontinuous files and directories. Visual Studio Code can handle this correctly in project mode, but many editors will do strange things in this case. + + *Default:* `$EDITOR` or `$VISUAL`. + + * `HOMEBREW_FAIL_LOG_LINES`: + Homebrew will output this many lines of output on formula `system` failures. + + *Default:* `15`. * `HOMEBREW_FORCE_BREWED_CURL`: - If set, Homebrew will always use a Homebrew-installed `curl` rather than the - system version. Automatically set if the system version of `curl` is too old. - - * `HOMEBREW_FORCE_VENDOR_RUBY`: - If set, Homebrew will always use its vendored, relocatable Ruby version - even if the system version of Ruby is new enough. + Homebrew will always use a Homebrew-installed `curl`(1) rather than the system version. Automatically set if the system version of `curl` is too old. * `HOMEBREW_FORCE_BREWED_GIT`: - If set, Homebrew will always use a Homebrew-installed `git`(1) rather than the - system version. Automatically set if the system version of `git` is too old. + Homebrew will always use a Homebrew-installed `git`(1) rather than the system version. Automatically set if the system version of `git` is too old. + + * `HOMEBREW_FORCE_HOMEBREW_ON_LINUX`: + Homebrew running on Linux will use URLs for Homebrew on macOS. This is useful when mergingpull requests on Linux for macOS. + + * `HOMEBREW_FORCE_VENDOR_RUBY`: + Homebrew will always use its vendored, relocatable Ruby version even if the system version of Ruby is new enough. + + * `HOMEBREW_GITHUB_API_PASSWORD`: + GitHub password for authentication with the GitHub API, used by Homebrew for featuressuch as `brew search`. We strongly recommend using `HOMEBREW_GITHUB_API_TOKEN` instead. * `HOMEBREW_GITHUB_API_TOKEN`: - A personal access token for the GitHub API, used by Homebrew for features - such as `brew search`. You can create one at . - If set, GitHub will allow you a greater number of API requests. For more - information, see: + A personal access token for the GitHub API, used by Homebrew for features such as `brew search`. You can create one at . If set, GitHub will allow you a greater number of API requests. For more information, see: *Note:* Homebrew doesn't require permissions for any of the scopes. + * `HOMEBREW_GITHUB_API_USERNAME`: + GitHub username for authentication with the GitHub API, used by Homebrew for features such as `brew search`. We strongly recommend using `HOMEBREW_GITHUB_API_TOKEN` instead. + + * `HOMEBREW_GIT_EMAIL`: + Homebrew will set the Git author and committer name to this value. + + * `HOMEBREW_GIT_NAME`: + Homebrew will set the Git author and committer email to this value. + * `HOMEBREW_INSTALL_BADGE`: Text printed before the installation summary of each successful build. - *Default:* the beer emoji. + *Default:* The "Beer Mug" emoji. * `HOMEBREW_LOGS`: - If set, Homebrew will use the specified directory to store log files. + IHomebrew will use the specified directory to store log files. + + *Default:* macOS: `$HOME/Library/Logs/Homebrew`, Linux: `$XDG_CACHE_HOME/Homebrew/Logs` or `$HOME/.cache/Homebrew/Logs`. * `HOMEBREW_MAKE_JOBS`: - If set, instructs Homebrew to use the value of `HOMEBREW_MAKE_JOBS` as - the number of parallel jobs to run when building with `make`(1). + Instructs Homebrew to use the value of `HOMEBREW_MAKE_JOBS` as the number of parallel jobs to run when building with `make`(1). - *Default:* the number of available CPU cores. + *Default:* The number of available CPU cores. * `HOMEBREW_NO_ANALYTICS`: - If set, Homebrew will not send analytics. See: + Homebrew will not send analytics. See: . * `HOMEBREW_NO_AUTO_UPDATE`: - If set, Homebrew will not auto-update before running `brew install`, - `brew upgrade` or `brew tap`. + Homebrew will not auto-update before running `brew install`, `brew upgrade` or `brew tap`. * `HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK`: - If set, Homebrew will fail on the failure of installation from a bottle - rather than falling back to building from source. + Homebrew will fail on the failure of installation from a bottle rather than falling back to building from source. * `HOMEBREW_NO_COLOR`: - If set, Homebrew will not print text with colour added. + Homebrew will not print text with colour added. + + *Default:* `$NO_COLOR`. + + * `HOMEBREW_NO_COMPAT`: + Homebrew disables all use of legacy compatibility code. * `HOMEBREW_NO_EMOJI`: - If set, Homebrew will not print the `HOMEBREW_INSTALL_BADGE` on a - successful build. + Homebrew will not print the `HOMEBREW_INSTALL_BADGE` on a successful build. *Note:* Homebrew will only try to print emoji on OS X Lion or newer. - * `HOMEBREW_NO_INSECURE_REDIRECT`: - If set, Homebrew will not permit redirects from secure HTTPS - to insecure HTTP. - - While ensuring your downloads are fully secure, this is likely - to cause from-source SourceForge, some GNU & GNOME based - formulae to fail to download. - * `HOMEBREW_NO_GITHUB_API`: - If set, Homebrew will not use the GitHub API, e.g. for searches or - fetching relevant issues on a failed install. + Homebrew will not use the GitHub API, e.g. for searches or fetching relevant issues on a failed install. + + * `HOMEBREW_NO_INSECURE_REDIRECT`: + Homebrew will not permit redirects from secure HTTPS to insecure HTTP. + + *Note:* While ensuring your downloads are fully secure, this is likely to cause from-source SourceForge, some GNU & GNOME based formulae to fail to download. * `HOMEBREW_NO_INSTALL_CLEANUP`: - If set, `brew install`, `brew upgrade` and `brew reinstall` will never - automatically cleanup the installed/upgraded/reinstalled formulae or all - formulae every 30 days. + `brew install`, `brew upgrade` and `brew reinstall` will never automatically cleanup installed/upgraded/reinstalled formulae or all formulae every 30 days. * `HOMEBREW_PRY`: - If set, Homebrew will use Pry for the `brew irb` command. + Homebrew will use Pry for the `brew irb` command. + + * `HOMEBREW_SKIP_OR_LATER_BOTTLES`: + Along with `HOMEBREW_DEVELOPER` Homebrew will not use bottles from older versions of macOS. This is useful in Homebrew development on new macOS versions. * `HOMEBREW_SVN`: - When exporting from Subversion, Homebrew will use `HOMEBREW_SVN` if set, - a Homebrew-built Subversion if installed, or the system-provided binary. - - Set this to force Homebrew to use a particular `svn` binary. + Forces Homebrew to use a particular `svn` binary. Otherwise, a Homebrew-built Subversion if installed, or the system-provided binary. * `HOMEBREW_TEMP`: - If set, instructs Homebrew to use `HOMEBREW_TEMP` as the temporary directory - for building packages. This may be needed if your system temp directory and - Homebrew prefix are on different volumes, as macOS has trouble moving - symlinks across volumes when the target does not yet exist. + Instructs Homebrew to use `HOMEBREW_TEMP` as the temporary directory for building packages. This may be needed if your system temp directory and Homebrew prefix are on different volumes, as macOS has trouble moving symlinks across volumes when the targetdoes not yet exist. This issue typically occurs when using FileVault or custom SSDconfigurations. - This issue typically occurs when using FileVault or custom SSD configurations. + *Default:* macOS: `/private/tmp`, Linux: `/tmp`. * `HOMEBREW_UPDATE_TO_TAG`: - If set, instructs Homebrew to always use the latest stable tag (even if - developer commands have been run). + Instructs Homebrew to always use the latest stable tag (even if developer commands have been run). * `HOMEBREW_VERBOSE`: - If set, Homebrew always assumes `--verbose` when running commands. + Homebrew always assumes `--verbose` when running commands. - * `http_proxy`: - Sets the HTTP proxy to be used by `curl`, `git` and `svn` when downloading - through Homebrew. - - * `https_proxy`: - Sets the HTTPS proxy to be used by `curl`, `git` and `svn` when downloading - through Homebrew. + * `HOMEBREW_VERBOSE_USING_DOTS`: + Homebrew's verbose output will print a `.` no more than once a minute. This can be useful to avoid long-running Homebrew commands being killed due to no output. * `all_proxy`: - Sets the SOCKS5 proxy to be used by `curl`, `git` and `svn` when downloading - through Homebrew. + Sets the SOCKS5 proxy to be used by `curl`(1), `git`(1) and `svn`(1) when downloading through Homebrew. * `ftp_proxy`: - Sets the FTP proxy to be used by `curl`, `git` and `svn` when downloading - through Homebrew. + Sets the FTP proxy to be used by `curl`(1), `git`(1) and `svn`(1) when downloading through Homebrew. + + * `http_proxy`: + Sets the HTTP proxy to be used by `curl`(1), `git`(1) and `svn`(1) when downloading through Homebrew. + + * `https_proxy`: + Sets the HTTPS proxy to be used by `curl`(1), `git`(1) and `svn`(1) when downloading through Homebrew. * `no_proxy`: - Sets the comma-separated list of hostnames and domain names that should be excluded - from proxying by `curl`, `git` and `svn` when downloading through Homebrew. + Sets the comma-separated list of hostnames and domain names that should be excluded from proxying by `curl`(1), `git`(1) and `svn`(1) when downloading through Homebrew. ## USING HOMEBREW BEHIND A PROXY diff --git a/manpages/brew-cask.1 b/manpages/brew-cask.1 index 7378de5812..f9487b6347 100644 --- a/manpages/brew-cask.1 +++ b/manpages/brew-cask.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BREW\-CASK" "1" "March 2020" "Homebrew" "brew-cask" +.TH "BREW\-CASK" "1" "April 2020" "Homebrew" "brew-cask" . .SH "NAME" \fBbrew\-cask\fR \- a friendly binary installer for macOS diff --git a/manpages/brew.1 b/manpages/brew.1 index f182cbb489..0b3cb2b129 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BREW" "1" "March 2020" "Homebrew" "brew" +.TH "BREW" "1" "April 2020" "Homebrew" "brew" . .SH "NAME" \fBbrew\fR \- The Missing Package Manager for macOS @@ -1492,99 +1492,143 @@ Note that environment variables must have a value set to be detected\. For examp . .TP \fBHOMEBREW_ARCH\fR -Linux only: If set, Homebrew will pass the set value to type name to the compiler\'s \fB\-march\fR option instead of using the default (\fB\-march=native\fR)\. +Linux only: Homebrew will pass the set value to type name to the compiler\'s \fB\-march\fR option\. +. +.IP +\fIDefault:\fR \fBnative\fR\. . .TP \fBHOMEBREW_ARTIFACT_DOMAIN\fR -If set, instructs Homebrew to prefix all download URLs, including those for bottles, with this variable\. For example, \fBHOMEBREW_ARTIFACT_DOMAIN=http://localhost:8080\fR will cause a formula with the URL \fBhttps://example\.com/foo\.tar\.gz\fR to instead download from \fBhttp://localhost:8080/example\.com/foo\.tar\.gz\fR\. +Instructs Homebrew to prefix all download URLs, including those for bottles, with this variable\. For example, \fBHOMEBREW_ARTIFACT_DOMAIN=http://localhost:8080\fR will cause a formula with the URL \fBhttps://example\.com/foo\.tar\.gz\fR to instead download from \fBhttp://localhost:8080/example\.com/foo\.tar\.gz\fR\. . .TP \fBHOMEBREW_AUTO_UPDATE_SECS\fR -If set, Homebrew will only check for autoupdates once per this seconds interval\. +Homebrew will only check for autoupdates once per this seconds interval\. . .IP \fIDefault:\fR \fB300\fR\. . .TP -\fBHOMEBREW_AWS_ACCESS_KEY_ID\fR, \fBHOMEBREW_AWS_SECRET_ACCESS_KEY\fR -When using the \fBS3\fR download strategy, Homebrew will look in these variables for access credentials (see \fIhttps://docs\.aws\.amazon\.com/cli/latest/userguide/cli\-chap\-getting\-started\.html#cli\-environment\fR to retrieve these access credentials from AWS)\. If they are not set, the \fBS3\fR download strategy will download with a public (unsigned) URL\. +\fBHOMEBREW_BAT\fR +Homebrew will use \fBbat\fR for the \fBbrew cat\fR command\. . .TP -\fBHOMEBREW_BAT\fR -If set, Homebrew will use \fBbat\fR for the \fBbrew cat\fR command\. +\fBHOMEBREW_BINTRAY_KEY\fR +Homebrew uses this API key when accessing the Bintray API (where bottles are stored)\. +. +.TP +\fBHOMEBREW_BINTRAY_USER\fR +Homebrew uses this username when accessing the Bintray API (where bottles are stored)\. . .TP \fBHOMEBREW_BOTTLE_DOMAIN\fR -By default, Homebrew uses \fBhttps://homebrew\.bintray\.com/\fR as its download mirror for bottles\. If set, instructs Homebrew to instead use the specified URL\. For example, \fBHOMEBREW_BOTTLE_DOMAIN=http://localhost:8080\fR will cause all bottles to download from the prefix \fBhttp://localhost:8080/\fR\. +Instructs Homebrew to use the specified URL as its download mirror for bottles\. For example, \fBHOMEBREW_BOTTLE_DOMAIN=http://localhost:8080\fR will cause all bottles to download from the prefix \fBhttp://localhost:8080/\fR\. +. +.IP +\fIDefault:\fR macOS: \fBhttps://homebrew\.bintray\.com/\fR, Linux: \fBhttps://linuxbrew\.bintray\.com/\fR\. . .TP \fBHOMEBREW_BREW_GIT_REMOTE\fR -By default, Homebrew uses \fBhttps://github\.com/Homebrew/brew\fR as its Homebrew/brew \fBgit\fR(1) remote\. If set, instructs Homebrew to instead use the specified URL\. +Instructs Homebrew to use the specified URL as its Homebrew/brew \fBgit\fR(1) remote\. +. +.IP +\fIDefault:\fR \fBhttps://github\.com/Homebrew/brew\fR\. . .TP \fBHOMEBREW_BROWSER\fR -If set, Homebrew uses this setting as the browser when opening project homepages, instead of the OS default browser\. +Homebrew uses this setting as the browser when opening project homepages\. +. +.IP +\fIDefault:\fR \fB$BROWSER\fR or the OS\'s default browser\. . .TP \fBHOMEBREW_CACHE\fR -If set, instructs Homebrew to use the specified directory as the download cache\. +Instructs Homebrew to use the specified directory as the download cache\. . .IP -\fIDefault:\fR \fB~/Library/Caches/Homebrew\fR\. +\fIDefault:\fR macOS: \fB$HOME/Library/Caches/Homebrew\fR, Linux: \fB$XDG_CACHE_HOME/Homebrew\fR or \fB$HOME/\.cache/Homebrew\fR\. +. +.TP +\fBHOMEBREW_COLOR\fR +Homebrew force colour output on non\-TTY outputs\. . .TP \fBHOMEBREW_CORE_GIT_REMOTE\fR -By default, Homebrew uses \fBhttps://github\.com/Homebrew/homebrew\-core\fR (or \fBhttps://github\.com/Homebrew/linuxbrew\-core\fR) as its Homebrew/homebrew\-core \fBgit\fR(1) remote\. If set, instructs Homebrew to instead use the specified URL\. +instructs Homebrew to use the specified URL as its Homebrew/homebrew\-core \fBgit\fR(1) remote\. +. +.IP +\fIDefault:\fR macOS: \fBhttps://github\.com/Homebrew/homebrew\-core\fR, Linux: \fBhttps://github\.com/Homebrew/linuxbrew\-core\fR\. . .TP \fBHOMEBREW_CURLRC\fR -If set, Homebrew will not pass \fB\-\-disable\fR when invoking \fBcurl\fR(1), which disables the use of \fBcurlrc\fR\. -. -.TP -\fBHOMEBREW_CURL_VERBOSE\fR -If set, Homebrew will pass \fB\-\-verbose\fR when invoking \fBcurl\fR(1)\. +Homebrew will not pass \fB\-\-disable\fR when invoking \fBcurl\fR(1), which disables the use of \fBcurlrc\fR\. . .TP \fBHOMEBREW_CURL_RETRIES\fR -If set, Homebrew will pass the given retry count to \fB\-\-retry\fR when invoking \fBcurl\fR(1)\. By default, \fBcurl\fR(1) is invoked with \fB\-\-retry 3\fR\. +Homebrew will pass the given retry count to \fB\-\-retry\fR when invoking \fBcurl\fR(1)\. +. +.IP +\fIDefault:\fR \fB3\fR\. . .TP -\fBHOMEBREW_DEBUG\fR -If set, any commands that can emit debugging information will do so\. +\fBHOMEBREW_CURL_VERBOSE\fR +Homebrew will pass \fB\-\-verbose\fR when invoking \fBcurl\fR(1)\. . .TP \fBHOMEBREW_DEVELOPER\fR -If set, Homebrew will tweak behaviour to be more relevant for Homebrew developers (active or budding), e\.g\. turning warnings into errors\. +Homebrew will tweak behaviour to be more relevant for Homebrew developers (active or budding), e\.g\. turning warnings into errors\. +. +.TP +\fBHOMEBREW_DISABLE_LOAD_FORMULA\fR +Homebrew will refuse to load formulae\. This is useful when formulae are not trusted (such as in pull requests)\. . .TP \fBHOMEBREW_DISPLAY\fR -If set, Homebrew will use this X11 display when opening a page in a browser, for example with \fBbrew home\fR\. Primarily useful on Linux\. +Homebrew will use this X11 display when opening a page in a browser, for example with \fBbrew home\fR\. Primarily useful on Linux\. . .IP -\fIDefault:\fR the value of the user\'s \fBDISPLAY\fR environment variable\. +\fIDefault:\fR \fB$DISPLAY\fR\. . .TP \fBHOMEBREW_DISPLAY_INSTALL_TIMES\fR -If set, Homebrew will print install times for each formula at the end of the run\. +Homebrew will print install times for each formula at the end of the run\. . .TP \fBHOMEBREW_EDITOR\fR -If set, Homebrew will use this editor when editing a single formula, or several formulae in the same directory\. +Homebrew will use this editor when editing a single formula, or several formulae in the same directory\. . .IP -\fINote:\fR \fBbrew edit\fR will open all of Homebrew as discontinuous files and directories\. TextMate can handle this correctly in project mode, but many editors will do strange things in this case\. +\fINote:\fR \fBbrew edit\fR will open all of Homebrew as discontinuous files and directories\. Visual Studio Code can handle this correctly in project mode, but many editors will do strange things in this case\. +. +.IP +\fIDefault:\fR \fB$EDITOR\fR or \fB$VISUAL\fR\. +. +.TP +\fBHOMEBREW_FAIL_LOG_LINES\fR +Homebrew will output this many lines of output on formula \fBsystem\fR failures\. +. +.IP +\fIDefault:\fR \fB15\fR\. . .TP \fBHOMEBREW_FORCE_BREWED_CURL\fR -If set, Homebrew will always use a Homebrew\-installed \fBcurl\fR rather than the system version\. Automatically set if the system version of \fBcurl\fR is too old\. -. -.TP -\fBHOMEBREW_FORCE_VENDOR_RUBY\fR -If set, Homebrew will always use its vendored, relocatable Ruby version even if the system version of Ruby is new enough\. +Homebrew will always use a Homebrew\-installed \fBcurl\fR(1) rather than the system version\. Automatically set if the system version of \fBcurl\fR is too old\. . .TP \fBHOMEBREW_FORCE_BREWED_GIT\fR -If set, Homebrew will always use a Homebrew\-installed \fBgit\fR(1) rather than the system version\. Automatically set if the system version of \fBgit\fR is too old\. +Homebrew will always use a Homebrew\-installed \fBgit\fR(1) rather than the system version\. Automatically set if the system version of \fBgit\fR is too old\. +. +.TP +\fBHOMEBREW_FORCE_HOMEBREW_ON_LINUX\fR +Homebrew running on Linux will use URLs for Homebrew on macOS\. This is useful when mergingpull requests on Linux for macOS\. +. +.TP +\fBHOMEBREW_FORCE_VENDOR_RUBY\fR +Homebrew will always use its vendored, relocatable Ruby version even if the system version of Ruby is new enough\. +. +.TP +\fBHOMEBREW_GITHUB_API_PASSWORD\fR +GitHub password for authentication with the GitHub API, used by Homebrew for featuressuch as \fBbrew search\fR\. We strongly recommend using \fBHOMEBREW_GITHUB_API_TOKEN\fR instead\. . .TP \fBHOMEBREW_GITHUB_API_TOKEN\fR @@ -1594,106 +1638,133 @@ A personal access token for the GitHub API, used by Homebrew for features such a \fINote:\fR Homebrew doesn\'t require permissions for any of the scopes\. . .TP +\fBHOMEBREW_GITHUB_API_USERNAME\fR +GitHub username for authentication with the GitHub API, used by Homebrew for features such as \fBbrew search\fR\. We strongly recommend using \fBHOMEBREW_GITHUB_API_TOKEN\fR instead\. +. +.TP +\fBHOMEBREW_GIT_EMAIL\fR +Homebrew will set the Git author and committer name to this value\. +. +.TP +\fBHOMEBREW_GIT_NAME\fR +Homebrew will set the Git author and committer email to this value\. +. +.TP \fBHOMEBREW_INSTALL_BADGE\fR Text printed before the installation summary of each successful build\. . .IP -\fIDefault:\fR the beer emoji\. +\fIDefault:\fR The "Beer Mug" emoji\. . .TP \fBHOMEBREW_LOGS\fR -If set, Homebrew will use the specified directory to store log files\. +IHomebrew will use the specified directory to store log files\. +. +.IP +\fIDefault:\fR macOS: \fB$HOME/Library/Logs/Homebrew\fR, Linux: \fB$XDG_CACHE_HOME/Homebrew/Logs\fR or \fB$HOME/\.cache/Homebrew/Logs\fR\. . .TP \fBHOMEBREW_MAKE_JOBS\fR -If set, instructs Homebrew to use the value of \fBHOMEBREW_MAKE_JOBS\fR as the number of parallel jobs to run when building with \fBmake\fR(1)\. +Instructs Homebrew to use the value of \fBHOMEBREW_MAKE_JOBS\fR as the number of parallel jobs to run when building with \fBmake\fR(1)\. . .IP -\fIDefault:\fR the number of available CPU cores\. +\fIDefault:\fR The number of available CPU cores\. . .TP \fBHOMEBREW_NO_ANALYTICS\fR -If set, Homebrew will not send analytics\. See: \fIhttps://docs\.brew\.sh/Analytics\fR +Homebrew will not send analytics\. See: \fIhttps://docs\.brew\.sh/Analytics\fR\. . .TP \fBHOMEBREW_NO_AUTO_UPDATE\fR -If set, Homebrew will not auto\-update before running \fBbrew install\fR, \fBbrew upgrade\fR or \fBbrew tap\fR\. +Homebrew will not auto\-update before running \fBbrew install\fR, \fBbrew upgrade\fR or \fBbrew tap\fR\. . .TP \fBHOMEBREW_NO_BOTTLE_SOURCE_FALLBACK\fR -If set, Homebrew will fail on the failure of installation from a bottle rather than falling back to building from source\. +Homebrew will fail on the failure of installation from a bottle rather than falling back to building from source\. . .TP \fBHOMEBREW_NO_COLOR\fR -If set, Homebrew will not print text with colour added\. +Homebrew will not print text with colour added\. +. +.IP +\fIDefault:\fR \fB$NO_COLOR\fR\. +. +.TP +\fBHOMEBREW_NO_COMPAT\fR +Homebrew disables all use of legacy compatibility code\. . .TP \fBHOMEBREW_NO_EMOJI\fR -If set, Homebrew will not print the \fBHOMEBREW_INSTALL_BADGE\fR on a successful build\. +Homebrew will not print the \fBHOMEBREW_INSTALL_BADGE\fR on a successful build\. . .IP \fINote:\fR Homebrew will only try to print emoji on OS X Lion or newer\. . .TP -\fBHOMEBREW_NO_INSECURE_REDIRECT\fR -If set, Homebrew will not permit redirects from secure HTTPS to insecure HTTP\. -. -.IP -While ensuring your downloads are fully secure, this is likely to cause from\-source SourceForge, some GNU & GNOME based formulae to fail to download\. +\fBHOMEBREW_NO_GITHUB_API\fR +Homebrew will not use the GitHub API, e\.g\. for searches or fetching relevant issues on a failed install\. . .TP -\fBHOMEBREW_NO_GITHUB_API\fR -If set, Homebrew will not use the GitHub API, e\.g\. for searches or fetching relevant issues on a failed install\. +\fBHOMEBREW_NO_INSECURE_REDIRECT\fR +Homebrew will not permit redirects from secure HTTPS to insecure HTTP\. +. +.IP +\fINote:\fR While ensuring your downloads are fully secure, this is likely to cause from\-source SourceForge, some GNU & GNOME based formulae to fail to download\. . .TP \fBHOMEBREW_NO_INSTALL_CLEANUP\fR -If set, \fBbrew install\fR, \fBbrew upgrade\fR and \fBbrew reinstall\fR will never automatically cleanup the installed/upgraded/reinstalled formulae or all formulae every 30 days\. +\fBbrew install\fR, \fBbrew upgrade\fR and \fBbrew reinstall\fR will never automatically cleanup installed/upgraded/reinstalled formulae or all formulae every 30 days\. . .TP \fBHOMEBREW_PRY\fR -If set, Homebrew will use Pry for the \fBbrew irb\fR command\. +Homebrew will use Pry for the \fBbrew irb\fR command\. +. +.TP +\fBHOMEBREW_SKIP_OR_LATER_BOTTLES\fR +Along with \fBHOMEBREW_DEVELOPER\fR Homebrew will not use bottles from older versions of macOS\. This is useful in Homebrew development on new macOS versions\. . .TP \fBHOMEBREW_SVN\fR -When exporting from Subversion, Homebrew will use \fBHOMEBREW_SVN\fR if set, a Homebrew\-built Subversion if installed, or the system\-provided binary\. -. -.IP -Set this to force Homebrew to use a particular \fBsvn\fR binary\. +Forces Homebrew to use a particular \fBsvn\fR binary\. Otherwise, a Homebrew\-built Subversion if installed, or the system\-provided binary\. . .TP \fBHOMEBREW_TEMP\fR -If set, instructs Homebrew to use \fBHOMEBREW_TEMP\fR as the temporary directory for building packages\. This may be needed if your system temp directory and Homebrew prefix are on different volumes, as macOS has trouble moving symlinks across volumes when the target does not yet exist\. +Instructs Homebrew to use \fBHOMEBREW_TEMP\fR as the temporary directory for building packages\. This may be needed if your system temp directory and Homebrew prefix are on different volumes, as macOS has trouble moving symlinks across volumes when the targetdoes not yet exist\. This issue typically occurs when using FileVault or custom SSDconfigurations\. . .IP -This issue typically occurs when using FileVault or custom SSD configurations\. +\fIDefault:\fR macOS: \fB/private/tmp\fR, Linux: \fB/tmp\fR\. . .TP \fBHOMEBREW_UPDATE_TO_TAG\fR -If set, instructs Homebrew to always use the latest stable tag (even if developer commands have been run)\. +Instructs Homebrew to always use the latest stable tag (even if developer commands have been run)\. . .TP \fBHOMEBREW_VERBOSE\fR -If set, Homebrew always assumes \fB\-\-verbose\fR when running commands\. +Homebrew always assumes \fB\-\-verbose\fR when running commands\. . .TP -\fBhttp_proxy\fR -Sets the HTTP proxy to be used by \fBcurl\fR, \fBgit\fR and \fBsvn\fR when downloading through Homebrew\. -. -.TP -\fBhttps_proxy\fR -Sets the HTTPS proxy to be used by \fBcurl\fR, \fBgit\fR and \fBsvn\fR when downloading through Homebrew\. +\fBHOMEBREW_VERBOSE_USING_DOTS\fR +Homebrew\'s verbose output will print a \fB\.\fR no more than once a minute\. This can be useful to avoid long\-running Homebrew commands being killed due to no output\. . .TP \fBall_proxy\fR -Sets the SOCKS5 proxy to be used by \fBcurl\fR, \fBgit\fR and \fBsvn\fR when downloading through Homebrew\. +Sets the SOCKS5 proxy to be used by \fBcurl\fR(1), \fBgit\fR(1) and \fBsvn\fR(1) when downloading through Homebrew\. . .TP \fBftp_proxy\fR -Sets the FTP proxy to be used by \fBcurl\fR, \fBgit\fR and \fBsvn\fR when downloading through Homebrew\. +Sets the FTP proxy to be used by \fBcurl\fR(1), \fBgit\fR(1) and \fBsvn\fR(1) when downloading through Homebrew\. +. +.TP +\fBhttp_proxy\fR +Sets the HTTP proxy to be used by \fBcurl\fR(1), \fBgit\fR(1) and \fBsvn\fR(1) when downloading through Homebrew\. +. +.TP +\fBhttps_proxy\fR +Sets the HTTPS proxy to be used by \fBcurl\fR(1), \fBgit\fR(1) and \fBsvn\fR(1) when downloading through Homebrew\. . .TP \fBno_proxy\fR -Sets the comma\-separated list of hostnames and domain names that should be excluded from proxying by \fBcurl\fR, \fBgit\fR and \fBsvn\fR when downloading through Homebrew\. +Sets the comma\-separated list of hostnames and domain names that should be excluded from proxying by \fBcurl\fR(1), \fBgit\fR(1) and \fBsvn\fR(1) when downloading through Homebrew\. . .SH "USING HOMEBREW BEHIND A PROXY" Set the \fBhttp_proxy\fR, \fBhttps_proxy\fR, \fBall_proxy\fR, \fBftp_proxy\fR and/or \fBno_proxy\fR environment variables documented above\.