language
stringclasses
1 value
owner
stringlengths
2
15
repo
stringlengths
2
21
sha
stringlengths
45
45
message
stringlengths
7
36.3k
path
stringlengths
1
199
patch
stringlengths
15
102k
is_multipart
bool
2 classes
Other
Homebrew
brew
0165a810f72f6ac4dd4385c31e749fc786a04c58.json
search: handle tap aliases
Library/Homebrew/cmd/search.rb
@@ -137,13 +137,14 @@ def search_tap(user, repo, rx) end def search_formulae(rx) - aliases = Formula.aliases + aliases = Formula.alias_full_names results = (Formula.full_names+aliases).grep(rx).sort + result_names = results.map { |name| name.split("/")[-1] }.uniq results.map do |name| canonical_name = Formulary.canonical_name(name) # Ignore aliases from results when the full name was also found - if aliases.include?(name) && results.include?(canonical_name) + if aliases.include?(name) && result_names.include?(canonical_name) next elsif (HOMEBREW_CELLAR/canonical_name).directory? "#{name} (installed)"
false
Other
Homebrew
brew
002f8f2eb79af9db832133ca785abf6097582e3a.json
audit: handle tap aliases
Library/Homebrew/cmd/audit.rb
@@ -210,7 +210,8 @@ def audit_class end end - @@aliases ||= Formula.aliases + # core aliases + tap alias names + tap alias full name + @@aliases ||= Formula.aliases + Formula.tap_aliases def audit_formula_name return unless @strict @@ -220,7 +221,7 @@ def audit_formula_name name = formula.name full_name = formula.full_name - if @@aliases.include? name + if Formula.aliases.include? name problem "Formula name conflicts with existing aliases." return end
false
Other
Homebrew
brew
2df6ad1beda5f29f6eaf6807ec4a53f59bb20260.json
Formula#to_hash: add bottle info Closes Homebrew/homebrew#43848. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/formula.rb
@@ -1120,6 +1120,28 @@ def to_hash { "option" => opt.flag, "description" => opt.description } end + hsh["bottle"] = {} + %w[stable devel].each do |spec_sym| + next unless spec = send(spec_sym) + next unless (bottle_spec = spec.bottle_specification).checksums.any? + bottle_info = { + "revision" => bottle_spec.revision, + "cellar" => (cellar = bottle_spec.cellar).is_a?(Symbol) ? \ + cellar.inspect : cellar, + "prefix" => bottle_spec.prefix, + "root_url" => bottle_spec.root_url, + } + bottle_info["files"] = {} + bottle_spec.collector.keys.each do |os| + checksum = bottle_spec.collector[os] + bottle_info["files"][os] = { + "url" => "#{bottle_spec.root_url}/#{Bottle::Filename.create(self, os, bottle_spec.revision)}", + checksum.hash_type.to_s => checksum.hexdigest, + } + end + hsh["bottle"][spec_sym] = bottle_info + end + if rack.directory? rack.subdirs.each do |keg_path| keg = Keg.new keg_path
false
Other
Homebrew
brew
81bd5c40d0719d3d64dc94e163ded2cc2f57b3e6.json
Formula: add tap alias Closes Homebrew/homebrew#43851. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/formula.rb
@@ -1011,9 +1011,22 @@ def self.installed end.compact end + # an array of all core aliases + # @private + def self.core_aliases + @core_aliases ||= Dir["#{HOMEBREW_LIBRARY}/Aliases/*"].map { |f| File.basename f }.sort + end + + # an array of all tap aliases + # @private + def self.tap_aliases + @tap_aliases ||= Tap.flat_map(&:aliases).sort + end + + # an array of all aliases # @private def self.aliases - Dir["#{HOMEBREW_LIBRARY}/Aliases/*"].map { |f| File.basename f }.sort + @aliases ||= (core_aliases + tap_aliases).sort.uniq end def self.[](name)
false
Other
Homebrew
brew
4613c9ecf5fbb0023fe44cde5c1ce1664b602b74.json
Tap: add alias method
Library/Homebrew/tap.rb
@@ -96,6 +96,18 @@ def formula_names formula_files.map { |f| "#{name}/#{f.basename(".rb")}" } end + # an array of all alias files of this {Tap}. + # @private + def alias_files + Pathname.glob("#{path}/Aliases/*").select(&:file?) + end + + # an array of all aliases of this {Tap}. + # @private + def aliases + alias_files.map { |f| f.basename.to_s } + end + # an array of all commands files of this {Tap}. def command_files Pathname.glob("#{path}/cmd/brew-*").select(&:executable?)
false
Other
Homebrew
brew
5f68fff92b8b3389ca023f913f1e6d83282a3eab.json
support alias for tap
Library/Homebrew/formulary.rb
@@ -148,7 +148,15 @@ def initialize(tapped_name) @tap = Tap.new user, repo.sub(/^homebrew-/, "") name = @tap.formula_renames.fetch(name, name) path = @tap.formula_files.detect { |file| file.basename(".rb").to_s == name } - path ||= @tap.path/"#{name}.rb" + + unless path + if (possible_alias = @tap.path/"Aliases/#{name}").file? + path = possible_alias.resolved_path + name = path.basename(".rb").to_s + else + path = @tap.path/"#{name}.rb" + end + end super name, path end @@ -279,7 +287,9 @@ def self.loader_for(ref) if possible_tap_formulae.size > 1 raise TapFormulaAmbiguityError.new(ref, possible_tap_formulae) elsif possible_tap_formulae.size == 1 - return FormulaLoader.new(ref, possible_tap_formulae.first) + path = possible_tap_formulae.first.resolved_path + name = path.basename(".rb").to_s + return FormulaLoader.new(name, path) end if newref = FORMULA_RENAMES[ref] @@ -320,7 +330,8 @@ def self.tap_paths(name, taps = Dir["#{HOMEBREW_LIBRARY}/Taps/*/*/"]) Pathname.glob([ "#{tap}Formula/#{name}.rb", "#{tap}HomebrewFormula/#{name}.rb", - "#{tap}#{name}.rb" + "#{tap}#{name}.rb", + "#{tap}Aliases/#{name}", ]).detect(&:file?) end.compact end
false
Other
Homebrew
brew
3bc2ff8e201b3f64c8431b5dc1eb5a49c05b864d.json
Accept "gcc" for --cc=gcc-5 even if not installed
Library/Homebrew/extend/ENV/shared.rb
@@ -248,7 +248,7 @@ def gcc_version_formula(name) gcc_version_name = "gcc#{version.delete(".")}" gcc = Formulary.factory("gcc") - if gcc.opt_bin.join(name).exist? + if gcc.version_suffix == version gcc else Formulary.factory(gcc_version_name)
false
Other
Homebrew
brew
7ce0a2dedbb580501557168cacf14e27525cd2ad.json
test-bot: check ARGV.include?("--skip-homebrew") once
Library/Homebrew/cmd/test-bot.rb
@@ -184,7 +184,7 @@ def initialize(argument, options={}) @steps = [] @tap = options[:tap] @repository = Homebrew.homebrew_git_repo @tap - @skip_homebrew = ARGV.include?("--skip-homebrew") || options[:skip_homebrew] + @skip_homebrew = options[:skip_homebrew] url_match = argument.match HOMEBREW_PULL_OR_COMMIT_URL_REGEX @@ -860,13 +860,13 @@ def test_bot tests = [] any_errors = false + skip_homebrew = ARGV.include?("--skip-homebrew") if ARGV.named.empty? # With no arguments just build the most recent commit. - head_test = Test.new("HEAD", :tap => tap) + head_test = Test.new("HEAD", :tap => tap, :skip_homebrew => skip_homebrew) any_errors = !head_test.run tests << head_test else - skip_homebrew = false ARGV.named.each do |argument| test_error = false begin
false
Other
Homebrew
brew
e52a12a8b5f52ed80d6717214a53cedac347d8b8.json
test-bot: fix syntax error
Library/Homebrew/cmd/test-bot.rb
@@ -870,8 +870,8 @@ def test_bot ARGV.named.each do |argument| test_error = false begin - test = Test.new(argument, :tap => tap, :skip_homebrew = skip_homebrew) - skip_homebrew ||= true + test = Test.new(argument, :tap => tap, :skip_homebrew => skip_homebrew) + skip_homebrew = true rescue ArgumentError => e test_error = true ofail e.message
false
Other
Homebrew
brew
96be0c2724072a0e20a8b0631abd90094cf69d1c.json
test-bot: skip some unnecessary tests.
Library/Homebrew/cmd/test-bot.rb
@@ -175,15 +175,16 @@ def fix_encoding(str) class Test attr_reader :log_root, :category, :name, :steps - def initialize(argument, tap = nil) + def initialize(argument, options={}) @hash = nil @url = nil @formulae = [] @added_formulae = [] @modified_formula = [] @steps = [] - @tap = tap + @tap = options[:tap] @repository = Homebrew.homebrew_git_repo @tap + @skip_homebrew = ARGV.include?("--skip-homebrew") || options[:skip_homebrew] url_match = argument.match HOMEBREW_PULL_OR_COMMIT_URL_REGEX @@ -571,9 +572,9 @@ def formula(formula_name) def homebrew @category = __method__ - return if ARGV.include? "--skip-homebrew" + return if @skip_homebrew test "brew", "tests" - test "brew", "tests", "--no-compat" + test "brew", "tests", "--no-compat" if @tap readall_args = ["--aliases"] readall_args << "--syntax" if MacOS.version >= :mavericks test "brew", "readall", *readall_args @@ -861,14 +862,16 @@ def test_bot any_errors = false if ARGV.named.empty? # With no arguments just build the most recent commit. - head_test = Test.new("HEAD", tap) + head_test = Test.new("HEAD", :tap => tap) any_errors = !head_test.run tests << head_test else + skip_homebrew = false ARGV.named.each do |argument| test_error = false begin - test = Test.new(argument, tap) + test = Test.new(argument, :tap => tap, :skip_homebrew = skip_homebrew) + skip_homebrew ||= true rescue ArgumentError => e test_error = true ofail e.message
false
Other
Homebrew
brew
fe204fdf4b5e7c10f88cf19e099b5bbedd67c600.json
bottle: fix output for absolute symlinks Closes Homebrew/homebrew#43816. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/cmd/bottle.rb
@@ -76,15 +76,12 @@ def print_filename(string, filename) Utils.popen_read("strings", "-t", "x", "-", file.to_s) do |io| until io.eof? str = io.readline.chomp - next if ignores.any? { |i| i =~ str } - next unless str.include? string - offset, match = str.split(" ", 2) - next if linked_libraries.include? match # Don't bother reporting a string if it was found by otool - result ||= true + + result = true if ARGV.verbose? print_filename string, file @@ -94,19 +91,36 @@ def print_filename(string, filename) end end - put_symlink_header = false + absolute_symlinks_start_with_string = [] + absolute_symlinks_rest = [] keg.find do |pn| if pn.symlink? && (link = pn.readlink).absolute? - if !put_symlink_header && link.to_s.start_with?(string) - opoo "Absolute symlink starting with #{string}:" - puts " #{pn} -> #{pn.resolved_path}" - put_symlink_header = true + if link.to_s.start_with?(string) + absolute_symlinks_start_with_string << pn + else + absolute_symlinks_rest << pn end result = true end end + if ARGV.verbose? + if absolute_symlinks_start_with_string.any? + opoo "Absolute symlink starting with #{string}:" + absolute_symlinks_start_with_string.each do |pn| + puts " #{pn} -> #{pn.resolved_path}" + end + end + + if absolute_symlinks_rest.any? + opoo "Absolute symlink:" + absolute_symlinks_rest.each do |pn| + puts " #{pn} -> #{pn.resolved_path}" + end + end + end + result end
false
Other
Homebrew
brew
5241932b45d8d0897cb1af0f9c6dccf6c2250d29.json
keg_relocate: fix absolute symlink
Library/Homebrew/keg_relocate.rb
@@ -16,6 +16,15 @@ def fix_install_names(options = {}) end end end + + symlink_files.each do |file| + link = file.readlink + # Don't fix relative symlinks + next unless link.absolute? + if link.to_s.start_with?(HOMEBREW_CELLAR.to_s) || link.to_s.start_with?(HOMEBREW_PREFIX.to_s) + FileUtils.ln_sf(link.relative_path_from(file.parent), file) + end + end end def relocate_install_names(old_prefix, new_prefix, old_cellar, new_cellar, options = {}) @@ -184,4 +193,13 @@ def libtool_files end if lib.directory? libtool_files end + + def symlink_files + symlink_files = [] + path.find do |pn| + symlink_files << pn if pn.symlink? + end + + symlink_files + end end
false
Other
Homebrew
brew
5997812ed23164cf3f52fe328ec665fe8cf70622.json
Revert "python_requirement: fix ENV for python3" This reverts commit 85271644b0083cbc0fd6fea71120d1ad859fbc2a. Alex noticed that setting PYTHONPATH causes weirdness if we depend_on something which may be optionally built --with-python3; PYTHONPATH unexpectedly contains python3 modules in the depending formula if the formula upon which it depends was built --with-python3 even though the depending formula may only use python2. Closes Homebrew/homebrew#43724. Closes Homebrew/homebrew#43744.
Library/Homebrew/requirements/python_requirement.rb
@@ -24,7 +24,9 @@ class PythonRequirement < Requirement ENV.prepend_path "PATH", Formula["python"].opt_bin end - ENV["PYTHONPATH"] = "#{HOMEBREW_PREFIX}/lib/python#{short_version}/site-packages" + if python_binary == "python" + ENV["PYTHONPATH"] = "#{HOMEBREW_PREFIX}/lib/python#{short_version}/site-packages" + end end def python_short_version @@ -60,10 +62,6 @@ class Python3Requirement < PythonRequirement satisfy(:build_env => false) { which_python } - env do - ENV["PYTHONPATH"] = "#{HOMEBREW_PREFIX}/lib/python#{python_short_version}/site-packages" - end - def python_binary "python3" end
false
Other
Homebrew
brew
0357673f213046b3bd29109be2e14c978e2aca3d.json
config: fix ruby path for ruby 1.8
Library/Homebrew/cmd/config.rb
@@ -87,7 +87,7 @@ def describe_python def describe_ruby ruby = which "ruby" return "N/A" if ruby.nil? - ruby_binary = Utils.popen_read ruby, "-e", \ + ruby_binary = Utils.popen_read ruby, "-rrbconfig", "-e", \ 'include RbConfig;print"#{CONFIG["bindir"]}/#{CONFIG["ruby_install_name"]}#{CONFIG["EXEEXT"]}"' ruby_binary = Pathname.new(ruby_binary).realpath if ruby == ruby_binary
false
Other
Homebrew
brew
43ba72fb5768427b78d1a044488c5fce1539c419.json
descriptions: use each instead of map
Library/Homebrew/descriptions.rb
@@ -27,7 +27,7 @@ def self.save_cache # save it for future use. def self.generate_cache @cache = {} - Formula.map do |f| + Formula.each do |f| @cache[f.full_name] = f.desc end self.save_cache
false
Other
Homebrew
brew
65996b5887ac6e4b669e9460b8e2a4fbc7171984.json
use json to cache descriptions We need to use `atomic_write` when saving the cache. And it seems that CSV module doesn't support dump, so let's use JSON instead.
Library/Homebrew/descriptions.rb
@@ -1,9 +1,8 @@ require "formula" require "formula_versions" -require "csv" class Descriptions - CACHE_FILE = HOMEBREW_CACHE + "desc_cache" + CACHE_FILE = HOMEBREW_CACHE + "desc_cache.json" def self.cache @cache || self.load_cache @@ -13,21 +12,15 @@ def self.cache # return nil. def self.load_cache if CACHE_FILE.exist? - @cache = {} - CSV.foreach(CACHE_FILE) { |name, desc| @cache[name] = desc } - @cache + @cache = Utils::JSON.load(CACHE_FILE.read) end end # Write the cache to disk after ensuring the existence of the containing # directory. def self.save_cache HOMEBREW_CACHE.mkpath - CSV.open(CACHE_FILE, 'w') do |csv| - @cache.each do |name, desc| - csv << [name, desc] - end - end + CACHE_FILE.atomic_write Utils::JSON.dump(@cache) end # Create a hash mapping all formulae to their descriptions;
false
Other
Homebrew
brew
c5536e1e08a13352cf241a2c3f7b2aa75a8e31d6.json
Descriptions.cache_formulae: secure formulae loading
Library/Homebrew/descriptions.rb
@@ -1,4 +1,5 @@ require "formula" +require "formula_versions" require "csv" class Descriptions @@ -92,7 +93,13 @@ def self.update_cache(report) # cache. Save the updated cache to disk, unless explicitly told not to. def self.cache_formulae(formula_names, options = { :save => true }) if self.cache - formula_names.each { |name| @cache[name] = Formula[name].desc } + formula_names.each do |name| + begin + desc = Formulary.factory(name).desc + rescue FormulaUnavailableError, *FormulaVersions::IGNORED_EXCEPTIONS + end + @cache[name] = desc + end self.save_cache if options[:save] end end
false
Other
Homebrew
brew
63246fbc6c725d0bc78641a015538a6147ba4058.json
config: show all installed JDK Closes Homebrew/homebrew#43730. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/cmd/config.rb
@@ -1,5 +1,6 @@ require "hardware" require "software_spec" +require "rexml/document" module Homebrew def config @@ -118,14 +119,13 @@ def describe_system_ruby end def describe_java - if which("java").nil? - "N/A" - elsif !quiet_system "/usr/libexec/java_home", "--failfast" - "N/A" - else - java = `java -version 2>&1`.lines.first.chomp - java =~ /java version "(.+?)"/ ? $1 : java + java_xml = Utils.popen_read("/usr/libexec/java_home", "--xml", "--failfast") + return "N/A" unless $?.success? + javas = [] + REXML::XPath.each(REXML::Document.new(java_xml), "//key[text()='JVMVersion']/following-sibling::string") do |item| + javas << item.text end + javas.uniq.join(", ") end def dump_verbose_config(f = $stdout)
false
Other
Homebrew
brew
657f4ca2ce6230d2e770f501b496b1cbb2cede00.json
rubocop: allow consistent trailing commas. Makes diffs nicer. Could maybe be changed to `comma` to be stricter.
Library/.rubocop.yml
@@ -123,3 +123,7 @@ Style/PerlBackrefs: # this is required for Ruby 1.8 Style/DotPosition: EnforcedStyle: trailing + +# makes diffs nicer +Style/TrailingComma: + EnforcedStyleForMultiline: consistent_comma
false
Other
Homebrew
brew
c8efb058267b3500ee5c40ebf58de3feea8841a5.json
doctor: use Utils.git_available? instead of git?
Library/Homebrew/cmd/doctor.rb
@@ -59,14 +59,6 @@ def find_relative_paths(*relative_paths) def inject_file_list(list, str) list.inject(str) { |s, f| s << " #{f}\n" } end - - # Git will always be on PATH because of the wrapper script in - # Library/ENV/scm, so we check if there is a *real* - # git here to avoid multiple warnings. - def git? - return @git if instance_variable_defined?(:@git) - @git = system "git --version >/dev/null 2>&1" - end ############# END HELPERS # Sorry for the lack of an indent here, the diff would have been unreadable. @@ -884,7 +876,7 @@ def __check_git_version end def check_for_git - if git? + if Utils.git_available? __check_git_version else <<-EOS.undent Git could not be found in your PATH. @@ -896,7 +888,7 @@ def check_for_git end def check_git_newline_settings - return unless git? + return unless Utils.git_available? autocrlf = `git config --get core.autocrlf`.chomp @@ -914,7 +906,7 @@ def check_git_newline_settings end def check_git_origin - return unless git? && (HOMEBREW_REPOSITORY/".git").exist? + return if !Utils.git_available? || !(HOMEBREW_REPOSITORY/".git").exist? origin = Homebrew.git_origin @@ -1026,7 +1018,7 @@ def check_missing_deps end def check_git_status - return unless git? + return unless Utils.git_available? HOMEBREW_REPOSITORY.cd do unless `git status --untracked-files=all --porcelain -- Library/Homebrew/ 2>/dev/null`.chomp.empty? <<-EOS.undent_________________________________________________________72 @@ -1120,7 +1112,7 @@ def check_for_pydistutils_cfg_in_home end def check_for_outdated_homebrew - return unless git? + return unless Utils.git_available? HOMEBREW_REPOSITORY.cd do if File.directory? ".git" local = `git rev-parse -q --verify refs/remotes/origin/master`.chomp
true
Other
Homebrew
brew
c8efb058267b3500ee5c40ebf58de3feea8841a5.json
doctor: use Utils.git_available? instead of git?
Library/Homebrew/utils/git.rb
@@ -1,7 +1,8 @@ module Utils def self.git_available? return @git if instance_variable_defined?(:@git) - git = which("git") + # check git in original path in case it's the wrapper script of Library/ENV/scm + git = which("git", ORIGINAL_PATHS.join(File::PATH_SEPARATOR)) # git isn't installed by older Xcodes return @git = false if git.nil? # /usr/bin/git is a popup stub when Xcode/CLT aren't installed, so bail out
true
Other
Homebrew
brew
31ddce85e7d37eac032e0dd80a6f45cd2ff1d4f8.json
Homebrew.git_*: check git available
Library/Homebrew/utils.rb
@@ -150,27 +150,32 @@ def self.system(cmd, *args) end def self.git_origin + return unless Utils.git_available? HOMEBREW_REPOSITORY.cd { `git config --get remote.origin.url 2>/dev/null`.chuzzle } end def self.git_head + return unless Utils.git_available? HOMEBREW_REPOSITORY.cd { `git rev-parse --verify -q HEAD 2>/dev/null`.chuzzle } end def self.git_short_head + return unless Utils.git_available? HOMEBREW_REPOSITORY.cd { `git rev-parse --short=4 --verify -q HEAD 2>/dev/null`.chuzzle } end def self.git_last_commit + return unless Utils.git_available? HOMEBREW_REPOSITORY.cd { `git show -s --format="%cr" HEAD 2>/dev/null`.chuzzle } end def self.git_last_commit_date + return unless Utils.git_available? HOMEBREW_REPOSITORY.cd { `git show -s --format="%cd" --date=short HEAD 2>/dev/null`.chuzzle } end def self.homebrew_version_string - if Utils.git_available? && (pretty_revision = git_short_head) + if pretty_revision = git_short_head last_commit = git_last_commit_date "#{HOMEBREW_VERSION} (git revision #{pretty_revision}; last commit #{last_commit})" else
false
Other
Homebrew
brew
4529df1246a8db82ee07c4945f62b801ba6bf655.json
git_available?: cache the result
Library/Homebrew/utils/git.rb
@@ -1,11 +1,12 @@ module Utils def self.git_available? + return @git if instance_variable_defined?(:@git) git = which("git") # git isn't installed by older Xcodes - return false if git.nil? + return @git = false if git.nil? # /usr/bin/git is a popup stub when Xcode/CLT aren't installed, so bail out - return false if git == "/usr/bin/git" && !OS::Mac.has_apple_developer_tools? - true + return @git = false if git == "/usr/bin/git" && !OS::Mac.has_apple_developer_tools? + @git = true end def self.ensure_git_installed!
false
Other
Homebrew
brew
edbb3a9e53358a720c390df23839cf8f4abb1b10.json
Use system tar for bottle TOC inspection Closes Homebrew/homebrew#43717. Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
Library/Homebrew/bottles.rb
@@ -39,7 +39,7 @@ def bottle_tag end def bottle_receipt_path(bottle_file) - Utils.popen_read("tar", "-tzf", bottle_file, "*/*/INSTALL_RECEIPT.json").chomp + Utils.popen_read("/usr/bin/tar", "-tzf", bottle_file, "*/*/INSTALL_RECEIPT.json").chomp end def bottle_resolve_formula_names(bottle_file)
false
Other
Homebrew
brew
48ba192a3bac609c1bdd7355d4749d624b973c46.json
formula_support: add Pre El Capitan keg_only
Library/Homebrew/formula_support.rb
@@ -15,6 +15,8 @@ def valid? MacOS.version < :mountain_lion when :provided_pre_mavericks MacOS.version < :mavericks + when :provided_pre_el_capitan + MacOS.version < :el_capitan when :provided_until_xcode43 MacOS::Xcode.version < "4.3" when :provided_until_xcode5 @@ -34,12 +36,15 @@ def to_s when :shadowed_by_osx then <<-EOS OS X provides similar software and installing this software in parallel can cause all kinds of trouble. +EOS + when :provided_pre_mountain_lion then <<-EOS +OS X already provides this software in versions before Mountain Lion. EOS when :provided_pre_mavericks then <<-EOS OS X already provides this software in versions before Mavericks. EOS - when :provided_pre_mountain_lion then <<-EOS -OS X already provides this software in versions before Mountain Lion. + when :provided_pre_el_capitan then <<-EOS +OS X already provides this software in versions before El Capitan. EOS when :provided_until_xcode43 "Xcode provides this software prior to version 4.3."
false
Other
Homebrew
brew
837437416840d4c4f132b7e4ba2ea0fa2f861668.json
Improve description searching and add a cache. Closes Homebrew/homebrew#42281. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Library/Contributions/brew_bash_completion.sh
@@ -195,6 +195,18 @@ _brew_deps () __brew_complete_formulae } +_brew_desc () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __brewcomp "--search --name --description" + return + ;; + esac + __brew_complete_formulae +} + _brew_doctor () { local cur="${COMP_WORDS[COMP_CWORD]}" __brewcomp "$(brew doctor --list-checks)" @@ -599,6 +611,7 @@ _brew () cleanup) _brew_cleanup ;; create) _brew_create ;; deps) _brew_deps ;; + desc) _brew_desc ;; doctor|dr) _brew_doctor ;; diy|configure) _brew_diy ;; fetch) _brew_fetch ;;
true
Other
Homebrew
brew
837437416840d4c4f132b7e4ba2ea0fa2f861668.json
Improve description searching and add a cache. Closes Homebrew/homebrew#42281. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Library/Contributions/brew_zsh_completion.zsh
@@ -40,6 +40,7 @@ _1st_arguments=( 'config:show homebrew and system configuration' 'create:create a new formula' 'deps:list dependencies and dependants of a formula' + 'desc:display a description of a formula' 'doctor:audits your installation for common issues' 'edit:edit a formula' 'fetch:download formula resources to the cache' @@ -95,7 +96,7 @@ if (( CURRENT == 1 )); then fi case "$words[1]" in - install|reinstall|audit|home|homepage|log|info|abv|uses|cat|deps|edit|options|switch) + install|reinstall|audit|home|homepage|log|info|abv|uses|cat|deps|desc|edit|options|switch) _brew_all_formulae _wanted formulae expl 'all formulae' compadd -a formulae ;; list|ls)
true
Other
Homebrew
brew
837437416840d4c4f132b7e4ba2ea0fa2f861668.json
Improve description searching and add a cache. Closes Homebrew/homebrew#42281. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Library/Homebrew/cmd/desc.rb
@@ -0,0 +1,40 @@ +require "descriptions" +require "cmd/search" + +module Homebrew + def desc + if ARGV.options_only.empty? + if ARGV.named.empty? + raise FormulaUnspecifiedError + exit + end + results = Descriptions.named(ARGV.formulae.map(&:full_name)) + else + if ARGV.options_only.count != 1 + odie "Pick one, and only one, of -s/--search, -n/--name, or -d/--description." + end + + search_arg = ARGV.options_only.first + + search_type = case search_arg + when '-s', '--search' + :either + when '-n', '--name' + :name + when '-d', '--description' + :desc + else + odie "Unrecognized option '#{search_arg}'." + end + + if arg = ARGV.named.first + regex = Homebrew::query_regexp(arg) + results = Descriptions.search(regex, search_type) + else + odie "You must provide a search term." + end + end + + results.print unless results.nil? + end +end
true
Other
Homebrew
brew
837437416840d4c4f132b7e4ba2ea0fa2f861668.json
Improve description searching and add a cache. Closes Homebrew/homebrew#42281. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Library/Homebrew/cmd/search.rb
@@ -3,6 +3,7 @@ require "utils" require "thread" require "official_taps" +require 'descriptions' module Homebrew SEARCH_ERROR_QUEUE = Queue.new @@ -23,11 +24,7 @@ def search elsif ARGV.include? "--desc" query = ARGV.next rx = query_regexp(query) - Formula.each do |formula| - if formula.desc =~ rx - puts "#{Tty.white}#{formula.full_name}:#{Tty.reset} #{formula.desc}" - end - end + Descriptions.search(rx, :desc).print elsif ARGV.empty? puts_columns Formula.full_names elsif ARGV.first =~ HOMEBREW_TAP_FORMULA_REGEX
true
Other
Homebrew
brew
837437416840d4c4f132b7e4ba2ea0fa2f861668.json
Improve description searching and add a cache. Closes Homebrew/homebrew#42281. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Library/Homebrew/cmd/tap.rb
@@ -1,4 +1,5 @@ require "tap" +require "descriptions" module Homebrew def tap @@ -41,6 +42,7 @@ def install_tap(user, repo, clone_target = nil) formula_count = tap.formula_files.size puts "Tapped #{formula_count} formula#{plural(formula_count, "e")} (#{tap.path.abv})" + Descriptions.cache_formulae(tap.formula_names) if !clone_target && tap.private? puts <<-EOS.undent
true
Other
Homebrew
brew
837437416840d4c4f132b7e4ba2ea0fa2f861668.json
Improve description searching and add a cache. Closes Homebrew/homebrew#42281. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Library/Homebrew/cmd/untap.rb
@@ -1,4 +1,5 @@ require "cmd/tap" # for tap_args +require "descriptions" module Homebrew def untap @@ -13,6 +14,7 @@ def untap tap.unpin if tap.pinned? formula_count = tap.formula_files.size + Descriptions.uncache_formulae(tap.formula_names) tap.path.rmtree tap.path.dirname.rmdir_if_possible puts "Untapped #{formula_count} formula#{plural(formula_count, "e")}"
true
Other
Homebrew
brew
837437416840d4c4f132b7e4ba2ea0fa2f861668.json
Improve description searching and add a cache. Closes Homebrew/homebrew#42281. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Library/Homebrew/cmd/update.rb
@@ -2,6 +2,7 @@ require "formula_versions" require "migrator" require "formulary" +require "descriptions" module Homebrew def update @@ -100,6 +101,7 @@ def update puts "Updated Homebrew from #{master_updater.initial_revision[0, 8]} to #{master_updater.current_revision[0, 8]}." report.dump end + Descriptions.update_cache(report) end private
true
Other
Homebrew
brew
837437416840d4c4f132b7e4ba2ea0fa2f861668.json
Improve description searching and add a cache. Closes Homebrew/homebrew#42281. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Library/Homebrew/descriptions.rb
@@ -0,0 +1,151 @@ +require "formula" +require "csv" + +class Descriptions + CACHE_FILE = HOMEBREW_CACHE + "desc_cache" + + def self.cache + @cache || self.load_cache + end + + # If the cache file exists, load it into, and return, a hash; otherwise, + # return nil. + def self.load_cache + if CACHE_FILE.exist? + @cache = {} + CSV.foreach(CACHE_FILE) { |name, desc| @cache[name] = desc } + @cache + end + end + + # Write the cache to disk after ensuring the existence of the containing + # directory. + def self.save_cache + HOMEBREW_CACHE.mkpath + CSV.open(CACHE_FILE, 'w') do |csv| + @cache.each do |name, desc| + csv << [name, desc] + end + end + end + + # Create a hash mapping all formulae to their descriptions; + # save it for future use. + def self.generate_cache + @cache = {} + Formula.map do |f| + @cache[f.full_name] = f.desc + end + self.save_cache + end + + # Return true if the cache exists, and neither Homebrew nor any of the Taps + # repos were updated more recently than it was. + def self.cache_fresh? + if CACHE_FILE.exist? + cache_date = File.mtime(CACHE_FILE) + + ref_master = ".git/refs/heads/master" + master = HOMEBREW_REPOSITORY/ref_master + + last_update = (master.exist? ? File.mtime(master) : Time.at(0)) + + Dir.glob(HOMEBREW_LIBRARY/"Taps/**"/ref_master).each do |repo| + repo_mtime = File.mtime(repo) + last_update = repo_mtime if repo_mtime > last_update + end + last_update <= cache_date + end + end + + # Create the cache if it doesn't already exist. + def self.ensure_cache + self.generate_cache unless self.cache_fresh? && self.cache + end + + # Take a {Report}, as generated by cmd/update.rb. + # Unless the cache file exists, do nothing. + # If it does exist, but the Report is empty, just touch the cache file. + # Otherwise, use the report to update the cache. + def self.update_cache(report) + if CACHE_FILE.exist? + if report.empty? + FileUtils.touch CACHE_FILE + else + renamings = report.select_formula(:R) + alterations = report.select_formula(:A) + report.select_formula(:M) + + renamings.map(&:last) + self.cache_formulae(alterations, :save => false) + self.uncache_formulae(report.select_formula(:D) + + renamings.map(&:first)) + end + end + end + + # Given an array of formula names, add them and their descriptions to the + # cache. Save the updated cache to disk, unless explicitly told not to. + def self.cache_formulae(formula_names, options = { :save => true }) + if self.cache + formula_names.each { |name| @cache[name] = Formula[name].desc } + self.save_cache if options[:save] + end + end + + # Given an array of formula names, remove them and their descriptions from + # the cache. Save the updated cache to disk, unless explicitly told not to. + def self.uncache_formulae(formula_names, options = { :save => true }) + if self.cache + formula_names.each { |name| @cache.delete(name) } + self.save_cache if options[:save] + end + end + + # Given an array of formula names, return a {Descriptions} object mapping + # those names to their descriptions. + def self.named(names) + self.ensure_cache + + results = {} + unless names.empty? + results = names.inject({}) do |accum, name| + accum[name] = @cache[name] + accum + end + end + + new(results) + end + + # Given a regex, find all formulae whose specified fields contain a match. + def self.search(regex, field = :either) + self.ensure_cache + + results = case field + when :name + @cache.select { |name, _| name =~ regex } + when :desc + @cache.select { |_, desc| desc =~ regex } + when :either + @cache.select { |name, desc| (name =~ regex) || (desc =~ regex) } + end + + results = Hash[results] if RUBY_VERSION <= "1.8.7" + + new(results) + end + + # Create an actual instance. + def initialize(descriptions) + @descriptions = descriptions + end + + # Take search results -- a hash mapping formula names to descriptions -- and + # print them. + def print + blank = "#{Tty.yellow}[no description]#{Tty.reset}" + @descriptions.keys.sort.each do |name| + description = @descriptions[name] || blank + puts "#{Tty.white}#{name}:#{Tty.reset} #{description}" + end + end +end
true
Other
Homebrew
brew
837437416840d4c4f132b7e4ba2ea0fa2f861668.json
Improve description searching and add a cache. Closes Homebrew/homebrew#42281. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Library/Homebrew/manpages/brew.1.md
@@ -126,6 +126,16 @@ Note that these flags should only appear after a command. type dependencies, pass `--skip-build`. Similarly, pass `--skip-optional` to skip `:optional` dependencies. + * `desc` <formula>: + Display <formula>'s name and one-line description. + + * `desc [-s|-n|-d] <pattern>`: + Search both name and description (`-s`), just the names (`-n`), or just the + descriptions (`-d`) for `<pattern>`. `<pattern>` is by default interpreted + as a literal string; if flanked by slashes, it is instead interpreted as a + regular expression. Formula descriptions are cached; the cache is created on + the first search, making that search slower than subsequent ones. + * `diy [--name=<name>] [--version=<version>]`: Automatically determine the installation prefix for non-Homebrew software.
true
Other
Homebrew
brew
837437416840d4c4f132b7e4ba2ea0fa2f861668.json
Improve description searching and add a cache. Closes Homebrew/homebrew#42281. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Library/Homebrew/utils.rb
@@ -255,8 +255,8 @@ def puts_columns(items, star_items = []) # determine the best width to display for different console sizes console_width = `/bin/stty size`.chomp.split(" ").last.to_i console_width = 80 if console_width <= 0 - longest = items.sort_by(&:length).last - optimal_col_width = (console_width.to_f / (longest.length + 2).to_f).floor + max_len = items.reduce(0) { |max, item| l = item.length ; l > max ? l : max } + optimal_col_width = (console_width.to_f / (max_len + 2).to_f).floor cols = optimal_col_width > 1 ? optimal_col_width : 1 IO.popen("/usr/bin/pr -#{cols} -t -w#{console_width}", "w") { |io| io.puts(items) }
true
Other
Homebrew
brew
837437416840d4c4f132b7e4ba2ea0fa2f861668.json
Improve description searching and add a cache. Closes Homebrew/homebrew#42281. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
share/man/man1/brew.1
@@ -128,6 +128,12 @@ If \fB\-\-installed\fR is passed, show dependencies for all installed formulae\. By default, \fBdeps\fR shows dependencies for \fIformulae\fR\. To skip the \fB:build\fR type dependencies, pass \fB\-\-skip\-build\fR\. Similarly, pass \fB\-\-skip\-optional\fR to skip \fB:optional\fR dependencies\. . .IP "\(bu" 4 +\fBdesc\fR \fIformula\fR: Display \fIformula\fR\'s name and one\-line description\. +. +.IP "\(bu" 4 +\fBdesc [\-s|\-n|\-d] <pattern>\fR: Search both name and description (\fB\-s\fR), just the names (\fB\-n\fR), or just the descriptions (\fB\-d\fR) for \fB<pattern>\fR\. \fB<pattern>\fR is by default interpreted as a literal string; if flanked by slashes, it is instead interpreted as a regular expression\. Formula descriptions are cached; the cache is created on the first search, making that search slower than subsequent ones\. +. +.IP "\(bu" 4 \fBdiy [\-\-name=<name>] [\-\-version=<version>]\fR: Automatically determine the installation prefix for non\-Homebrew software\. . .IP
true
Other
Homebrew
brew
a3505b29c66a43f54554d03e8d63adb0c002ba88.json
update rename documentation Update commit format for formula renames Closes Homebrew/homebrew#43644. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
share/doc/homebrew/Rename-A-Formula.md
@@ -5,7 +5,7 @@ you need: 1. Rename formula file and its class to new formula. New name must meet all the rules of naming. Fix any test failures that may occur due to the stricter requirements for new formula than existing formula (e.g. brew audit --strict must pass for that formula). -2. Create a pull request to the main repository deleting the formula file, adding new formula file and also add it to `Library/Homebrew/formula_renames.rb` with a commit message like `rename: ack -> newack` +2. Create a pull request to the main repository deleting the formula file, adding new formula file and also add it to `Library/Homebrew/formula_renames.rb` with a commit message like `newack: renamed from ack` To rename tap formula you need to follow the same steps, but add formula to `formula_renames.json` in the root of your tap. You don't need to change `Library/Homebrew/formula_renames.rb`, because that file is for core formulae only. Use canonical name (e.g. `ack` instead of `user/repo/ack`).
false
Other
Homebrew
brew
ff0f6598ce6057a36c222e2ec374d4ae37e2258a.json
Formulary: allow loading formula from contents
Library/Homebrew/formulary.rb
@@ -15,22 +15,26 @@ def self.formula_class_get(path) FORMULAE.fetch(path) end - def self.load_formula(name, path) + def self.load_formula(name, path, contents, namespace) mod = Module.new - const_set("FormulaNamespace#{Digest::MD5.hexdigest(path.to_s)}", mod) - contents = path.open("r") { |f| set_encoding(f).read } + const_set(namespace, mod) mod.module_eval(contents, path) class_name = class_s(name) begin - klass = mod.const_get(class_name) + mod.const_get(class_name) rescue NameError => e raise FormulaUnavailableError, name, e.backtrace - else - FORMULAE[path] = klass end end + def self.load_formula_from_path(name, path) + contents = path.open("r") { |f| set_encoding(f).read } + namespace = "FormulaNamespace#{Digest::MD5.hexdigest(path.to_s)}" + klass = load_formula(name, path, contents, namespace) + FORMULAE[path] = klass + end + if IO.method_defined?(:set_encoding) def self.set_encoding(io) io.set_encoding(Encoding::UTF_8) @@ -76,7 +80,7 @@ def klass def load_file STDERR.puts "#{$0} (#{self.class.name}): loading #{path}" if ARGV.debug? raise FormulaUnavailableError.new(name) unless path.file? - Formulary.load_formula(name, path) + Formulary.load_formula_from_path(name, path) end end
false
Other
Homebrew
brew
cbb91c5516ac6d2a673670edf5b7d509abe6df56.json
exceptions: handle HOMEBREW_NO_GITHUB_API case. Closes Homebrew/homebrew#43618.
Library/Homebrew/exceptions.rb
@@ -245,7 +245,7 @@ def dump end end puts - unless RUBY_VERSION < "1.8.7" || issues.empty? + if RUBY_VERSION >= "1.8.7" && issues && issues.any? puts "These open issues may also help:" puts issues.map { |i| "#{i["title"]} #{i["html_url"]}" }.join("\n") end
false
Other
Homebrew
brew
881d68d35556097ef62031b7e5728e445d74d558.json
tap-readme: create README in tap path.
Library/Homebrew/cmd/tap-readme.rb
@@ -25,7 +25,7 @@ def tap_readme EOS puts template if ARGV.verbose? - path = Pathname.new("./README.md") + path = HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-#{name}/README.md" raise "#{path} already exists" if path.exist? path.write template end
false
Other
Homebrew
brew
f279a1397733c81a580bd21ebef9815fb290a8a5.json
formula_installer: fix syntax warning Library/Homebrew/formula_installer.rb:636: warning: shadowing outer local variable - conflict_file Library/Homebrew/formula_installer.rb:636: warning: shadowing outer local variable - backup_file Closes Homebrew/homebrew#43602. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/formula_installer.rb
@@ -583,7 +583,7 @@ def link(keg) keg.remove_linked_keg_record end - link_overwrite_backup = {} # dict: conflict file -> backup file + link_overwrite_backup = {} # Hash: conflict file -> backup file backup_dir = HOMEBREW_CACHE/"Backup" begin @@ -623,9 +623,9 @@ def link(keg) @show_summary_heading = true ignore_interrupts do keg.unlink - link_overwrite_backup.each do |conflict_file, backup_file| - conflict_file.parent.mkpath - backup_file.rename conflict_file + link_overwrite_backup.each do |origin, backup| + origin.parent.mkpath + backup.rename origin end end Homebrew.failed = true
false
Other
Homebrew
brew
db2552828b9008d848e55b5e9e1442521d7ce593.json
test_integration_cmds: fix syntax warning Library/Homebrew/test/test_integration_cmds.rb:68: warning: ambiguous first argument; put parentheses or even spaces
Library/Homebrew/test/test_integration_cmds.rb
@@ -65,7 +65,7 @@ def test_cellar_formula end def test_env - assert_match /CMAKE_PREFIX_PATH="#{HOMEBREW_PREFIX}[:"]/, + assert_match %r{CMAKE_PREFIX_PATH="#{HOMEBREW_PREFIX}[:"]}, cmd("--env") end
false
Other
Homebrew
brew
b38498d9dc72f3be61465d72f180e2c024832748.json
outdated: fix syntax warning Library/Homebrew/cmd/outdated.rb:27: warning: shadowing outer local variable - dir
Library/Homebrew/cmd/outdated.rb
@@ -24,8 +24,8 @@ def outdated_brews(formulae) end end - f.rack.subdirs.each do |dir| - keg = Keg.new dir + f.rack.subdirs.each do |keg_dir| + keg = Keg.new keg_dir version = keg.version all_versions << version older_version = f.pkg_version <= version
false
Other
Homebrew
brew
5eab79e70f6887869d3b38adcd74296218de9269.json
manpage: add unlink --dry-run
Library/Homebrew/manpages/brew.1.md
@@ -429,11 +429,14 @@ Note that these flags should only appear after a command. Example: `brew install jruby && brew test jruby` - * `unlink` <formula>: + * `unlink [--dry-run]` <formula>: Remove symlinks for <formula> from the Homebrew prefix. This can be useful for temporarily disabling a formula: `brew unlink foo && commands && brew link foo`. + If `--dry-run` or `-n` is passed, Homebrew will list all files which would + be unlinked, but will not actually unlink or delete any files. + * `unlinkapps [--local]` [<formulae>]: Removes links created by `brew linkapps`.
true
Other
Homebrew
brew
5eab79e70f6887869d3b38adcd74296218de9269.json
manpage: add unlink --dry-run
share/doc/homebrew/brew.1.html
@@ -378,10 +378,13 @@ <h2 id="COMMANDS">COMMANDS</h2> launched with access to IRB or a shell inside the temporary test directory.</p> <p>Example: <code>brew install jruby &amp;&amp; brew test jruby</code></p></li> -<li><p><code>unlink</code> <var>formula</var>: +<li><p><code>unlink [--dry-run]</code> <var>formula</var>: Remove symlinks for <var>formula</var> from the Homebrew prefix. This can be useful for temporarily disabling a formula: -<code>brew unlink foo &amp;&amp; commands &amp;&amp; brew link foo</code>.</p></li> +<code>brew unlink foo &amp;&amp; commands &amp;&amp; brew link foo</code>.</p> + +<p>If <code>--dry-run</code> or <code>-n</code> is passed, Homebrew will list all files which would +be unlinked, but will not actually unlink or delete any files.</p></li> <li><p><code>unlinkapps [--local]</code> [<var>formulae</var>]: Removes links created by <code>brew linkapps</code>.</p>
true
Other
Homebrew
brew
5eab79e70f6887869d3b38adcd74296218de9269.json
manpage: add unlink --dry-run
share/man/man1/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 2015" "Homebrew" "brew" +.TH "BREW" "1" "September 2015" "Homebrew" "brew" . .SH "NAME" \fBbrew\fR \- The missing package manager for OS X @@ -409,7 +409,10 @@ If \fB\-\-debug\fR is passed and the test fails, an interactive debugger will be Example: \fBbrew install jruby && brew test jruby\fR . .IP "\(bu" 4 -\fBunlink\fR \fIformula\fR: Remove symlinks for \fIformula\fR from the Homebrew prefix\. This can be useful for temporarily disabling a formula: \fBbrew unlink foo && commands && brew link foo\fR\. +\fBunlink [\-\-dry\-run]\fR \fIformula\fR: Remove symlinks for \fIformula\fR from the Homebrew prefix\. This can be useful for temporarily disabling a formula: \fBbrew unlink foo && commands && brew link foo\fR\. +. +.IP +If \fB\-\-dry\-run\fR or \fB\-n\fR is passed, Homebrew will list all files which would be unlinked, but will not actually unlink or delete any files\. . .IP "\(bu" 4 \fBunlinkapps [\-\-local]\fR [\fIformulae\fR]: Removes links created by \fBbrew linkapps\fR\.
true
Other
Homebrew
brew
8830e401a9332abd6d75261a7116851a2a9c135b.json
formula_installer: check has_apple_developer_tools? once Closes Homebrew/homebrew#43534. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/formula_installer.rb
@@ -162,7 +162,7 @@ def install unless ignore_deps? deps = compute_dependencies - check_dependencies_bottled(deps) if pour_bottle? + check_dependencies_bottled(deps) if pour_bottle? && !MacOS.has_apple_developer_tools? install_dependencies(deps) end @@ -248,10 +248,7 @@ def compute_dependencies # abnormally with a BuildToolsError if one or more don't. # Only invoked when the user has no developer tools. def check_dependencies_bottled(deps) - unbottled = deps.select do |dep, _| - formula = dep.to_formula - !formula.pour_bottle? && !MacOS.has_apple_developer_tools? - end + unbottled = deps.reject { |dep, _| dep.to_formula.pour_bottle? } raise BuildToolsError.new(unbottled) unless unbottled.empty? end
false
Other
Homebrew
brew
b505c65b78fdb481c1c40f7a1655663aabf56548.json
xcode: update 10.11 clang expectation
Library/Homebrew/os/mac/xcode.rb
@@ -165,7 +165,7 @@ def installed? def latest_version case MacOS.version - when "10.11" then "700.0.65" + when "10.11" then "700.0.72" when "10.10" then "602.0.53" when "10.9" then "600.0.57" when "10.8" then "503.0.40"
false
Other
Homebrew
brew
a29832484c8ccceeb5437d4793d3a6c186cb304c.json
fix style problems in migrator Closes Homebrew/homebrew#43473. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/migrator.rb
@@ -44,37 +44,70 @@ def initialize(formula, tap) end end + # instance of new name formula attr_reader :formula - attr_reader :oldname, :oldpath, :old_pin_record, :old_opt_record - attr_reader :old_linked_keg_record, :oldkeg, :old_tabs, :old_tap - attr_reader :newname, :newpath, :new_pin_record + + # old name of the formula + attr_reader :oldname + + # path to oldname's cellar + attr_reader :old_cellar + + # path to oldname pin + attr_reader :old_pin_record + + # path to oldname opt + attr_reader :old_opt_record + + # oldname linked keg + attr_reader :old_linked_keg + + # path to oldname's linked keg + attr_reader :old_linked_keg_record + + # tabs from oldname kegs + attr_reader :old_tabs + + # tap of the old name + attr_reader :old_tap + + # resolved path to oldname pin attr_reader :old_pin_link_record - # Path to new linked keg - attr_reader :new_keg + # new name of the formula + attr_reader :newname + + # path to newname cellar according to new name + attr_reader :new_cellar + + # path to newname pin + attr_reader :new_pin_record + + # path to newname keg that will be linked if old_linked_keg isn't nil + attr_reader :new_linked_keg_record def initialize(formula) @oldname = formula.oldname @newname = formula.name raise MigratorNoOldnameError.new(formula) unless oldname @formula = formula - @oldpath = HOMEBREW_CELLAR/formula.oldname - raise MigratorNoOldpathError.new(formula) unless oldpath.exist? + @old_cellar = HOMEBREW_CELLAR/formula.oldname + raise MigratorNoOldpathError.new(formula) unless old_cellar.exist? - @old_tabs = oldpath.subdirs.map { |d| Tab.for_keg(Keg.new(d)) } + @old_tabs = old_cellar.subdirs.map { |d| Tab.for_keg(Keg.new(d)) } @old_tap = old_tabs.first.tap if !ARGV.force? && !from_same_taps? raise MigratorDifferentTapsError.new(formula, old_tap) end - @newpath = HOMEBREW_CELLAR/formula.name + @new_cellar = HOMEBREW_CELLAR/formula.name - if @oldkeg = get_linked_oldkeg - @old_linked_keg_record = oldkeg.linked_keg_record if oldkeg.linked? - @old_opt_record = oldkeg.opt_record if oldkeg.optlinked? - @new_keg = HOMEBREW_CELLAR/"#{newname}/#{File.basename(oldkeg)}" + if @old_linked_keg = get_linked_old_linked_keg + @old_linked_keg_record = old_linked_keg.linked_keg_record if old_linked_keg.linked? + @old_opt_record = old_linked_keg.opt_record if old_linked_keg.optlinked? + @new_linked_keg_record = HOMEBREW_CELLAR/"#{newname}/#{File.basename(old_linked_keg)}" end @old_pin_record = HOMEBREW_LIBRARY/"PinnedKegs"/oldname @@ -109,22 +142,18 @@ def from_same_taps? end end - def get_linked_oldkeg - kegs = oldpath.subdirs.map { |d| Keg.new(d) } + def get_linked_old_linked_keg + kegs = old_cellar.subdirs.map { |d| Keg.new(d) } kegs.detect(&:linked?) || kegs.detect(&:optlinked?) end def pinned? @pinned end - def oldkeg_linked? - !!oldkeg - end - def migrate - if newpath.exist? - onoe "#{newpath} already exists; remove it manually and run brew migrate #{oldname}." + if new_cellar.exist? + onoe "#{new_cellar} already exists; remove it manually and run brew migrate #{oldname}." return end @@ -134,7 +163,7 @@ def migrate unlink_oldname move_to_new_directory repin - link_newname if oldkeg_linked? + link_newname unless old_linked_keg.nil? link_oldname_opt link_oldname_cellar update_tabs @@ -153,8 +182,8 @@ def migrate # move everything from Cellar/oldname to Cellar/newname def move_to_new_directory - puts "Moving to: #{newpath}" - FileUtils.mv(oldpath, newpath) + puts "Moving to: #{new_cellar}" + FileUtils.mv(old_cellar, new_cellar) end def repin @@ -178,40 +207,40 @@ def repin def unlink_oldname oh1 "Unlinking #{Tty.green}#{oldname}#{Tty.reset}" - oldpath.subdirs.each do |d| + old_cellar.subdirs.each do |d| keg = Keg.new(d) keg.unlink end end def link_newname oh1 "Linking #{Tty.green}#{newname}#{Tty.reset}" - keg = Keg.new(new_keg) + new_keg = Keg.new(new_linked_keg_record) # If old_keg wasn't linked then we just optlink a keg. # If old keg wasn't optlinked and linked, we don't call this method at all. # If formula is keg-only we also optlink it. if formula.keg_only? || !old_linked_keg_record begin - keg.optlink + new_keg.optlink rescue Keg::LinkError => e onoe "Failed to create #{formula.opt_prefix}" raise end return end - keg.remove_linked_keg_record if keg.linked? + new_keg.remove_linked_keg_record if new_keg.linked? begin - keg.link + new_keg.link rescue Keg::ConflictError => e onoe "Error while executing `brew link` step on #{newname}" puts e puts puts "Possible conflicting files are:" mode = OpenStruct.new(:dry_run => true, :overwrite => true) - keg.link(mode) + new_keg.link(mode) raise rescue Keg::LinkError => e onoe "Error while linking" @@ -223,7 +252,7 @@ def link_newname onoe "An unexpected error occurred during linking" puts e puts e.backtrace if ARGV.debug? - ignore_interrupts { keg.unlink } + ignore_interrupts { new_keg.unlink } raise end end @@ -232,14 +261,14 @@ def link_newname def link_oldname_opt if old_opt_record old_opt_record.delete if old_opt_record.symlink? - old_opt_record.make_relative_symlink(new_keg) + old_opt_record.make_relative_symlink(new_linked_keg_record) end end # After migtaion every INSTALL_RECEIPT.json has wrong path to the formula # so we must update INSTALL_RECEIPTs def update_tabs - new_tabs = newpath.subdirs.map { |d| Tab.for_keg(Keg.new(d)) } + new_tabs = new_cellar.subdirs.map { |d| Tab.for_keg(Keg.new(d)) } new_tabs.each do |tab| tab.source["path"] = formula.path.to_s if tab.source["path"] tab.write @@ -250,24 +279,24 @@ def update_tabs def unlink_oldname_opt return unless old_opt_record if old_opt_record.symlink? && old_opt_record.exist? \ - && new_keg.exist? \ - && new_keg.realpath == old_opt_record.realpath + && new_linked_keg_record.exist? \ + && new_linked_keg_record.realpath == old_opt_record.realpath old_opt_record.unlink old_opt_record.parent.rmdir_if_possible end end - # Remove oldpath if it exists + # Remove old_cellar if it exists def link_oldname_cellar - oldpath.delete if oldpath.symlink? || oldpath.exist? - oldpath.make_relative_symlink(formula.rack) + old_cellar.delete if old_cellar.symlink? || old_cellar.exist? + old_cellar.make_relative_symlink(formula.rack) end # Remove Cellar/oldname link if it belongs to newname. def unlink_oldname_cellar - if (oldpath.symlink? && !oldpath.exist?) || (oldpath.symlink? \ - && formula.rack.exist? && formula.rack.realpath == oldpath.realpath) - oldpath.unlink + if (old_cellar.symlink? && !old_cellar.exist?) || (old_cellar.symlink? \ + && formula.rack.exist? && formula.rack.realpath == old_cellar.realpath) + old_cellar.unlink end end @@ -284,37 +313,37 @@ def backup_oldname new_pin_record.delete end - if newpath.exist? - newpath.subdirs.each do |d| + if new_cellar.exist? + new_cellar.subdirs.each do |d| newname_keg = Keg.new(d) newname_keg.unlink newname_keg.uninstall end end - if oldkeg_linked? + unless old_linked_keg.nil? # The keg used to be linked and when we backup everything we restore # Cellar/oldname, the target also gets restored, so we are able to # create a keg using its old path if old_linked_keg_record begin - oldkeg.link + old_linked_keg.link rescue Keg::LinkError - oldkeg.unlink + old_linked_keg.unlink raise rescue Keg::AlreadyLinkedError - oldkeg.unlink + old_linked_keg.unlink retry end else - oldkeg.optlink + old_linked_keg.optlink end end end def backup_oldname_cellar - unless oldpath.exist? - FileUtils.mv(newpath, oldpath) + unless old_cellar.exist? + FileUtils.mv(new_cellar, old_cellar) end end
true
Other
Homebrew
brew
a29832484c8ccceeb5437d4793d3a6c186cb304c.json
fix style problems in migrator Closes Homebrew/homebrew#43473. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/test/test_migrator.rb
@@ -117,10 +117,6 @@ def test_backup_cellar assert_predicate @old_keg_record/"bin", :directory? end - def test_oldkeg_linked - assert_predicate @migrator, :oldkeg_linked? - end - def test_repin @new_keg_record.join("bin").mkpath expected_relative = @new_keg_record.relative_path_from HOMEBREW_LIBRARY/"PinnedKegs"
true
Other
Homebrew
brew
9bd3e1eeab2b0942746b56e810764c0821666579.json
tips-n-tricks: add homebrew-mode to editor plugins
share/doc/homebrew/Tips-N'-Tricks.md
@@ -120,10 +120,21 @@ export HOMEBREW_NO_EMOJI=1 This sets the HOMEBREW_NO_EMOJI environment variable, causing homebrew to hide all emoji. -## Sublime text: Syntax for formulae including the diff +## Editor plugins -In Sublime Text 2/3, you can use Package Control to install [Homebrew-formula-syntax](https://github.com/samueljohn/Homebrew-formula-syntax). +### Sublime Text -## Vim Syntax for formulae including the diff +In Sublime Text 2/3, you can use Package Control to install +[Homebrew-formula-syntax](https://github.com/samueljohn/Homebrew-formula-syntax), +which adds highlighting for inline patches. -If you are vim user, you can install [brew.vim](https://github.com/xu-cheng/brew.vim) plugin. +### Vim + +[brew.vim](https://github.com/xu-cheng/brew.vim) adds highlighting to +inline patches in Vim. + +### Emacs + +[homebrew-mode](https://github.com/dunn/homebrew-mode) provides syntax +highlighting for inline patches as well as a number of helper functions +for editing formula files.
false
Other
Homebrew
brew
190902e98fcde1c9601bf9a674caf0796ed9e46b.json
tap: ensure git is installed Closes Homebrew/homebrew#43463. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/cmd/tap.rb
@@ -19,6 +19,9 @@ def tap end def install_tap(user, repo, clone_target = nil) + # ensure git is installed + Utils.ensure_git_installed! + tap = Tap.new user, repo return false if tap.installed? ohai "Tapping #{tap}"
false
Other
Homebrew
brew
03f7e19ca68ffbb1976633bd4138753fd3f76898.json
update: ensure git is installed
Library/Homebrew/cmd/update.rb
@@ -12,6 +12,9 @@ def update EOS end + # ensure git is installed + Utils.ensure_git_installed! + # ensure GIT_CONFIG is unset as we need to operate on .git/config ENV.delete("GIT_CONFIG")
false
Other
Homebrew
brew
8d5c445daa7520c75f7b3c2a132eda2ec86e0727.json
homebrew_version_string: check git available
Library/Homebrew/utils.rb
@@ -162,8 +162,7 @@ def self.git_last_commit_date end def self.homebrew_version_string - pretty_revision = git_short_head - if pretty_revision + if Utils.git_available? && (pretty_revision = git_short_head) last_commit = git_last_commit_date "#{HOMEBREW_VERSION} (git revision #{pretty_revision}; last commit #{last_commit})" else
false
Other
Homebrew
brew
71f794260b8ea0312b5a733095e2856c9a4719bb.json
add git utils Two methods: * `Utils.git_available?` checks whether git is installed. * `Utils.ensure_git_installed!` installs git for users who don't install Xcode or CLT.
Library/Homebrew/utils.rb
@@ -5,6 +5,7 @@ require "utils/inreplace" require "utils/popen" require "utils/fork" +require "utils/git" require "open-uri" class Tty
true
Other
Homebrew
brew
71f794260b8ea0312b5a733095e2856c9a4719bb.json
add git utils Two methods: * `Utils.git_available?` checks whether git is installed. * `Utils.ensure_git_installed!` installs git for users who don't install Xcode or CLT.
Library/Homebrew/utils/git.rb
@@ -0,0 +1,23 @@ +module Utils + def self.git_available? + git = which("git") + # git isn't installed by older Xcodes + return false if git.nil? + # /usr/bin/git is a popup stub when Xcode/CLT aren't installed, so bail out + return false if git == "/usr/bin/git" && !OS::Mac.has_apple_developer_tools? + true + end + + def self.ensure_git_installed! + return if git_available? + + require "cmd/install" + begin + oh1 "Installing git" + Homebrew.perform_preinstall_checks + Homebrew.install_formula(Formulary.factory("git")) + rescue + raise "Git is unavailable" + end + end +end
true
Other
Homebrew
brew
370df177c46e9f13415b2da99b868fe56546764c.json
python_requirement: fix ENV for python3 Closes Homebrew/homebrew#43453.
Library/Homebrew/requirements/python_requirement.rb
@@ -24,9 +24,7 @@ class PythonRequirement < Requirement ENV.prepend_path "PATH", Formula["python"].opt_bin end - if python_binary == "python" - ENV["PYTHONPATH"] = "#{HOMEBREW_PREFIX}/lib/python#{short_version}/site-packages" - end + ENV["PYTHONPATH"] = "#{HOMEBREW_PREFIX}/lib/python#{short_version}/site-packages" end def python_short_version @@ -62,6 +60,10 @@ class Python3Requirement < PythonRequirement satisfy(:build_env => false) { which_python } + env do + ENV["PYTHONPATH"] = "#{HOMEBREW_PREFIX}/lib/python#{python_short_version}/site-packages" + end + def python_binary "python3" end
false
Other
Homebrew
brew
79ea14b73867f52a6016c97ca8e38f5c7f7672e9.json
cmd/search: fix filtering of aliases in results By directly modifying the results array with `results[i] = "#{name} (installed)"`, it appeared on successive iterations that the canonical name was no longer in the array, so aliases were not removed. See https://github.com/Homebrew/homebrew/commit/9efe5b554ce9cf6626d9794173725f5e063e5806#commitcomment-12969631 Closes Homebrew/homebrew#43433.
Library/Homebrew/cmd/search.rb
@@ -143,15 +143,16 @@ def search_formulae(rx) aliases = Formula.aliases results = (Formula.full_names+aliases).grep(rx).sort - results.each_with_index do |name, i| + results.map do |name| canonical_name = Formulary.canonical_name(name) - # Remove aliases from results when the full name was also found + # Ignore aliases from results when the full name was also found if aliases.include?(name) && results.include?(canonical_name) - results.delete_at(i) - # Notify the user if the formula is installed + next elsif (HOMEBREW_CELLAR/canonical_name).directory? - results[i] = "#{name} (installed)" + "#{name} (installed)" + else + name end - end + end.compact end end
false
Other
Homebrew
brew
0f6d3b2923a41bd48f58cf202db96d19c8b98868.json
tap_migrations: fix the sorting
Library/Homebrew/tap_migrations.rb
@@ -67,8 +67,8 @@ "freerdp" => "homebrew/x11", "fsv" => "homebrew/boneyard", "fuse-zip" => "homebrew/fuse", - "fuse4x-kext" => "homebrew/fuse", "fuse4x" => "homebrew/fuse", + "fuse4x-kext" => "homebrew/fuse", "gant" => "homebrew/boneyard", "gcsfuse" => "homebrew/fuse", "geany" => "homebrew/x11", @@ -79,8 +79,8 @@ "ggobi" => "homebrew/x11", "giblib" => "homebrew/x11", "git-flow-clone" => "homebrew/boneyard", - "gitfs" => "homebrew/fuse", "git-latexdiff" => "homebrew/tex", + "gitfs" => "homebrew/fuse", "gkrellm" => "homebrew/boneyard", "glade" => "homebrew/x11", "gle" => "homebrew/x11", @@ -92,14 +92,14 @@ "grace" => "homebrew/x11", "grads" => "homebrew/binary", "graylog2-server" => "homebrew/boneyard", - "guilt" => "homebrew/boneyard", "gromacs" => "homebrew/science", "gsmartcontrol" => "homebrew/x11", "gtk-chtheme" => "homebrew/x11", "gtkglarea" => "homebrew/boneyard", "gtksourceviewmm" => "homebrew/x11", "gtksourceviewmm3" => "homebrew/x11", "gtkwave" => "homebrew/x11", + "guilt" => "homebrew/boneyard", "gv" => "homebrew/x11", "hatari" => "homebrew/x11", "helios" => "spotify/public", @@ -126,8 +126,8 @@ "latex-mk" => "homebrew/tex", "libdlna" => "homebrew/boneyard", "libgtextutils" => "homebrew/science", - "librets" => "homebrew/boneyard", "libqxt" => "homebrew/boneyard", + "librets" => "homebrew/boneyard", "libspotify" => "homebrew/binary", "lilypond" => "homebrew/tex", "lmutil" => "homebrew/binary", @@ -157,12 +157,12 @@ "ori" => "homebrew/fuse", "owamp" => "homebrew/boneyard", "pan" => "homebrew/boneyard", - "pari" => "homebrew/x11", "par2tbb" => "homebrew/boneyard", + "pari" => "homebrew/x11", "pathfinder" => "homebrew/boneyard", "pcb" => "homebrew/x11", - "pdfjam" => "homebrew/tex", "pdf2image" => "homebrew/x11", + "pdfjam" => "homebrew/tex", "pdftoipe" => "homebrew/head-only", "pebble-sdk" => "pebble/pebble-sdk", "pgplot" => "homebrew/x11", @@ -179,8 +179,8 @@ "qiv" => "homebrew/boneyard", "qrupdate" => "homebrew/science", "rdesktop" => "homebrew/x11", - "rofs-filtered" => "homebrew/fuse", "rocket" => "homebrew/boneyard", + "rofs-filtered" => "homebrew/fuse", "rxvt-unicode" => "homebrew/x11", "s3-backer" => "homebrew/fuse", "s3fs" => "homebrew/fuse", @@ -208,8 +208,8 @@ "tetgen" => "homebrew/science", "texmacs" => "homebrew/boneyard", "texwrapper" => "homebrew/tex", - "tiger-vnc" => "homebrew/x11", "ticcutils" => "homebrew/science", + "tiger-vnc" => "homebrew/x11", "timbl" => "homebrew/science", "tmap" => "homebrew/boneyard", "transmission-remote-gtk" => "homebrew/x11", @@ -231,8 +231,8 @@ "xclip" => "homebrew/x11", "xdotool" => "homebrew/x11", "xdu" => "homebrew/x11", - "xournal" => "homebrew/x11", "xmount" => "homebrew/fuse", + "xournal" => "homebrew/x11", "xpa" => "homebrew/x11", "xpdf" => "homebrew/x11", "xplot" => "homebrew/x11",
false
Other
Homebrew
brew
9520449823e4ffe7028d2e2b36ff1d3a9add9a60.json
sandbox: allow writing to /dev/zero Closes Homebrew/homebrew#43344.
Library/Homebrew/sandbox.rb
@@ -136,6 +136,7 @@ class SandboxProfile (literal "/dev/ptmx") (literal "/dev/dtracehelper") (literal "/dev/null") + (literal "/dev/zero") (regex #"^/dev/fd/[0-9]+$") (regex #"^/dev/ttys?[0-9]*$") )
false
Other
Homebrew
brew
fc445d97d36d7d38d83853c0f9d4abaa27b343fa.json
outdated: update error for different taps Closes Homebrew/homebrew#43269. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Library/Homebrew/cmd/outdated.rb
@@ -18,8 +18,10 @@ def outdated_brews(formulae) all_versions = [] older_or_same_tap_versions = [] - if f.oldname && !f.rack.exist? && (HOMEBREW_CELLAR/f.oldname).exist? - raise Migrator::MigrationNeededError.new(f) + if f.oldname && !f.rack.exist? && (dir = HOMEBREW_CELLAR/f.oldname).exist? + if f.tap == Tab.for_keg(dir.subdirs.first).tap + raise Migrator::MigrationNeededError.new(f) + end end f.rack.subdirs.each do |dir|
false
Other
Homebrew
brew
c992749986a949e84b62dcc4070751652d355b31.json
doctor: add system curl <10.7 check Closes Homebrew/homebrew#43283. Closes Homebrew/homebrew#43298. Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
Library/Homebrew/cmd/doctor.rb
@@ -653,13 +653,23 @@ def check_user_path_3 end end + def check_for_bad_curl + if MacOS.version <= "10.6" && !Formula["curl"].installed? then <<-EOS.undent + The system curl on 10.6 and below is often incapable of supporting + modern secure connections & will fail on fetching formulae. + We recommend you: + brew install curl + EOS + end + end + def check_user_curlrc if %w[CURL_HOME HOME].any? { |key| ENV[key] && File.exist?("#{ENV[key]}/.curlrc") } then <<-EOS.undent You have a curlrc file If you have trouble downloading packages with Homebrew, then maybe this is the problem? If the following command doesn't work, then try removing your curlrc: - curl http://github.com + curl https://github.com EOS end end
false
Other
Homebrew
brew
94bb92b4c1c27ad32be784975b03a337cd61695d.json
doctor: add check for SSL_CERT_DIR Closes Homebrew/homebrew#43154. Closes Homebrew/homebrew#43277. Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
Library/Homebrew/cmd/doctor.rb
@@ -664,6 +664,17 @@ def check_user_curlrc end end + def check_for_unsupported_curl_vars + # Support for SSL_CERT_DIR seemed to be removed in the 10.10.5 update. + if MacOS.version >= :yosemite && !ENV["SSL_CERT_DIR"].nil? then <<-EOS.undent + SSL_CERT_DIR support was removed from Apple's curl. + If fetching formulae fails you should: + unset SSL_CERT_DIR + and remove it from #{shell_profile} if present. + EOS + end + end + def check_which_pkg_config binary = which "pkg-config" return if binary.nil?
false
Other
Homebrew
brew
09c810c7f428b838b9b327d1c92f87ebc6e76447.json
add link_overwrite DSL Sometimes we accidentally install files outside prefix. After we fix that, users will get nasty link conflict error. So we create a whitelist here to allow overwriting certain files. e.g. link_overwrite "bin/foo", "lib/bar" link_overwrite "share/man/man1/baz-*" During FormulaInstaller#link, the whitelist conflict files will be backup into HOMEBREW_CACHE/Backup
Library/Homebrew/formula.rb
@@ -11,6 +11,7 @@ require "pkg_version" require "tap" require "formula_renames" +require "keg" # A formula provides instructions and metadata for Homebrew to install a piece # of software. Every Homebrew formula is a {Formula}. @@ -330,7 +331,6 @@ def installed_prefix # The currently installed version for this formula. Will raise an exception # if the formula is not installed. def installed_version - require "keg" Keg.new(installed_prefix).version end @@ -657,6 +657,30 @@ def skip_clean?(path) self.class.skip_clean_paths.include? to_check end + # Sometimes we accidentally install files outside prefix. After we fix that, + # users will get nasty link conflict error. So we create a whitelist here to + # allow overwriting certain files. e.g. + # link_overwrite "bin/foo", "lib/bar" + # link_overwrite "share/man/man1/baz-*" + def link_overwrite?(path) + # Don't overwrite files not created by Homebrew. + return false unless path.stat.uid == File.stat(HOMEBREW_BREW_FILE).uid + # Don't overwrite files belong to other keg. + begin + Keg.for(path) + rescue NotAKegError, Errno::ENOENT + # file doesn't belong to any keg. + else + return false + end + to_check = path.relative_path_from(HOMEBREW_PREFIX).to_s + self.class.link_overwrite_paths.any? do |p| + p == to_check || + to_check.start_with?(p.chomp("/") + "/") || + /^#{Regexp.escape(p).gsub('\*', ".*?")}$/ === to_check + end + end + def skip_cxxstdlib_check? false end @@ -1351,5 +1375,14 @@ def needs(*standards) def test(&block) define_method(:test, &block) end + + def link_overwrite(*paths) + paths.flatten! + link_overwrite_paths.merge(paths) + end + + def link_overwrite_paths + @link_overwrite_paths ||= Set.new + end end end
true
Other
Homebrew
brew
09c810c7f428b838b9b327d1c92f87ebc6e76447.json
add link_overwrite DSL Sometimes we accidentally install files outside prefix. After we fix that, users will get nasty link conflict error. So we create a whitelist here to allow overwriting certain files. e.g. link_overwrite "bin/foo", "lib/bar" link_overwrite "share/man/man1/baz-*" During FormulaInstaller#link, the whitelist conflict files will be backup into HOMEBREW_CACHE/Backup
Library/Homebrew/formula_installer.rb
@@ -589,9 +589,20 @@ def link(keg) keg.remove_linked_keg_record end + link_overwrite_backup = {} # dict: conflict file -> backup file + backup_dir = HOMEBREW_CACHE/"Backup" + begin keg.link rescue Keg::ConflictError => e + conflict_file = e.dst + if formula.link_overwrite?(conflict_file) && !link_overwrite_backup.key?(conflict_file) + backup_file = backup_dir/conflict_file.relative_path_from(HOMEBREW_PREFIX).to_s + backup_file.parent.mkpath + conflict_file.rename backup_file + link_overwrite_backup[conflict_file] = backup_file + retry + end onoe "The `brew link` step did not complete successfully" puts "The formula built, but is not symlinked into #{HOMEBREW_PREFIX}" puts e @@ -616,10 +627,24 @@ def link(keg) puts e puts e.backtrace if debug? @show_summary_heading = true - ignore_interrupts { keg.unlink } + ignore_interrupts do + keg.unlink + link_overwrite_backup.each do |conflict_file, backup_file| + conflict_file.parent.mkpath + backup_file.rename conflict_file + end + end Homebrew.failed = true raise end + + unless link_overwrite_backup.empty? + opoo "These files were overwritten during `brew link` step:" + puts link_overwrite_backup.keys + puts + puts "They are backup in #{backup_dir}" + @show_summary_heading = true + end end def install_plist
true
Other
Homebrew
brew
3d1f9e0a9c6185b470630c29e44714ac2d050371.json
exceptions: change 10.9 Xcode URL
Library/Homebrew/exceptions.rb
@@ -279,7 +279,7 @@ def initialize(formulae) elsif MacOS.version == "10.9" xcode_text = <<-EOS.undent To continue, you must install Xcode from: - https://developer.apple.com/xcode/downloads/ + https://developer.apple.com/downloads/ or the CLT by running: xcode-select --install EOS @@ -325,7 +325,7 @@ def initialize(flags) elsif MacOS.version == "10.9" xcode_text = <<-EOS.undent or install Xcode from: - https://developer.apple.com/xcode/downloads/ + https://developer.apple.com/downloads/ or the CLT by running: xcode-select --install EOS
false
Other
Homebrew
brew
ff8520e61be2b1ad36b676abfb426d5b95a71043.json
exceptions: use xcode frontpage
Library/Homebrew/exceptions.rb
@@ -279,7 +279,7 @@ def initialize(formulae) elsif MacOS.version == "10.9" xcode_text = <<-EOS.undent To continue, you must install Xcode from: - https://developer.apple.com/downloads/ + https://developer.apple.com/xcode/downloads/ or the CLT by running: xcode-select --install EOS @@ -291,7 +291,7 @@ def initialize(formulae) else xcode_text = <<-EOS.undent To continue, you must install Xcode from: - https://developer.apple.com/downloads/ + https://developer.apple.com/xcode/downloads/ EOS end @@ -325,7 +325,7 @@ def initialize(flags) elsif MacOS.version == "10.9" xcode_text = <<-EOS.undent or install Xcode from: - https://developer.apple.com/downloads/ + https://developer.apple.com/xcode/downloads/ or the CLT by running: xcode-select --install EOS @@ -337,7 +337,7 @@ def initialize(flags) else xcode_text = <<-EOS.undent or install Xcode from: - https://developer.apple.com/downloads/ + https://developer.apple.com/xcode/downloads/ EOS end
false
Other
Homebrew
brew
56795ec1ed4f32d770afb50f65fc7e4e007e42f9.json
Call check_xcode check for CLT, too
Library/Homebrew/cmd/install.rb
@@ -159,7 +159,7 @@ def check_cellar def perform_preinstall_checks check_ppc check_writable_install_location - check_xcode if MacOS::Xcode.installed? + check_xcode if MacOS.has_apple_developer_tools? check_cellar end
false
Other
Homebrew
brew
91e598cf3f88591f2146218eaa2ecc2a3a261e31.json
Install: add BuildToolsError and BuildFlagsError Add these new errors, and guards in formula installation and cmd/{,un,re}install to match, move can_build? to the MacOS module, flatten conditions, remove redundant can_build? check reinstate removed (doctor) check
Library/Homebrew/cmd/install.rb
@@ -38,6 +38,14 @@ def install end end + # if the user's flags will prevent bottle only-installations when no + # developer tools are available, we need to stop them early on + if !MacOS.can_build? + bf = ARGV.collect_build_flags + + raise BuildFlagsError.new(bf) if !bf.empty? + end + ARGV.formulae.each do |f| # head-only without --HEAD is an error if !ARGV.build_head? && f.stable.nil? && f.devel.nil? @@ -129,6 +137,9 @@ def check_xcode # when one is no longer required checks = Checks.new %w[ + check_for_unsupported_osx + check_for_bad_install_name_tool + check_for_installed_developer_tools check_xcode_license_approved check_for_osx_gcc_installer ].each do |check| @@ -157,12 +168,7 @@ def check_cellar def perform_preinstall_checks check_ppc check_writable_install_location - if MacOS::Xcode.installed? - check_xcode - else - opoo "You have not installed Xcode." - puts "Bottles may install correctly, but builds will fail!" - end + check_xcode if MacOS::Xcode.installed? check_cellar end
true
Other
Homebrew
brew
91e598cf3f88591f2146218eaa2ecc2a3a261e31.json
Install: add BuildToolsError and BuildFlagsError Add these new errors, and guards in formula installation and cmd/{,un,re}install to match, move can_build? to the MacOS module, flatten conditions, remove redundant can_build? check reinstate removed (doctor) check
Library/Homebrew/cmd/reinstall.rb
@@ -2,6 +2,14 @@ module Homebrew def reinstall + if !MacOS.can_build? + bf = ARGV.collect_build_flags + + if !bf.empty? + raise BuildFlagsError.new(bf) + end + end + ARGV.resolved_formulae.each { |f| reinstall_formula(f) } end
true
Other
Homebrew
brew
91e598cf3f88591f2146218eaa2ecc2a3a261e31.json
Install: add BuildToolsError and BuildFlagsError Add these new errors, and guards in formula installation and cmd/{,un,re}install to match, move can_build? to the MacOS module, flatten conditions, remove redundant can_build? check reinstate removed (doctor) check
Library/Homebrew/cmd/upgrade.rb
@@ -3,6 +3,14 @@ module Homebrew def upgrade + if !MacOS.can_build? + bf = ARGV.collect_build_flags + + if !bf.empty? + raise BuildFlagsError.new(bf) + end + end + Homebrew.perform_preinstall_checks if ARGV.named.empty?
true
Other
Homebrew
brew
91e598cf3f88591f2146218eaa2ecc2a3a261e31.json
Install: add BuildToolsError and BuildFlagsError Add these new errors, and guards in formula installation and cmd/{,un,re}install to match, move can_build? to the MacOS module, flatten conditions, remove redundant can_build? check reinstate removed (doctor) check
Library/Homebrew/exceptions.rb
@@ -226,6 +226,100 @@ def dump end end +# raised by FormulaInstaller.check_dependencies_bottled and +# FormulaInstaller.install if the formula or its dependencies are not bottled +# and are being installed on a system without necessary build tools +class BuildToolsError < RuntimeError + def initialize(formulae) + if formulae.length > 1 + formula_text = "formulae" + package_text = "binary packages" + else + formula_text = "formula" + package_text = "a binary package" + end + + if MacOS.version >= "10.10" + xcode_text = <<-EOS.undent + To continue, you must install Xcode from the App Store, + or the CLT by running: + xcode-select --install + EOS + elsif MacOS.version == "10.9" + xcode_text = <<-EOS.undent + To continue, you must install Xcode from: + https://developer.apple.com/downloads/ + or the CLT by running: + xcode-select --install + EOS + elsif MacOS.version >= "10.7" + xcode_text = <<-EOS.undent + To continue, you must install Xcode or the CLT from: + https://developer.apple.com/downloads/ + EOS + else + xcode_text = <<-EOS.undent + To continue, you must install Xcode from: + https://developer.apple.com/downloads/ + EOS + end + + super <<-EOS.undent + The following #{formula_text}: + #{formulae.join(', ')} + cannot be installed as a #{package_text} and must be built from source. + #{xcode_text} + EOS + end +end + +# raised by Homebrew.install, Homebrew.reinstall, and Homebrew.upgrade +# if the user passes any flags/environment that would case a bottle-only +# installation on a system without build tools to fail +class BuildFlagsError < RuntimeError + def initialize(flags) + if flags.length > 1 + flag_text = "flags" + require_text = "require" + else + flag_text = "flag" + require_text = "requires" + end + + if MacOS.version >= "10.10" + xcode_text = <<-EOS.undent + or install Xcode from the App Store, or the CLT by running: + xcode-select --install + EOS + elsif MacOS.version == "10.9" + xcode_text = <<-EOS.undent + or install Xcode from: + https://developer.apple.com/downloads/ + or the CLT by running: + xcode-select --install + EOS + elsif MacOS.version >= "10.7" + xcode_text = <<-EOS.undent + or install Xcode or the CLT from: + https://developer.apple.com/downloads/ + EOS + else + xcode_text = <<-EOS.undent + or install Xcode from: + https://developer.apple.com/downloads/ + EOS + end + + super <<-EOS.undent + The following #{flag_text}: + #{flags.join(', ')} + #{require_text} building tools, but none are installed. + Either remove the #{flag_text} to attempt bottle installation, + #{xcode_text} + EOS + end +end + # raised by CompilerSelector if the formula fails with all of # the compilers available on the user's system class CompilerSelectionError < RuntimeError
true
Other
Homebrew
brew
91e598cf3f88591f2146218eaa2ecc2a3a261e31.json
Install: add BuildToolsError and BuildFlagsError Add these new errors, and guards in formula installation and cmd/{,un,re}install to match, move can_build? to the MacOS module, flatten conditions, remove redundant can_build? check reinstate removed (doctor) check
Library/Homebrew/extend/ARGV.rb
@@ -200,6 +200,19 @@ def env value "env" end + # collect any supplied build flags into an array for reporting + def collect_build_flags + build_flags = [] + + build_flags << '--HEAD' if build_head? + build_flags << '--universal' if build_universal? + build_flags << '--32-bit' if build_32_bit? + build_flags << '--build-bottle' if build_bottle? + build_flags << '--build-from-source' if build_from_source? + + build_flags + end + private def spec(default = :stable)
true
Other
Homebrew
brew
91e598cf3f88591f2146218eaa2ecc2a3a261e31.json
Install: add BuildToolsError and BuildFlagsError Add these new errors, and guards in formula installation and cmd/{,un,re}install to match, move can_build? to the MacOS module, flatten conditions, remove redundant can_build? check reinstate removed (doctor) check
Library/Homebrew/formula_installer.rb
@@ -147,6 +147,10 @@ def install check_conflicts + if !pour_bottle? && !MacOS.can_build? + raise BuildToolsError.new([formula]) + end + if !ignore_deps? deps = compute_dependencies check_dependencies_bottled(deps) if pour_bottle?
true
Other
Homebrew
brew
91e598cf3f88591f2146218eaa2ecc2a3a261e31.json
Install: add BuildToolsError and BuildFlagsError Add these new errors, and guards in formula installation and cmd/{,un,re}install to match, move can_build? to the MacOS module, flatten conditions, remove redundant can_build? check reinstate removed (doctor) check
Library/Homebrew/os/mac.rb
@@ -52,6 +52,10 @@ def otool end end + def can_build? + Xcode.installed? || CLT.installed? + end + def active_developer_dir @active_developer_dir ||= Utils.popen_read("/usr/bin/xcode-select", "-print-path").strip end
true
Other
Homebrew
brew
dcc394c3f748946eefd9b80da003cd5f1abb5fb7.json
add cctools requirement
Library/Homebrew/requirements/cctools_requirement.rb
@@ -0,0 +1,8 @@ +class CctoolsRequirement < Requirement + fatal true + default_formula 'cctools' + + satisfy do + MacOS::XCode.installed? || MacOS::CLT.installed? + end +end
false
Other
Homebrew
brew
dcfac4f5714c8d37e38b62b2c735b29d3805c28e.json
add install_relocation_tools stub
Library/Homebrew/formula_installer.rb
@@ -166,6 +166,7 @@ def install if pour_bottle?(:warn => true) begin + install_relocation_tools if formula.bottle.needs_relocation? pour rescue => e raise if ARGV.homebrew_developer? @@ -326,6 +327,11 @@ def install_dependencies(deps) @show_header = true unless deps.empty? end + def install_relocation_tools + ohai "placeholder" + true + end + class DependencyInstaller < FormulaInstaller def initialize(*) super
false
Other
Homebrew
brew
ab10ab42fa2f85f5b7abce733a02ea7a47e98683.json
BottleSpecification: add does_not_need_relocation field Toggled with does_not_need_relocation method in bottle block. Also declare needs_relocation? accessors in software/bottle specs.
Library/Homebrew/software_spec.rb
@@ -245,6 +245,10 @@ def compatible_cellar? @spec.compatible_cellar? end + def needs_relocation? + @spec.needs_relocation? + end + def stage resource.downloader.stage end @@ -270,6 +274,7 @@ def initialize @prefix = DEFAULT_PREFIX @cellar = DEFAULT_CELLAR @collector = BottleCollector.new + @does_not_need_relocation = false end def root_url(var = nil) @@ -284,6 +289,14 @@ def compatible_cellar? cellar == :any || cellar == HOMEBREW_CELLAR.to_s end + def does_not_need_relocation + @does_not_need_relocation = true + end + + def needs_relocation? + !@does_not_need_relocation + end + def tag?(tag) !!checksum_for(tag) end
false
Other
Homebrew
brew
329358c33c4aa317cb4be6802eddd2a6b8c800fc.json
manpage: add doc for tap --list-official and --list-pinned
Library/Homebrew/manpages/brew.1.md
@@ -390,6 +390,12 @@ Note that these flags should only appear after a command. * `tap --repair`: Migrate tapped formulae from symlink-based to directory-based structure. + * `tap --list-official`: + List all official taps. + + * `tap --list-pinned`: + List all pinned taps. + * `tap-info` <tap>: Display information about <tap>.
true
Other
Homebrew
brew
329358c33c4aa317cb4be6802eddd2a6b8c800fc.json
manpage: add doc for tap --list-official and --list-pinned
share/man/man1/brew.1
@@ -373,6 +373,12 @@ By default, the repository is cloned as a shallow copy (\fB\-\-depth=1\fR), but \fBtap \-\-repair\fR: Migrate tapped formulae from symlink\-based to directory\-based structure\. . .IP "\(bu" 4 +\fBtap \-\-list\-official\fR: List all official taps\. +. +.IP "\(bu" 4 +\fBtap \-\-list\-pinned\fR: List all pinned taps\. +. +.IP "\(bu" 4 \fBtap\-info\fR \fItap\fR: Display information about \fItap\fR\. . .IP "\(bu" 4
true
Other
Homebrew
brew
ac713863731b792e45776e990131f8774f5a7f65.json
test-bot: tap TapDependency recursively Closes Homebrew/homebrew#43145. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/cmd/test-bot.rb
@@ -409,12 +409,16 @@ def formula(formula_name) reqs |= formula.devel.requirements.to_a end + begin + formula.recursive_dependencies + rescue TapFormulaUnavailableError => e + raise if e.tap.installed? + safe_system "brew", "tap", e.tap.name + retry + end + begin deps.each do |dep| - if dep.is_a?(TapDependency) && dep.tap - tap_dir = Homebrew.homebrew_git_repo dep.tap - test "brew", "tap", dep.tap unless tap_dir.directory? - end CompilerSelector.select_for(dep.to_formula) end CompilerSelector.select_for(formula)
false
Other
Homebrew
brew
212d0b82fd33d6520d2639ee6c994eb224623b5a.json
xcode: update 10.11 clang
Library/Homebrew/os/mac/xcode.rb
@@ -163,7 +163,7 @@ def installed? def latest_version case MacOS.version - when "10.11" then "700.0.59.1" + when "10.11" then "700.0.65" when "10.10" then "602.0.53" when "10.9" then "600.0.57" when "10.8" then "503.0.40"
false
Other
Homebrew
brew
e4480cf6bf80e8de737581f8b3ce3068334747c4.json
update: add formula renames to report
Library/Homebrew/cmd/update.rb
@@ -62,27 +62,18 @@ def update tabs.each(&:write) end if load_tap_migrations - # Migrate installed renamed formulae from main Homebrew repository. - if load_formula_renames - report.select_formula(:D).each do |oldname| - newname = FORMULA_RENAMES[oldname] - next unless newname - next unless (dir = HOMEBREW_CELLAR/oldname).directory? && !dir.subdirs.empty? - - begin - migrator = Migrator.new(Formulary.factory("homebrew/homebrew/#{newname}")) - migrator.migrate - rescue Migrator::MigratorDifferentTapsError - end + load_formula_renames + report.update_renamed + + # Migrate installed renamed formulae from core and taps. + report.select_formula(:R).each do |oldname, newname| + if oldname.include?("/") + user, repo, oldname = oldname.split("/", 3) + newname = newname.split("/", 3).last + else + user, repo = "homebrew", "homebrew" end - end - # Migrate installed renamed formulae from taps - report.select_formula(:D).each do |oldname| - user, repo, oldname = oldname.split("/", 3) - next unless user && repo && oldname - tap = Tap.new(user, repo) - next unless newname = tap.formula_renames[oldname] next unless (dir = HOMEBREW_CELLAR/oldname).directory? && !dir.subdirs.empty? begin @@ -322,14 +313,45 @@ def dump dump_formula_report :A, "New Formulae" dump_formula_report :M, "Updated Formulae" + dump_formula_report :R, "Renamed Formulae" dump_formula_report :D, "Deleted Formulae" end - def select_formula(key) - fetch(key, []).map do |path| + def update_renamed + @hash[:R] ||= [] + + fetch(:D, []).each do |path| case path.to_s when HOMEBREW_TAP_PATH_REGEX - "#{$1}/#{$2.sub("homebrew-", "")}/#{path.basename(".rb")}" + user = $1 + repo = $2.sub("homebrew-", "") + oldname = path.basename(".rb").to_s + next unless newname = Tap.new(user, repo).formula_renames[oldname] + else + oldname = path.basename(".rb").to_s + next unless newname = FORMULA_RENAMES[oldname] + end + + if fetch(:A, []).include?(newpath = path.dirname.join("#{newname}.rb")) + @hash[:R] << [path, newpath] + end + end + + @hash[:A] -= @hash[:R].map(&:last) if @hash[:A] + @hash[:D] -= @hash[:R].map(&:first) if @hash[:D] + end + + def select_formula(key) + fetch(key, []).map do |path, newpath| + if path.to_s =~ HOMEBREW_TAP_PATH_REGEX + tap = "#{$1}/#{$2.sub("homebrew-", "")}" + if newpath + ["#{tap}/#{path.basename(".rb")}", "#{tap}/#{newpath.basename(".rb")}"] + else + "#{tap}/#{path.basename(".rb")}" + end + elsif newpath + ["#{path.basename(".rb")}", "#{newpath.basename(".rb")}"] else path.basename(".rb").to_s end @@ -338,6 +360,7 @@ def select_formula(key) def dump_formula_report(key, title) formula = select_formula(key) + formula.map! { |oldname, newname| "#{oldname} -> #{newname}" } if key == :R unless formula.empty? ohai title puts_columns formula
false
Other
Homebrew
brew
72a11b7d1166d14b82e1124920a0c80586e7c057.json
test_migrator: fix lock file leak Closes Homebrew/homebrew#43025. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/test/test_migrator.rb
@@ -93,6 +93,8 @@ def teardown rmtree HOMEBREW_PREFIX/"opt" if (HOMEBREW_PREFIX/"opt").directory? # What to do with pin? @new_f.unpin + + FormulaLock::LOCKDIR.children.each(&:unlink) end def test_move_cellar
false
Other
Homebrew
brew
a380ec636eb02e1412ee6657449b9a159182c9da.json
enable sandbox on test-bot Closes Homebrew/homebrew#43014. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/cmd/test-bot.rb
@@ -710,6 +710,7 @@ def test_bot end ENV["HOMEBREW_DEVELOPER"] = "1" + ENV["HOMEBREW_SANDBOX"] = "1" ENV["HOMEBREW_NO_EMOJI"] = "1" if ARGV.include?("--ci-master") || ARGV.include?("--ci-pr") \ || ARGV.include?("--ci-testing")
false
Other
Homebrew
brew
dc4feaf56b5ba36c579277ea8fbc2f983f2bcdf0.json
test_keg: add tests for oldname optlink Closes Homebrew/homebrew#42998. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/test/test_keg.rb
@@ -48,6 +48,36 @@ def test_unlinking_keg refute_predicate @dst, :symlink? end + def test_oldname_opt_record + assert_nil @keg.oldname_opt_record + oldname_opt_record = HOMEBREW_PREFIX/"opt/oldfoo" + oldname_opt_record.make_relative_symlink(HOMEBREW_CELLAR/"foo/1.0") + assert_equal oldname_opt_record, @keg.oldname_opt_record + end + + def test_optlink_relink + oldname_opt_record = HOMEBREW_PREFIX/"opt/oldfoo" + oldname_opt_record.make_relative_symlink(HOMEBREW_CELLAR/"foo/1.0") + keg_record = HOMEBREW_CELLAR.join("foo", "2.0") + keg_record.join("bin").mkpath + keg = Keg.new(keg_record) + keg.optlink + assert_equal keg_record, oldname_opt_record.resolved_path + keg.uninstall + refute_predicate oldname_opt_record, :symlink? + end + + def test_remove_oldname_opt_record + oldname_opt_record = HOMEBREW_PREFIX/"opt/oldfoo" + oldname_opt_record.make_relative_symlink(HOMEBREW_CELLAR/"foo/2.0") + @keg.remove_oldname_opt_record + assert_predicate oldname_opt_record, :symlink? + oldname_opt_record.unlink + oldname_opt_record.make_relative_symlink(HOMEBREW_CELLAR/"foo/1.0") + @keg.remove_oldname_opt_record + refute_predicate oldname_opt_record, :symlink? + end + def test_link_dry_run @mode.dry_run = true
false
Other
Homebrew
brew
0bf2f92f467b4b4cca889a9e53299772bd1641f9.json
outdated: remove unnecessary nested if
Library/Homebrew/cmd/outdated.rb
@@ -18,10 +18,8 @@ def outdated_brews(formulae) all_versions = [] older_or_same_tap_versions = [] - if f.oldname && !f.rack.exist? - if Pathname.new("#{HOMEBREW_CELLAR}/#{f.oldname}").exist? - raise Migrator::MigrationNeededError.new(f) - end + if f.oldname && !f.rack.exist? && (HOMEBREW_CELLAR/f.oldname).exist? + raise Migrator::MigrationNeededError.new(f) end f.rack.subdirs.each do |dir|
false
Other
Homebrew
brew
8a766c476808d0c1afd29c55a6f950d074196833.json
Formulary.to_rack: follow the symlink
Library/Homebrew/formulary.rb
@@ -198,12 +198,11 @@ def self.from_rack(rack, spec = nil) def self.to_rack(ref) # First, check whether the rack with the given name exists. if (rack = HOMEBREW_CELLAR/File.basename(ref, ".rb")).directory? - return rack + return rack.resolved_path end # Second, use canonical name to locate rack. - name = canonical_name(ref) - HOMEBREW_CELLAR/name + (HOMEBREW_CELLAR/canonical_name(ref)).resolved_path end def self.canonical_name(ref)
false
Other
Homebrew
brew
3a535ed36b346694ab9f2143ef5f28e314318520.json
make path instead of symlink for lib/R Moves us towards being able to support formulae that install R bindings, like nonpareil in homebrew-science. Some discussion in Homebrew/homebrew-science#2559. Closes Homebrew/homebrew#42539.
Library/Homebrew/keg.rb
@@ -300,6 +300,7 @@ def link(mode = OpenStruct.new) when /^perl5/ then :mkpath when "php" then :mkpath when /^python[23]\.\d/ then :mkpath + when /^R/ then :mkpath when /^ruby/ then :mkpath # Everything else is symlinked to the cellar else :link
false
Other
Homebrew
brew
541459791351a69b7b70047ee5e0c2c05797de92.json
cleanup: avoid duplicated logic Closes Homebrew/homebrew#42900. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/cmd/cleanup.rb
@@ -31,12 +31,8 @@ def cleanup_logs end def cleanup_cellar - Formula.racks.each do |rack| - begin - cleanup_formula Formulary.from_rack(rack) - rescue FormulaUnavailableError, TapFormulaAmbiguityError - # Don't complain about directories from DIY installs - end + Formula.installed.each do |formula| + cleanup_formula formula end end
false
Other
Homebrew
brew
d5535bf564e70ab1c0199a5c18fa842e8b499209.json
doc: use relative links
share/doc/homebrew/Acceptable-Formulae.md
@@ -6,7 +6,7 @@ own! ### We try hard to avoid dupes in Homebrew/homebrew Stuff that comes with OS X or libraries that are provided by -[RubyGems, CPAN or PyPi](https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Gems,-Eggs-and-Perl-Modules.md) +[RubyGems, CPAN or PyPi](Gems,-Eggs-and-Perl-Modules.md) should not be duplicated. There are good reasons for this: * Duplicate libraries regularly break builds
true
Other
Homebrew
brew
d5535bf564e70ab1c0199a5c18fa842e8b499209.json
doc: use relative links
share/doc/homebrew/FAQ.md
@@ -174,7 +174,7 @@ creating a separate user account especially for use of Homebrew. ### Why isn’t a particular command documented? -If it’s not in `man brew`, it’s probably an external command. These are documented [here](https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/External-Commands.md). +If it’s not in `man brew`, it’s probably an external command. These are documented [here](External-Commands.md). ### Why haven’t you pulled my pull request? If it’s been a while, bump it with a “bump” comment. Sometimes we miss requests and there are plenty of them. Maybe we were thinking on something. It will encourage consideration. In the meantime if you could rebase the pull request so that it can be cherry-picked more easily we will love you for a long time.
true
Other
Homebrew
brew
d5535bf564e70ab1c0199a5c18fa842e8b499209.json
doc: use relative links
share/doc/homebrew/Python-for-Formula-Authors.md
@@ -77,7 +77,7 @@ The first line copies all of the executables to bin. The second line writes stub All Python dependencies of applications that are not packaged by Homebrew (and those dependencies' Python dependencies, recursively) **should** be unconditionally downloaded as `Resource`s and installed into the application keg's `libexec/"vendor"` path. This prevents the state of the system Python packages from being affected by installing an app with Homebrew and guarantees that apps use versions of their dependencies that are known to work together. `libexec/"vendor"` is preferred to `libexec` so that formulæ don't accidentally install executables belonging to their dependencies, which can cause linking conflicts. -Each dependency **should** be explicitly installed; please do not rely on setup.py or pip to perform automatic dependency resolution, for the [reasons described here](https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Acceptable-Formulae.md#we-dont-like-install-scripts-that-download-things). +Each dependency **should** be explicitly installed; please do not rely on setup.py or pip to perform automatic dependency resolution, for the [reasons described here](Acceptable-Formulae.md#we-dont-like-install-scripts-that-download-things). You can use [homebrew-pypi-poet](https://pypi.python.org/pypi/homebrew-pypi-poet) to help you write resource stanzas. To use it, set up a virtualenv and install your package and all its dependencies. Then, `pip install homebrew-pypi-poet` into the same virtualenv. `poet -f foo` will draft a complete formula for you, or `poet foo` will just generate the resource stanzas.
true
Other
Homebrew
brew
83ab0acfc0fae4968309d2ce248ec7478436c476.json
test-bot: remove custom $HOME on --cleanup.
Library/Homebrew/cmd/test-bot.rb
@@ -608,6 +608,10 @@ def cleanup_after git "stash", "pop" test "brew", "cleanup", "--prune=7" git "gc", "--auto" + if ARGV.include? "--local" + FileUtils.rm_rf ENV["HOMEBREW_HOME"] + FileUtils.rm_rf ENV["HOMEBREW_LOGS"] + end end FileUtils.rm_rf @brewbot_root unless ARGV.include? "--keep-logs" @@ -717,7 +721,7 @@ def test_bot end if ARGV.include? "--local" - ENV["HOME"] = "#{Dir.pwd}/home" + ENV["HOMEBREW_HOME"] = ENV["HOME"] = "#{Dir.pwd}/home" mkdir_p ENV["HOME"] ENV["HOMEBREW_LOGS"] = "#{Dir.pwd}/logs" end
false
Other
Homebrew
brew
15c3fb32b26228b4cef2bb33863e8072ab270a41.json
cleanup: remove SCM directories recursively.
Library/Homebrew/cmd/cleanup.rb
@@ -73,7 +73,7 @@ def cleanup_cache if path.file? cleanup_path(path) { path.unlink } elsif path.directory? && path.to_s.include?("--") - cleanup_path(path) { path.rmdir } + cleanup_path(path) { FileUtils.rm_rf path } end next end
false
Other
Homebrew
brew
04b350dce5d0ac7e87ab4b5882dd1a5f19f39a9d.json
cleanup: do cleanup even without a Cellar.
Library/Homebrew/cmd/cleanup.rb
@@ -4,10 +4,6 @@ module Homebrew def cleanup - # individual cleanup_ methods should also check for the existence of the - # appropriate directories before assuming they exist - return unless HOMEBREW_CELLAR.directory? - if ARGV.named.empty? cleanup_cellar cleanup_cache @@ -35,6 +31,7 @@ def cleanup_logs end def cleanup_cellar + return unless HOMEBREW_CELLAR.directory? HOMEBREW_CELLAR.subdirs.each do |rack| begin cleanup_formula Formulary.from_rack(rack) @@ -92,6 +89,8 @@ def cleanup_cache next unless version next unless (name = file.basename.to_s[/(.*)-(?:#{Regexp.escape(version)})/, 1]) + next unless HOMEBREW_CELLAR.directory? + begin f = Formulary.from_rack(HOMEBREW_CELLAR/name) rescue FormulaUnavailableError, TapFormulaAmbiguityError
false
Other
Homebrew
brew
e49a0434014464488de356550ffaa6028666faf5.json
cleanup: remove more on --force or --prune. Remove more logs, use the prune time period and remove version control checkouts when --force or --prune is used.
Library/Homebrew/cmd/cleanup.rb
@@ -23,9 +23,14 @@ def cleanup def cleanup_logs return unless HOMEBREW_LOGS.directory? - time = Time.now - 2 * 7 * 24 * 60 * 60 # two weeks + prune = ARGV.value "prune" + if prune + time = Time.now - 60 * 60 * 24 * prune.to_i + else + time = Time.now - 60 * 60 * 24 * 7 * 2 # two weeks + end HOMEBREW_LOGS.subdirs.each do |dir| - cleanup_path(dir) { dir.rmtree } if dir.mtime < time + cleanup_path(dir) { dir.rmtree } if ARGV.force? || (dir.mtime < time) end end @@ -66,8 +71,18 @@ def cleanup_cache return unless HOMEBREW_CACHE.directory? prune = ARGV.value "prune" time = Time.now - 60 * 60 * 24 * prune.to_i - HOMEBREW_CACHE.children.select(&:file?).each do |file| - next cleanup_path(file) { file.unlink } if prune && file.mtime < time + HOMEBREW_CACHE.children.each do |path| + if ARGV.force? || (prune && path.mtime < time) + if path.file? + cleanup_path(path) { path.unlink } + elsif path.directory? && path.to_s.include?("--") + cleanup_path(path) { path.rmdir } + end + next + end + + next unless path.file? + file = path if Pathname::BOTTLE_EXTNAME_RX === file.to_s version = bottle_resolve_version(file) rescue file.version
false
Other
Homebrew
brew
0d4da4234a1ee776114408f118cd1d683360a2cf.json
audit: enforce https on [*.]archive.org Also: * one minor regexp tweak Closes Homebrew/homebrew#42761. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Library/Homebrew/cmd/audit.rb
@@ -439,7 +439,8 @@ def audit_homepage %r{^http://[^/.]+\.tools\.ietf\.org}, %r{^http://www\.gnu\.org/}, %r{^http://code\.google\.com/}, - %r{^http://bitbucket\.org/} + %r{^http://bitbucket\.org/}, + %r{^http://(?:[^/]*\.)?archive\.org} problem "Please use https:// for #{homepage}" end @@ -1057,11 +1058,12 @@ def audit_urls %r{^http://code\.google\.com/}, %r{^http://fossies\.org/}, %r{^http://mirrors\.kernel\.org/}, - %r{^http://([^/]*\.|)bintray\.com/}, + %r{^http://(?:[^/]*\.)?bintray\.com/}, %r{^http://tools\.ietf\.org/}, %r{^http://www\.mirrorservice\.org/}, %r{^http://launchpad\.net/}, - %r{^http://bitbucket\.org/} + %r{^http://bitbucket\.org/}, + %r{^http://(?:[^/]*\.)?archive\.org} problem "Please use https:// for #{p}" when %r{^http://search\.mcpan\.org/CPAN/(.*)}i problem "#{p} should be `https://cpan.metacpan.org/#{$1}`"
false
Other
Homebrew
brew
c405a2349140626d924818ff764f232ef94eaadb.json
doc: fix internal link
share/doc/homebrew/Installation.md
@@ -3,7 +3,7 @@ The suggested and easiest way to install Homebrew is on the [homepage](http://brew.sh). The standard script installs Homebrew to `/usr/local` so that -[you don’t need sudo](FAQ.md#wiki-sudo) when you `brew install`. It is a +[you don’t need sudo](FAQ.md#why-does-homebrew-say-sudo-is-bad-) when you `brew install`. It is a careful script, it can be run even if you have stuff installed to `/usr/local` already. It tells you exactly what it will do before it does it too. And you have to confirm everything it will do before it
false
Other
Homebrew
brew
f64661fb18e3147bb0ab70c3741e5403ad1e600a.json
doc: fix internal links
share/doc/homebrew/Homebrew-0.9.3.md
@@ -17,8 +17,8 @@ Because we are working with a practically virgin environment, we are essentially So: -* We no longer worry about MacPorts/Fink being installed<sup>[†](#_†)</sup> -* We no longer worry about system duplicates<sup>[†](#_†)</sup> +* We no longer worry about MacPorts/Fink being installed<sup>[0](#_0)</sup> +* We no longer worry about system duplicates<sup>[0](#_0)</sup> * We override common tools and fix them—we no longer have to do so with workarounds in affected formula, waiting for a fix from Apple. * Builds are forcibly optimized how we want, and debug info forcibly removed. @@ -27,7 +27,7 @@ So: ## Footnotes <div style="color: #555; font-size: 85%"> <ul> - <li><a id="_†"><sup>†</sup></a>: Nearly as much, anyway.</li> + <li><a id="_0"><sup>0</sup></a>: Nearly as much, anyway.</li> <li><a id="_1"><sup>1</sup></a>: Formula can opt-into re-adding the user’s <code>PATH</code> again. Some formulae need this.</li> <li><a id="_2"><sup>2</sup></a>: Indeed; this is selected based on Xcode version.</li> </ul>
false