diff options
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/brew.rb | 16 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/vendor-install.sh | 11 | ||||
| -rw-r--r-- | Library/Homebrew/dev-cmd/bottle.rb | 11 | ||||
| -rw-r--r-- | Library/Homebrew/diagnostic.rb | 6 | ||||
| -rw-r--r-- | Library/Homebrew/extend/os/mac/diagnostic.rb | 14 | ||||
| -rw-r--r-- | Library/Homebrew/extend/os/mac/extend/ENV/std.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/extend/os/mac/extend/ENV/super.rb | 8 | ||||
| -rw-r--r-- | Library/Homebrew/extend/pathname.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/formula_installer.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/official_taps.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/os/mac.rb | 17 | ||||
| -rw-r--r-- | Library/Homebrew/os/mac/xcode.rb | 9 | ||||
| -rw-r--r-- | Library/Homebrew/patch.rb | 7 | ||||
| -rw-r--r-- | Library/Homebrew/rubocops/formula_desc_cop.rb | 8 | ||||
| -rw-r--r-- | Library/Homebrew/test/diagnostic_spec.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/test/spec_helper.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/utils.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/utils/curl.rb | 2 |
18 files changed, 83 insertions, 42 deletions
diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index bb663537d..f31224ab2 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -69,6 +69,14 @@ begin end end + unless internal_cmd + # Add contributed commands to PATH before checking. + homebrew_path.append(Tap.cmd_directories) + + # External commands expect a normal PATH + ENV["PATH"] = homebrew_path + end + # Usage instructions should be displayed if and only if one of: # - a help flag is passed AND a command is matched # - a help flag is passed AND there is no command specified @@ -88,14 +96,6 @@ begin system(HOMEBREW_BREW_FILE, "uninstall", "--force", "brew-cask") end - unless internal_cmd - # Add contributed commands to PATH before checking. - homebrew_path.append(Tap.cmd_directories) - - # External commands expect a normal PATH - ENV["PATH"] = homebrew_path - end - if internal_cmd Homebrew.send cmd.to_s.tr("-", "_").downcase elsif which "brew-#{cmd}" diff --git a/Library/Homebrew/cmd/vendor-install.sh b/Library/Homebrew/cmd/vendor-install.sh index 15caca8ef..fa9cb20d3 100644 --- a/Library/Homebrew/cmd/vendor-install.sh +++ b/Library/Homebrew/cmd/vendor-install.sh @@ -25,6 +25,15 @@ then ruby_SHA="33643b1ca6f860d6df01686636326785763e5e81cf0cef37d8a7ab96a6ca1fa1" fi +# Execute the specified command, and suppress stderr unless HOMEBREW_STDERR is set. +quiet_stderr() { + if [[ -z "$HOMEBREW_STDERR" ]]; then + command "$@" 2>/dev/null + else + command "$@" + fi +} + fetch() { local -a curl_args local sha @@ -144,7 +153,7 @@ install() { tar "$tar_args" "$CACHED_LOCATION" safe_cd "$VENDOR_DIR/portable-$VENDOR_NAME" - if "./$VENDOR_VERSION/bin/$VENDOR_NAME" --version >/dev/null 2>&1 + if quiet_stderr "./$VENDOR_VERSION/bin/$VENDOR_NAME" --version >/dev/null then ln -sfn "$VENDOR_VERSION" current # remove old vendor installations by sorting files with modified time. diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index a54211f5c..204e7cef9 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -469,6 +469,17 @@ module Homebrew end unless ARGV.include? "--no-commit" + if ENV["HOMEBREW_GIT_NAME"] + ENV["GIT_AUTHOR_NAME"] = + ENV["GIT_COMMITTER_NAME"] = + ENV["HOMEBREW_GIT_NAME"] + end + if ENV["HOMEBREW_GIT_EMAIL"] + ENV["GIT_AUTHOR_EMAIL"] = + ENV["GIT_COMMITTER_EMAIL"] = + ENV["HOMEBREW_GIT_EMAIL"] + end + short_name = formula_name.split("/", -1).last pkg_version = bottle_hash["formula"]["pkg_version"] diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 51a892e28..e1b1bb8ee 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -434,7 +434,7 @@ module Homebrew message = "" - paths(ENV["HOMEBREW_PATH"]).each do |p| + paths.each do |p| case p when "/usr/bin" unless @seen_prefix_bin @@ -577,7 +577,7 @@ module Homebrew /Applications/Server.app/Contents/ServerRoot/usr/sbin ].map(&:downcase) - paths(ENV["HOMEBREW_PATH"]).each do |p| + paths.each do |p| next if whitelist.include?(p.downcase) || !File.directory?(p) realpath = Pathname.new(p).realpath.to_s @@ -1045,7 +1045,7 @@ module Homebrew end def check_for_external_cmd_name_conflict - cmds = paths.flat_map { |p| Dir["#{p}/brew-*"] }.uniq + cmds = Tap.cmd_directories.flat_map { |p| Dir["#{p}/brew-*"] }.uniq cmds = cmds.select { |cmd| File.file?(cmd) && File.executable?(cmd) } cmd_map = {} cmds.each do |cmd| diff --git a/Library/Homebrew/extend/os/mac/diagnostic.rb b/Library/Homebrew/extend/os/mac/diagnostic.rb index 65b8d7cde..f0b923f21 100644 --- a/Library/Homebrew/extend/os/mac/diagnostic.rb +++ b/Library/Homebrew/extend/os/mac/diagnostic.rb @@ -19,6 +19,7 @@ module Homebrew %w[ check_xcode_minimum_version check_clt_minimum_version + check_if_xcode_needs_clt_installed ].freeze end @@ -56,7 +57,7 @@ module Homebrew # `brew test-bot` runs `brew doctor` in the CI for the Homebrew/brew # repository. This only needs to support whatever CI provider # Homebrew/brew is currently using. - return if ENV["TRAVIS"] + return if ENV["HOMEBREW_TRAVIS"] message = <<~EOS Your Xcode (#{MacOS::Xcode.version}) is outdated. @@ -83,7 +84,7 @@ module Homebrew # `brew test-bot` runs `brew doctor` in the CI for the Homebrew/brew # repository. This only needs to support whatever CI provider # Homebrew/brew is currently using. - return if ENV["TRAVIS"] + return if ENV["HOMEBREW_TRAVIS"] <<~EOS A newer Command Line Tools release is available. @@ -124,6 +125,15 @@ module Homebrew EOS end + def check_if_xcode_needs_clt_installed + return unless MacOS::Xcode.needs_clt_installed? + + <<~EOS + Xcode alone is not sufficient on #{MacOS.version.pretty_name}. + #{DevelopmentTools.installation_instructions} + EOS + end + def check_for_osx_gcc_installer return unless MacOS.version < "10.7" || ((MacOS::Xcode.version || "0") > "4.1") return unless DevelopmentTools.clang_version == "2.1" diff --git a/Library/Homebrew/extend/os/mac/extend/ENV/std.rb b/Library/Homebrew/extend/os/mac/extend/ENV/std.rb index dd273cfbc..1a6d10f3b 100644 --- a/Library/Homebrew/extend/os/mac/extend/ENV/std.rb +++ b/Library/Homebrew/extend/os/mac/extend/ENV/std.rb @@ -60,7 +60,6 @@ module Stdenv # previously added by macosxsdk version = version.to_s remove_from_cflags(/ ?-mmacosx-version-min=10\.\d+/) - delete("MACOSX_DEPLOYMENT_TARGET") delete("CPATH") remove "LDFLAGS", "-L#{HOMEBREW_PREFIX}/lib" @@ -83,7 +82,6 @@ module Stdenv remove_macosxsdk version = version.to_s append_to_cflags("-mmacosx-version-min=#{version}") - self["MACOSX_DEPLOYMENT_TARGET"] = version self["CPATH"] = "#{HOMEBREW_PREFIX}/include" prepend "LDFLAGS", "-L#{HOMEBREW_PREFIX}/lib" diff --git a/Library/Homebrew/extend/os/mac/extend/ENV/super.rb b/Library/Homebrew/extend/os/mac/extend/ENV/super.rb index ee0d2343c..f233002ea 100644 --- a/Library/Homebrew/extend/os/mac/extend/ENV/super.rb +++ b/Library/Homebrew/extend/os/mac/extend/ENV/super.rb @@ -9,7 +9,7 @@ module Superenv end def effective_sysroot - MacOS::Xcode.without_clt? ? MacOS.sdk_path.to_s : nil + MacOS.sdk_path.to_s if MacOS::Xcode.without_clt? end def homebrew_extra_paths @@ -90,11 +90,7 @@ module Superenv def setup_build_environment(formula = nil) generic_setup_build_environment(formula) self["HOMEBREW_SDKROOT"] = effective_sysroot - - if MacOS::Xcode.without_clt? || MacOS::Xcode.version.to_i >= 7 - self["MACOSX_DEPLOYMENT_TARGET"] = MacOS.version.to_s - self["SDKROOT"] = MacOS.sdk_path - end + self["SDKROOT"] = MacOS.sdk_path if MacOS::Xcode.without_clt? # Filter out symbols known not to be defined since GNU Autotools can't # reliably figure this out with Xcode 8 and above. diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index 82cf10be0..07919f8a0 100644 --- a/Library/Homebrew/extend/pathname.rb +++ b/Library/Homebrew/extend/pathname.rb @@ -495,7 +495,7 @@ module ObserverPathnameExtension MAXIMUM_VERBOSE_OUTPUT = 100 def verbose? - return ARGV.verbose? unless ENV["TRAVIS"] + return ARGV.verbose? unless ENV["HOMEBREW_TRAVIS"] return false unless ARGV.verbose? if total < MAXIMUM_VERBOSE_OUTPUT diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 42abe5171..2285fee91 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -702,7 +702,7 @@ class FormulaInstaller Utils.safe_fork do # Invalidate the current sudo timestamp in case a build script calls sudo. # Travis CI's Linux sudoless workers have a weird sudo that fails here. - system "/usr/bin/sudo", "-k" unless ENV["TRAVIS_SUDO"] == "false" + system "/usr/bin/sudo", "-k" unless ENV["HOMEBREW_TRAVIS_SUDO"] == "false" if Sandbox.formula?(formula) sandbox = Sandbox.new diff --git a/Library/Homebrew/official_taps.rb b/Library/Homebrew/official_taps.rb index ed966c804..d2e4753d9 100644 --- a/Library/Homebrew/official_taps.rb +++ b/Library/Homebrew/official_taps.rb @@ -1,5 +1,4 @@ OFFICIAL_TAPS = %w[ - nginx php science ].freeze @@ -26,6 +25,7 @@ DEPRECATED_OFFICIAL_TAPS = %w[ games gui head-only + nginx python tex versions diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb index 9215e3c96..ade801c42 100644 --- a/Library/Homebrew/os/mac.rb +++ b/Library/Homebrew/os/mac.rb @@ -31,16 +31,25 @@ module OS @version = nil end - def prerelease? - # TODO: bump version when new OS is released - version >= "10.14" + def latest_sdk_version + # TODO: bump version when new Xcode macOS SDK is released + Version.new "10.13" + end + + def latest_stable_version + # TODO: bump version when new macOS is released + Version.new "10.13" end def outdated_release? - # TODO: bump version when new OS is released + # TODO: bump version when new macOS is released version < "10.11" end + def prerelease? + version > latest_stable_version + end + def cat version.to_sym end diff --git a/Library/Homebrew/os/mac/xcode.rb b/Library/Homebrew/os/mac/xcode.rb index 96be56e3b..ae725d948 100644 --- a/Library/Homebrew/os/mac/xcode.rb +++ b/Library/Homebrew/os/mac/xcode.rb @@ -40,6 +40,15 @@ module OS version < minimum_version end + def latest_sdk_version? + OS::Mac.version == OS::Mac.latest_sdk_version + end + + def needs_clt_installed? + return false if latest_sdk_version? + without_clt? + end + def outdated? return false unless installed? version < latest_version diff --git a/Library/Homebrew/patch.rb b/Library/Homebrew/patch.rb index a44add10e..1b379ba0f 100644 --- a/Library/Homebrew/patch.rb +++ b/Library/Homebrew/patch.rb @@ -64,10 +64,9 @@ class EmbeddedPatch def apply data = contents.gsub("HOMEBREW_PREFIX", HOMEBREW_PREFIX) - cmd = "/usr/bin/patch" args = %W[-g 0 -f -#{strip}] - IO.popen("#{cmd} #{args.join(" ")}", "w") { |p| p.write(data) } - raise ErrorDuringExecution.new(cmd, args) unless $CHILD_STATUS.success? + Utils.popen_write("patch", *args) { |p| p.write(data) } + raise ErrorDuringExecution.new("patch", args) unless $CHILD_STATUS.success? end def inspect @@ -150,7 +149,7 @@ class ExternalPatch patch_files.each do |patch_file| ohai "Applying #{patch_file}" patch_file = patch_dir/patch_file - safe_system "/usr/bin/patch", "-g", "0", "-f", "-#{strip}", "-i", patch_file + safe_system "patch", "-g", "0", "-f", "-#{strip}", "-i", patch_file end end end diff --git a/Library/Homebrew/rubocops/formula_desc_cop.rb b/Library/Homebrew/rubocops/formula_desc_cop.rb index 69fbeb56e..8a35e7d24 100644 --- a/Library/Homebrew/rubocops/formula_desc_cop.rb +++ b/Library/Homebrew/rubocops/formula_desc_cop.rb @@ -40,7 +40,7 @@ module RuboCop # - Checks for correct usage of `command-line` in `desc` # - Checks description starts with a capital letter # - Checks if `desc` contains the formula name - # - Checks if `desc` ends with a full stop + # - Checks if `desc` ends with a full stop (apart from in the case of "etc.") class Desc < FormulaCop VALID_LOWERCASE_WORDS = %w[ ex @@ -83,8 +83,8 @@ module RuboCop problem "Description shouldn't start with the formula name" end - # Check if a full stop is used at the end of a formula's desc - return unless regex_match_group(desc, /\.$/) + # Check if a full stop is used at the end of a formula's desc (apart from in the case of "etc.") + return unless regex_match_group(desc, /\.$/) && !string_content(desc).end_with?("etc.") problem "Description shouldn't end with a full stop" end @@ -103,7 +103,7 @@ module RuboCop correction.gsub!(/(^|[^a-z])#{@formula_name}([^a-z]|$)/i, "\\1\\2") correction.gsub!(/^(['"]?)\s+/, "\\1") correction.gsub!(/\s+(['"]?)$/, "\\1") - correction.gsub!(/\.$/, "") + correction.gsub!(/\.(['"]?)$/, "\\1") corrector.insert_before(node.source_range, correction) corrector.remove(node.source_range) end diff --git a/Library/Homebrew/test/diagnostic_spec.rb b/Library/Homebrew/test/diagnostic_spec.rb index 8a25413ed..f347010a9 100644 --- a/Library/Homebrew/test/diagnostic_spec.rb +++ b/Library/Homebrew/test/diagnostic_spec.rb @@ -194,7 +194,7 @@ describe Homebrew::Diagnostic::Checks do FileUtils.chmod 0755, cmd end - ENV["PATH"] = [path1, path2, ENV["PATH"]].join File::PATH_SEPARATOR + allow(Tap).to receive(:cmd_directories).and_return([path1, path2]) expect(subject.check_for_external_cmd_name_conflict) .to match("brew-foo") diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index 08766ea37..c3652fc42 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -9,7 +9,7 @@ require "set" if ENV["HOMEBREW_TESTS_COVERAGE"] require "simplecov" - if ENV["CODECOV_TOKEN"] || ENV["TRAVIS"] + if ENV["CODECOV_TOKEN"] || ENV["HOMEBREW_TRAVIS"] require "codecov" SimpleCov.formatter = SimpleCov::Formatter::Codecov end diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 1d16044da..48ab94c4f 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -420,8 +420,8 @@ def nostdout end end -def paths(env_path = ENV["PATH"]) - @paths ||= PATH.new(env_path).collect do |p| +def paths + @paths ||= PATH.new(ENV["HOMEBREW_PATH"]).collect do |p| begin File.expand_path(p).chomp("/") rescue ArgumentError diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb index eaa81352c..5becf8203 100644 --- a/Library/Homebrew/utils/curl.rb +++ b/Library/Homebrew/utils/curl.rb @@ -27,7 +27,7 @@ def curl_args(*extra_args, show_output: false, user_agent: :default) args << "--fail" args << "--progress-bar" unless ARGV.verbose? args << "--verbose" if ENV["HOMEBREW_CURL_VERBOSE"] - args << "--silent" if !$stdout.tty? || ENV["TRAVIS"] + args << "--silent" if !$stdout.tty? || ENV["HOMEBREW_TRAVIS"] end args + extra_args |
