diff options
34 files changed, 165 insertions, 159 deletions
diff --git a/.travis.yml b/.travis.yml index 94b83fc11..670e69ad0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ matrix: fast_finish: true include: - os: osx - osx_image: xcode8.3 + osx_image: xcode9 rvm: system - os: linux sudo: false @@ -21,19 +21,19 @@ before_install: - export HOMEBREW_NO_AUTO_UPDATE=1 - export HOMEBREW_DEVELOPER=1 - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then - git clone --depth=1 https://github.com/Homebrew/homebrew-test-bot Library/Taps/homebrew/homebrew-test-bot; HOMEBREW_REPOSITORY="$(brew --repo)"; sudo chown -R "$USER" "$HOMEBREW_REPOSITORY/Library/Taps"; mv "$HOMEBREW_REPOSITORY/Library/Taps" "$PWD/Library"; sudo rm -rf "$HOMEBREW_REPOSITORY"; sudo ln -s "$PWD" "$HOMEBREW_REPOSITORY"; + git clone --depth=1 https://github.com/Homebrew/homebrew-test-bot Library/Taps/homebrew/homebrew-test-bot; else umask 022; - git clone --depth=1 https://github.com/Homebrew/homebrew-test-bot Library/Taps/homebrew/homebrew-test-bot; git fetch --unshallow; export PATH="$PWD/bin:$PATH"; HOMEBREW_CORE_TAP_DIR="$(brew --repo "homebrew/core")"; mkdir -p "$HOMEBREW_CORE_TAP_DIR"; + git clone --depth=1 https://github.com/Homebrew/homebrew-test-bot Library/Taps/homebrew/homebrew-test-bot; HOMEBREW_TEST_BOT_TAP_DIR="$(brew --repo "homebrew/test-bot")"; ln -s "$HOMEBREW_TEST_BOT_TAP_DIR/.git" "$HOMEBREW_TEST_BOT_TAP_DIR/Formula" "$HOMEBREW_CORE_TAP_DIR"; fi diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index 2906fd93d..41955e60e 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -5,8 +5,12 @@ end std_trap = trap("INT") { exit! 130 } # no backtrace thanks # check ruby version before requiring any modules. -RUBY_TWO = RUBY_VERSION.split(".").first.to_i >= 2 -raise "Homebrew must be run under Ruby 2!" unless RUBY_TWO +RUBY_VERSION_SPLIT = RUBY_VERSION.split "." +RUBY_X = RUBY_VERSION_SPLIT[0].to_i +RUBY_Y = RUBY_VERSION_SPLIT[1].to_i +if RUBY_X < 2 || (RUBY_X == 2 && RUBY_Y < 3) + raise "Homebrew must be run under Ruby 2.3!" +end require "pathname" HOMEBREW_LIBRARY_PATH = Pathname.new(__FILE__).realpath.parent diff --git a/Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb b/Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb index badd549ce..3f63dae8f 100644 --- a/Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb +++ b/Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb @@ -37,7 +37,7 @@ module Hbc end def summarize - to_h.map { |key, val| [*val].map { |v| "#{key.inspect} => #{v.inspect}" }.join(", ") }.join(", ") + to_h.flat_map { |key, val| [*val].map { |v| "#{key.inspect} => #{v.inspect}" } }.join(", ") end private @@ -253,7 +253,7 @@ module Hbc end def trash_paths(*paths, command: nil, **_) - command.run!("/usr/bin/osascript", args: ["-e", <<-'EOS'.undent, *paths]) + result = command.run!("/usr/bin/osascript", args: ["-e", <<-'EOS'.undent, *paths]) on run argv repeat with i from 1 to (count argv) set item i of argv to (item i of argv as POSIX file) @@ -267,7 +267,7 @@ module Hbc set trashedItem to POSIX path of (item i of trashedItems as string) set output to output & trashedItem if i < count trashedItems then - set output to output & (do shell script "printf \"\\0\"") + set output to output & character id 0 end if end repeat @@ -275,6 +275,9 @@ module Hbc end tell end run EOS + + # Remove AppleScript's automatic newline. + result.tap { |r| r.stdout.sub!(/\n$/, "") } end def uninstall_rmdir(*directories, command: nil, **_) diff --git a/Library/Homebrew/cask/lib/hbc/artifact/nested_container.rb b/Library/Homebrew/cask/lib/hbc/artifact/nested_container.rb index 81adf9029..c9fd3dc27 100644 --- a/Library/Homebrew/cask/lib/hbc/artifact/nested_container.rb +++ b/Library/Homebrew/cask/lib/hbc/artifact/nested_container.rb @@ -16,6 +16,10 @@ module Hbc private + def summarize + path.relative_path_from(cask.staged_path).to_s + end + def extract(command: nil, verbose: nil, **_) container = Container.for_path(path, command) diff --git a/Library/Homebrew/cask/lib/hbc/audit.rb b/Library/Homebrew/cask/lib/hbc/audit.rb index 03d8cce82..9ab93a67f 100644 --- a/Library/Homebrew/cask/lib/hbc/audit.rb +++ b/Library/Homebrew/cask/lib/hbc/audit.rb @@ -70,12 +70,16 @@ module Hbc previous_cask_contents = Git.last_revision_of_file(tap.path, @cask.sourcefile_path, before_commit: commit_range) return if previous_cask_contents.empty? - previous_cask = CaskLoader.load_from_string(previous_cask_contents) + begin + previous_cask = CaskLoader.load_from_string(previous_cask_contents) - return unless previous_cask.version == cask.version - return if previous_cask.sha256 == cask.sha256 + return unless previous_cask.version == cask.version + return if previous_cask.sha256 == cask.sha256 - add_error "only sha256 changed (see: https://github.com/caskroom/homebrew-cask/blob/master/doc/cask_language_reference/stanzas/sha256.md)" + add_error "only sha256 changed (see: https://github.com/caskroom/homebrew-cask/blob/master/doc/cask_language_reference/stanzas/sha256.md)" + rescue CaskError => e + add_warning "Skipped version and checksum comparison. Reading previous version failed: #{e}" + end end def check_version diff --git a/Library/Homebrew/cask/lib/hbc/dsl.rb b/Library/Homebrew/cask/lib/hbc/dsl.rb index 3822c532c..8d5b6c9a9 100644 --- a/Library/Homebrew/cask/lib/hbc/dsl.rb +++ b/Library/Homebrew/cask/lib/hbc/dsl.rb @@ -106,7 +106,9 @@ module Hbc end def language(*args, default: false, &block) - if !args.empty? && block_given? + if args.empty? + language_eval + elsif block_given? @language_blocks ||= {} @language_blocks[args] = block @@ -118,7 +120,7 @@ module Hbc @language_blocks.default = block else - language_eval + raise CaskInvalidError.new(cask, "No block given to language stanza.") end end @@ -127,6 +129,10 @@ module Hbc return @language = nil if @language_blocks.nil? || @language_blocks.empty? + if @language_blocks.default.nil? + raise CaskInvalidError.new(cask, "No default language specified.") + end + MacOS.languages.map(&Locale.method(:parse)).each do |locale| key = @language_blocks.keys.detect do |strings| strings.any? { |string| locale.include?(string) } diff --git a/Library/Homebrew/cask/lib/hbc/dsl/caveats.rb b/Library/Homebrew/cask/lib/hbc/dsl/caveats.rb index 402574456..7d373b5f3 100644 --- a/Library/Homebrew/cask/lib/hbc/dsl/caveats.rb +++ b/Library/Homebrew/cask/lib/hbc/dsl/caveats.rb @@ -48,7 +48,7 @@ module Hbc brew cask install java EOS - elsif java_version.include?("8") || java_version.include?("+") + elsif java_version.include?("9") || java_version.include?("+") puts <<-EOS.undent #{@cask} requires Java #{java_version}. You can install the latest version with diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index c00087705..732e96b00 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -219,6 +219,7 @@ module Homebrew end end + return if formulae.empty? perform_preinstall_checks formulae.each do |f| diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh index e8211e4dd..3507fa92b 100644 --- a/Library/Homebrew/cmd/update.sh +++ b/Library/Homebrew/cmd/update.sh @@ -570,6 +570,7 @@ EOS -d "$HOMEBREW_LIBRARY/LinkedKegs" || (-n "$HOMEBREW_DEVELOPER" && -z "$HOMEBREW_UPDATE_PREINSTALL") ]] then + unset HOMEBREW_RUBY_PATH brew update-report "$@" return $? elif [[ -z "$HOMEBREW_UPDATE_PREINSTALL" ]] diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index a7d498c0d..49e7969af 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -396,7 +396,6 @@ class FormulaAuditor return if formula.tap.nil? || !formula.tap.official? name = formula.name - full_name = formula.full_name if Homebrew::MissingFormula.blacklisted_reason(name) problem "'#{name}' is blacklisted." @@ -412,35 +411,10 @@ class FormulaAuditor return end - if !formula.core_formula? && Formula.core_names.include?(name) - problem "Formula name conflicts with existing core formula." - return - end - - @@local_official_taps_name_map ||= Tap.select(&:official?).flat_map(&:formula_names) - .each_with_object({}) do |tap_formula_full_name, name_map| - next if tap_formula_full_name.start_with?("homebrew/science/") - tap_formula_name = tap_formula_full_name.split("/").last - name_map[tap_formula_name] ||= [] - name_map[tap_formula_name] << tap_formula_full_name - name_map - end - - same_name_tap_formulae = @@local_official_taps_name_map[name] || [] - - if @online - Homebrew.search_taps(name, silent: true).each do |tap_formula_full_name| - next if tap_formula_full_name.start_with?("homebrew/science/") - tap_formula_name = tap_formula_full_name.split("/").last - next if tap_formula_name != name - same_name_tap_formulae << tap_formula_full_name - end - end - - same_name_tap_formulae.delete(full_name) + return if formula.core_formula? + return unless Formula.core_names.include?(name) - return if same_name_tap_formulae.empty? - problem "Formula name conflicts with #{same_name_tap_formulae.join ", "}" + problem "Formula name conflicts with existing core formula." end def audit_deps diff --git a/Library/Homebrew/dev-cmd/update-test.rb b/Library/Homebrew/dev-cmd/update-test.rb index aa7fe6a92..1f1cdbeed 100644 --- a/Library/Homebrew/dev-cmd/update-test.rb +++ b/Library/Homebrew/dev-cmd/update-test.rb @@ -81,7 +81,7 @@ module Homebrew safe_system "git", "reset", "--hard", start_commit # update ENV["PATH"] - ENV["PATH"] = "#{curdir}/bin:/usr/local/bin:/usr/bin:/bin" + ENV["PATH"] = PATH.new(ENV["PATH"]).prepend(curdir/"bin") # run brew update oh1 "Running brew update..." diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb index 5418f9331..22a7fe023 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -555,12 +555,12 @@ end # raised when a single patch file is not found and apply hasn't been specified class MissingApplyError < RuntimeError; end -class BottleVersionMismatchError < RuntimeError - def initialize(bottle_file, bottle_version, formula, formula_version) +class BottleFormulaUnavailableError < RuntimeError + def initialize(bottle_path, formula_path) super <<-EOS.undent - Bottle version mismatch - Bottle: #{bottle_file} (#{bottle_version}) - Formula: #{formula.full_name} (#{formula_version}) + This bottle does not contain the formula file: + #{bottle_path} + #{formula_path} EOS end end diff --git a/Library/Homebrew/extend/os/mac/keg_relocate.rb b/Library/Homebrew/extend/os/mac/keg_relocate.rb index 2c27912cf..707710be6 100644 --- a/Library/Homebrew/extend/os/mac/keg_relocate.rb +++ b/Library/Homebrew/extend/os/mac/keg_relocate.rb @@ -2,10 +2,7 @@ class Keg def fix_dynamic_linkage mach_o_files.each do |file| file.ensure_writable do - if file.dylib? - @require_relocation = true - file.change_dylib_id(dylib_id_for(file)) - end + change_dylib_id(dylib_id_for(file), file) if file.dylib? each_install_name_for(file) do |bad_name| # Don't fix absolute paths unless they are rooted in the build directory @@ -14,9 +11,7 @@ class Keg !bad_name.start_with?(HOMEBREW_TEMP.realpath.to_s) new_name = fixed_name(file, bad_name) - - @require_relocation = true - file.change_install_name(bad_name, new_name) + change_install_name(bad_name, new_name, file) unless new_name == bad_name end end end @@ -28,9 +23,8 @@ class Keg mach_o_files.each do |file| file.ensure_writable do if file.dylib? - @require_relocation = true id = dylib_id_for(file).sub(relocation.old_prefix, relocation.new_prefix) - file.change_dylib_id(id) + change_dylib_id(id, file) end each_install_name_for(file) do |old_name| @@ -40,8 +34,7 @@ class Keg new_name = old_name.sub(relocation.old_prefix, relocation.new_prefix) end - @require_relocation = true - file.change_install_name(old_name, new_name) if new_name + change_install_name(old_name, new_name, file) if new_name end end end diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index b4f9db845..56238ad73 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -84,8 +84,7 @@ class FormulaInstaller return false if @pour_failed - bottle = formula.bottle - return false if !bottle && !formula.local_bottle_path + return false if !formula.bottled? && !formula.local_bottle_path return true if force_bottle? return false if build_from_source? || build_bottle? || interactive? return false if ARGV.cc @@ -101,6 +100,7 @@ class FormulaInstaller return false end + bottle = formula.bottle_specification unless bottle.compatible_cellar? if install_bottle_options[:warn] opoo <<-EOS.undent @@ -236,6 +236,15 @@ class FormulaInstaller raise CannotInstallFormulaError, message end + # Warn if a more recent version of this formula is available in the tap. + begin + if formula.pkg_version < (v = Formulary.factory(formula.full_name).pkg_version) + opoo "#{formula.full_name} #{v} is available and more recent than version #{formula.pkg_version}." + end + rescue FormulaUnavailableError + nil + end + check_conflicts if !pour_bottle? && !formula.bottle_unneeded? && !DevelopmentTools.installed? @@ -309,7 +318,12 @@ class FormulaInstaller clean # Store the formula used to build the keg in the keg. - s = formula.path.read.gsub(/ bottle do.+?end\n\n?/m, "") + formula_contents = if formula.local_bottle_path + Utils::Bottles.formula_contents formula.local_bottle_path, name: formula.name + else + formula.path.read + end + s = formula_contents.gsub(/ bottle do.+?end\n\n?/m, "") brew_prefix = formula.prefix/".brew" brew_prefix.mkdir Pathname(brew_prefix/"#{formula.name}.rb").atomic_write(s) diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index dd67b4f24..c8ab8a922 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -122,14 +122,10 @@ module Formulary super name, Formulary.path(full_name) end - def get_formula(spec, alias_path: nil) - formula = super + def get_formula(spec, **) + contents = Utils::Bottles.formula_contents @bottle_filename, name: name + formula = Formulary.from_contents name, @bottle_filename, contents, spec formula.local_bottle_path = @bottle_filename - formula_version = formula.pkg_version - bottle_version = Utils::Bottles.resolve_version(@bottle_filename) - unless formula_version == bottle_version - raise BottleVersionMismatchError.new(@bottle_filename, bottle_version, formula, formula_version) - end formula end end diff --git a/Library/Homebrew/keg_relocate.rb b/Library/Homebrew/keg_relocate.rb index 085748632..71773db81 100644 --- a/Library/Homebrew/keg_relocate.rb +++ b/Library/Homebrew/keg_relocate.rb @@ -124,6 +124,7 @@ class Keg next true if pn.symlink? next true if pn.directory? next false if pn.basename.to_s == "orig-prefix.txt" # for python virtualenvs + next true if pn == self/".brew/#{name}.rb" next true if Metafiles::EXTENSIONS.include?(pn.extname) if pn.text_executable? text_files << pn diff --git a/Library/Homebrew/locale.rb b/Library/Homebrew/locale.rb index d918e2a2a..c430d11b6 100644 --- a/Library/Homebrew/locale.rb +++ b/Library/Homebrew/locale.rb @@ -2,9 +2,9 @@ class Locale class ParserError < StandardError end - LANGUAGE_REGEX = /(?:[a-z]{2,3})/ # ISO 639-1 or ISO 639-2 - REGION_REGEX = /(?:[A-Z]{2})/ # ISO 3166-1 - SCRIPT_REGEX = /(?:[A-Z][a-z]{3})/ # ISO 15924 + LANGUAGE_REGEX = /(?:[a-z]{2,3})/ # ISO 639-1 or ISO 639-2 + REGION_REGEX = /(?:[A-Z]{2}|\d{3})/ # ISO 3166-1 or UN M.49 + SCRIPT_REGEX = /(?:[A-Z][a-z]{3})/ # ISO 15924 LOCALE_REGEX = /\A((?:#{LANGUAGE_REGEX}|#{REGION_REGEX}|#{SCRIPT_REGEX})(?:\-|$)){1,3}\Z/ diff --git a/Library/Homebrew/manpages/brew-cask.1.md b/Library/Homebrew/manpages/brew-cask.1.md index 715d8fd77..1c7c198b0 100644 --- a/Library/Homebrew/manpages/brew-cask.1.md +++ b/Library/Homebrew/manpages/brew-cask.1.md @@ -19,7 +19,7 @@ names, and other aspects of this manual are still subject to change. ## FREQUENTLY USED COMMANDS - * `install` [--force] [--skip-cask-deps] [--require-sha] <token> [ <token> ... ]: + * `install` [--force] [--skip-cask-deps] [--require-sha] [--language=<iso-language>[,<iso-language> ... ]] <token> [ <token> ... ]: Install Cask identified by <token>. * `uninstall` [--force] <token> [ <token> ... ]: @@ -34,7 +34,7 @@ names, and other aspects of this manual are still subject to change. ## COMMANDS - * `audit` [ <token> ... ]: + * `audit` [--language=<iso-language>[,<iso-language> ... ]] [ <token> ... ]: Check the given Casks for installability. If no tokens are given on the command line, all Casks are audited. @@ -167,6 +167,9 @@ in a future version. * `--appdir=<path>`: Target location for Applications. The default value is `/Applications`. + * `--language=<iso-language>[,<iso-language> ... ]]`: + Set language of the Cask to install. The first matching language is used, otherwise the default language on the Cask. The default value is the `language of your system`. + * `--colorpickerdir=<path>`: Target location for Color Pickers. The default value is `~/Library/ColorPickers`. diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb index e8c92a607..15c301f99 100644 --- a/Library/Homebrew/os/mac.rb +++ b/Library/Homebrew/os/mac.rb @@ -5,6 +5,7 @@ require "os/mac/xcode" require "os/mac/xquartz" require "os/mac/pathname" require "os/mac/sdk" +require "os/mac/keg" module OS module Mac diff --git a/Library/Homebrew/os/mac/keg.rb b/Library/Homebrew/os/mac/keg.rb new file mode 100644 index 000000000..6caadb1d7 --- /dev/null +++ b/Library/Homebrew/os/mac/keg.rb @@ -0,0 +1,29 @@ +class Keg + def change_dylib_id(id, file) + return if file.dylib_id == id + @require_relocation = true + puts "Changing dylib ID of #{file}\n from #{file.dylib_id}\n to #{id}" if ARGV.debug? + MachO::Tools.change_dylib_id(file, id, strict: false) + rescue MachO::MachOError + onoe <<-EOS.undent + Failed changing dylib ID of #{file} + from #{file.dylib_id} + to #{id} + EOS + raise + end + + def change_install_name(old, new, file) + return if old == new + @require_relocation = true + puts "Changing install name in #{file}\n from #{old}\n to #{new}" if ARGV.debug? + MachO::Tools.change_install_name(file, old, new, strict: false) + rescue MachO::MachOError + onoe <<-EOS.undent + Failed changing install name in #{file} + from #{old} + to #{new} + EOS + raise + end +end diff --git a/Library/Homebrew/os/mac/mach.rb b/Library/Homebrew/os/mac/mach.rb index 29273cbaa..9b53c4979 100644 --- a/Library/Homebrew/os/mac/mach.rb +++ b/Library/Homebrew/os/mac/mach.rb @@ -61,34 +61,6 @@ module MachOShim macho.dylib_id end - def change_dylib_id(id) - return if dylib_id == id - puts "Changing dylib ID of #{self}\n from #{dylib_id}\n to #{id}" if ARGV.debug? - macho.change_dylib_id(id, strict: false) - macho.write! - rescue MachO::MachOError - odie <<-EOS.undent - Failed changing dylib ID of #{self} - from #{file.dylib_id} - to #{id} - EOS - raise - end - - def change_install_name(old, new) - return if old == new - puts "Changing install name in #{self}\n from #{old}\n to #{new}" if ARGV.debug? - macho.change_install_name(old, new, strict: false) - macho.write! - rescue MachO::MachOError - odie <<-EOS.undent - Failed changing install name in #{self} - from #{old} - to #{new} - EOS - raise - end - def archs mach_data.map { |m| m.fetch :arch }.extend(ArchitectureListExtension) end diff --git a/Library/Homebrew/shims/super/make b/Library/Homebrew/shims/super/make index 7b49e56c0..46de53131 100755 --- a/Library/Homebrew/shims/super/make +++ b/Library/Homebrew/shims/super/make @@ -1,5 +1,10 @@ #!/bin/bash -export MAKE=${HOMEBREW_MAKE:-make} +if [[ -n "$HOMEBREW_MAKE" && "$HOMEBREW_MAKE" != "make" ]] +then + export MAKE="$HOMEBREW_MAKE" +else + MAKE="make" +fi export HOMEBREW_CCCFG="O$HOMEBREW_CCCFG" -exec xcrun $MAKE "$@" +exec xcrun "$MAKE" "$@" diff --git a/Library/Homebrew/test/bottle_hooks_spec.rb b/Library/Homebrew/test/bottle_hooks_spec.rb index e70b558a1..eb6617380 100644 --- a/Library/Homebrew/test/bottle_hooks_spec.rb +++ b/Library/Homebrew/test/bottle_hooks_spec.rb @@ -8,7 +8,7 @@ describe Homebrew::Hooks::Bottles do let(:formula) do double( - bottle: nil, + bottled?: false, local_bottle_path: nil, bottle_disabled?: false, some_random_method: true, diff --git a/Library/Homebrew/test/cask/artifact/uninstall_zap_shared_examples.rb b/Library/Homebrew/test/cask/artifact/uninstall_zap_shared_examples.rb index 06eec4a01..4fdab60d0 100644 --- a/Library/Homebrew/test/cask/artifact/uninstall_zap_shared_examples.rb +++ b/Library/Homebrew/test/cask/artifact/uninstall_zap_shared_examples.rb @@ -149,6 +149,8 @@ shared_examples "#uninstall_phase or #zap_phase" do end [:delete, :trash].each do |directive| + next if directive == :trash && ENV["HOMEBREW_TESTS_COVERAGE"].nil? + context "using :#{directive}" do let(:dir) { TEST_TMPDIR } let(:absolute_path) { Pathname.new("#{dir}/absolute_path") } diff --git a/Library/Homebrew/test/exceptions_spec.rb b/Library/Homebrew/test/exceptions_spec.rb index 33547ea32..0a8313355 100644 --- a/Library/Homebrew/test/exceptions_spec.rb +++ b/Library/Homebrew/test/exceptions_spec.rb @@ -181,8 +181,8 @@ describe DuplicateResourceError do its(:to_s) { is_expected.to eq("Resource <resource foo> is defined more than once") } end -describe BottleVersionMismatchError do - subject { described_class.new("/foo.bottle.tar.gz", "1.0", formula, "1.1") } +describe BottleFormulaUnavailableError do + subject { described_class.new("/foo.bottle.tar.gz", "foo/1.0/.brew/foo.rb") } let(:formula) { double(Formula, full_name: "foo") } - its(:to_s) { is_expected.to match(/Bottle version mismatch/) } + its(:to_s) { is_expected.to match(/This bottle does not contain the formula file/) } end diff --git a/Library/Homebrew/test/formulary_spec.rb b/Library/Homebrew/test/formulary_spec.rb index 234ebc93c..3180ad9a7 100644 --- a/Library/Homebrew/test/formulary_spec.rb +++ b/Library/Homebrew/test/formulary_spec.rb @@ -14,7 +14,7 @@ describe Formulary do bottle do cellar :any_skip_relocation root_url "file://#{bottle_dir}" - sha256 "9abc8ce779067e26556002c4ca6b9427b9874d25f0cafa7028e05b5c5c410cb4" => :#{Utils::Bottles.tag} + sha256 "d48bbbe583dcfbfa608579724fc6f0328b3cd316935c6ea22f134610aaf2952f" => :#{Utils::Bottles.tag} end def install diff --git a/Library/Homebrew/test/locale_spec.rb b/Library/Homebrew/test/locale_spec.rb index 9e4d09e83..9c684f0e7 100644 --- a/Library/Homebrew/test/locale_spec.rb +++ b/Library/Homebrew/test/locale_spec.rb @@ -9,6 +9,10 @@ describe Locale do expect(described_class.parse("zh-CN-Hans")).to eql(described_class.new("zh", "CN", "Hans")) end + it "correctly parses a string with a UN M.49 region code" do + expect(described_class.parse("es-419")).to eql(described_class.new("es", "419", nil)) + end + context "raises a ParserError when given" do it "an empty string" do expect { described_class.parse("") }.to raise_error(Locale::ParserError) diff --git a/Library/Homebrew/test/os/mac/keg_spec.rb b/Library/Homebrew/test/os/mac/keg_spec.rb index 4321c61cd..562c2ba6a 100644 --- a/Library/Homebrew/test/os/mac/keg_spec.rb +++ b/Library/Homebrew/test/os/mac/keg_spec.rb @@ -5,54 +5,28 @@ describe Keg do subject { described_class.new(keg_path) } - let(:keg_path) { HOMEBREW_CELLAR/"a/1.0" } - let(:file) { keg_path/"lib/i386.dylib" } + describe "#mach_o_files" do + let(:keg_path) { HOMEBREW_CELLAR/"a/1.0" } - before(:each) do - (keg_path/"lib").mkpath - cp dylib_path("i386"), file - subject.link - end + before(:each) { (keg_path/"lib").mkpath } - after(:each) { subject.unlink } + after(:each) { subject.unlink } - describe "#change_dylib_id" do - it "does nothing if given id is same as file's dylib id" do - id = file.dylib_id - file.change_dylib_id(id) - expect(file.dylib_id).to eq(id) - end - end + it "skips hardlinks" do + cp dylib_path("i386"), keg_path/"lib/i386.dylib" + ln keg_path/"lib/i386.dylib", keg_path/"lib/i386_hardlink.dylib" - describe "#change_install_name" do - it "does nothing if given name is same as file's install name" do - file.ensure_writable do - subject.each_install_name_for(file) do |name| - file.change_install_name(name, name) - expect(name).to eq(name) - end - end + subject.link + expect(subject.mach_o_files.count).to eq(1) end - it "does nothing when install name start with '/'" do - file.ensure_writable do - subject.each_install_name_for(file) do |name| - new_name = subject.fixed_name(file, name) - file.change_install_name(name, new_name) - expect(name).not_to eq(new_name) - end - end - end - end - - describe "#require_relocation?" do - it "is set to false at initialization" do - expect(subject.require_relocation?).to be false - end + it "isn't confused by symlinks" do + cp dylib_path("i386"), keg_path/"lib/i386.dylib" + ln keg_path/"lib/i386.dylib", keg_path/"lib/i386_hardlink.dylib" + ln_s keg_path/"lib/i386.dylib", keg_path/"lib/i386_symlink.dylib" - it "is set to true after linkage is fixed" do - subject.fix_dynamic_linkage - expect(subject.require_relocation?).to be true + subject.link + expect(subject.mach_o_files.count).to eq(1) end end end diff --git a/Library/Homebrew/test/support/fixtures/bottles/testball_bottle-0.1.yosemite.bottle.tar.gz b/Library/Homebrew/test/support/fixtures/bottles/testball_bottle-0.1.yosemite.bottle.tar.gz Binary files differindex d88838a94..62ea6c264 100644 --- a/Library/Homebrew/test/support/fixtures/bottles/testball_bottle-0.1.yosemite.bottle.tar.gz +++ b/Library/Homebrew/test/support/fixtures/bottles/testball_bottle-0.1.yosemite.bottle.tar.gz diff --git a/Library/Homebrew/test/support/fixtures/testball_bottle.rb b/Library/Homebrew/test/support/fixtures/testball_bottle.rb index 9453255e6..5a6be7c5f 100644 --- a/Library/Homebrew/test/support/fixtures/testball_bottle.rb +++ b/Library/Homebrew/test/support/fixtures/testball_bottle.rb @@ -6,7 +6,7 @@ class TestballBottle < Formula stable.bottle do cellar :any_skip_relocation root_url "file://#{TEST_FIXTURE_DIR}/bottles" - sha256 "9abc8ce779067e26556002c4ca6b9427b9874d25f0cafa7028e05b5c5c410cb4" => Utils::Bottles.tag + sha256 "d48bbbe583dcfbfa608579724fc6f0328b3cd316935c6ea22f134610aaf2952f" => Utils::Bottles.tag end cxxstdlib_check :skip end diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 3033eb4dd..d293b2a6f 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -264,7 +264,7 @@ end def with_system_path old_path = ENV["PATH"] - ENV["PATH"] = "/usr/bin:/bin" + ENV["PATH"] = PATH.new("/usr/bin", "/bin") yield ensure ENV["PATH"] = old_path diff --git a/Library/Homebrew/utils/bottles.rb b/Library/Homebrew/utils/bottles.rb index 927963bc1..66b5fb640 100644 --- a/Library/Homebrew/utils/bottles.rb +++ b/Library/Homebrew/utils/bottles.rb @@ -29,9 +29,11 @@ module Utils end def receipt_path(bottle_file) - Utils.popen_read("tar", "-tzf", bottle_file).lines.map(&:chomp).find do |line| + path = Utils.popen_read("tar", "-tzf", bottle_file).lines.map(&:chomp).find do |line| line =~ %r{.+/.+/INSTALL_RECEIPT.json} end + raise "This bottle does not contain the file INSTALL_RECEIPT.json: #{bottle_file}" unless path + path end def resolve_formula_names(bottle_file) @@ -52,6 +54,15 @@ module Utils def resolve_version(bottle_file) PkgVersion.parse receipt_path(bottle_file).split("/")[1] end + + def formula_contents(bottle_file, + name: resolve_formula_names(bottle_file)[0]) + bottle_version = resolve_version bottle_file + formula_path = "#{name}/#{bottle_version}/.brew/#{name}.rb" + contents = Utils.popen_read "tar", "-xOzf", bottle_file, formula_path + raise BottleFormulaUnavailableError.new(bottle_file, formula_path) unless $CHILD_STATUS.success? + contents + end end class Bintray diff --git a/manpages/brew-cask.1 b/manpages/brew-cask.1 index f8f58a123..f2acf1842 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" "August 2017" "Homebrew" "brew-cask" +.TH "BREW\-CASK" "1" "September 2017" "Homebrew" "brew-cask" . .SH "NAME" \fBbrew\-cask\fR \- a friendly binary installer for macOS @@ -18,7 +18,7 @@ Homebrew\-Cask works robustly enough that we welcome new users, but the project .SH "FREQUENTLY USED COMMANDS" . .TP -\fBinstall\fR [\-\-force] [\-\-skip\-cask\-deps] [\-\-require\-sha] \fItoken\fR [ \fItoken\fR \.\.\. ] +\fBinstall\fR [\-\-force] [\-\-skip\-cask\-deps] [\-\-require\-sha] [\-\-language=\fIiso\-language\fR[,\fIiso\-language\fR \.\.\. ]] \fItoken\fR [ \fItoken\fR \.\.\. ] Install Cask identified by \fItoken\fR\. . .TP @@ -35,7 +35,7 @@ The tokens returned by \fBsearch\fR are suitable as arguments for most other com .SH "COMMANDS" . .TP -\fBaudit\fR [ \fItoken\fR \.\.\. ] +\fBaudit\fR [\-\-language=\fIiso\-language\fR[,\fIiso\-language\fR \.\.\. ]] [ \fItoken\fR \.\.\. ] Check the given Casks for installability\. If no tokens are given on the command line, all Casks are audited\. . .TP @@ -169,6 +169,10 @@ Give additional feedback during installation\. Target location for Applications\. The default value is \fB/Applications\fR\. . .TP +\fB\-\-language=<iso\-language>[,<iso\-language> \.\.\. ]]\fR +Set language of the Cask to install\. The first matching language is used, otherwise the default language on the Cask\. The default value is the \fBlanguage of your system\fR\. +. +.TP \fB\-\-colorpickerdir=<path>\fR Target location for Color Pickers\. The default value is \fB~/Library/ColorPickers\fR\. . diff --git a/manpages/brew.1 b/manpages/brew.1 index 362e884ed..b3d840275 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" "August 2017" "Homebrew" "brew" +.TH "BREW" "1" "September 2017" "Homebrew" "brew" . .SH "NAME" \fBbrew\fR \- The missing package manager for macOS |
