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
883b201c0906ad2942ec900290568836b5ddc240.json
utils: output what files `edit` is opening. (#444) Since we've moved all formulae to taps it's not necessarily obvious what the path for the files are otherwise.
Library/Homebrew/utils.rb
@@ -431,6 +431,7 @@ def which_editor end def exec_editor(*args) + puts "Editing #{args.join "\n"}" safe_exec(which_editor, *args) end
false
Other
Homebrew
brew
a49f3a8e91df8ccbbd7335deab1853ce395c5be4.json
style: use RuboCop 0.41.1 (#433) Tweak `Style/NumericLiteralPrefix` cop settings as we're using octal literals a lot (both in formulae and the package manager) for file permissions and aren't ready just yet to transition them to the more beginner-friendly `0o` prefix (instead of the more obscure `0` prefix).
Library/.rubocop.yml
@@ -66,6 +66,10 @@ Style/EmptyLineBetweenDefs: Style/NumericLiterals: Enabled: false +# zero-prefixed octal literals are just too widely used (and mostly understood) +Style/NumericLiteralPrefix: + EnforcedOctalStyle: zero_only + # consistency and readability when faced with string interpolation Style/PercentLiteralDelimiters: PreferredDelimiters:
true
Other
Homebrew
brew
a49f3a8e91df8ccbbd7335deab1853ce395c5be4.json
style: use RuboCop 0.41.1 (#433) Tweak `Style/NumericLiteralPrefix` cop settings as we're using octal literals a lot (both in formulae and the package manager) for file permissions and aren't ready just yet to transition them to the more beginner-friendly `0o` prefix (instead of the more obscure `0` prefix).
Library/Homebrew/cmd/style.rb
@@ -47,7 +47,7 @@ def check_style_json(files, options = {}) def check_style_impl(files, output_type, options = {}) fix = options[:fix] - Homebrew.install_gem_setup_path! "rubocop", "0.40" + Homebrew.install_gem_setup_path! "rubocop", "0.41.1" args = %W[ --force-exclusion
true
Other
Homebrew
brew
9167fbf8766e1cc4438ffbb583627505784c60cf.json
linkage: fix edge cases for undeclared_deps * take requirements into account. * handle full qualified formula name. * filter out build time or unused optional deps/requirements. Closes #424. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/dev-cmd/linkage.rb
@@ -72,7 +72,13 @@ def check_dylibs begin f = Formulary.from_rack(keg.rack) - @undeclared_deps = @brewed_dylibs.keys - f.deps.map(&:name) + f.build = Tab.for_keg(keg) + filter_out = proc do |dep| + dep.build? || (dep.optional? && !dep.option_names.any? { |n| f.build.with?(n) }) + end + declared_deps = f.deps.reject { |dep| filter_out.call(dep) }.map(&:name) + + f.requirements.reject { |req| filter_out.call(req) }.map(&:default_formula).compact + @undeclared_deps = @brewed_dylibs.keys - declared_deps.map { |dep| dep.split("/").last } @undeclared_deps -= [f.name] rescue FormulaUnavailableError opoo "Formula unavailable: #{keg.name}"
false
Other
Homebrew
brew
080ddd8804be14f4b18f9558b58270456ff313c2.json
linkage: check undeclared dependencies for `--test` Also allowing access results for LinkageChecker
Library/Homebrew/dev-cmd/linkage.rb
@@ -16,34 +16,34 @@ module Homebrew def linkage - found_broken_dylibs = false ARGV.kegs.each do |keg| ohai "Checking #{keg.name} linkage" if ARGV.kegs.size > 1 result = LinkageChecker.new(keg) if ARGV.include?("--test") result.display_test_output + if result.broken_dylibs? || result.undeclared_deps? + Homebrew.failed = true + end elsif ARGV.include?("--reverse") result.display_reverse_output else result.display_normal_output end - found_broken_dylibs = true unless result.broken_dylibs.empty? - end - if ARGV.include?("--test") && found_broken_dylibs - exit 1 end end class LinkageChecker attr_reader :keg - attr_reader :broken_dylibs + attr_reader :brewed_dylibs, :system_dylibs, :broken_dylibs, :variable_dylibs + attr_reader :undeclared_deps, :reverse_links def initialize(keg) @keg = keg @brewed_dylibs = Hash.new { |h, k| h[k] = Set.new } @system_dylibs = Set.new @broken_dylibs = Set.new @variable_dylibs = Set.new + @undeclared_deps = [] @reverse_links = Hash.new { |h, k| h[k] = Set.new } check_dylibs end @@ -76,7 +76,6 @@ def check_dylibs @undeclared_deps -= [f.name] rescue FormulaUnavailableError opoo "Formula unavailable: #{keg.name}" - @undeclared_deps = [] end end @@ -104,6 +103,16 @@ def display_reverse_output def display_test_output display_items "Missing libraries", @broken_dylibs puts "No broken dylib links" if @broken_dylibs.empty? + display_items "Possible undeclared dependencies", @undeclared_deps + puts "No undeclared dependencies" if @undeclared_deps.empty? + end + + def broken_dylibs? + !@broken_dylibs.empty? + end + + def undeclared_deps? + !@undeclared_deps.empty? end private
false
Other
Homebrew
brew
bf4f33790370b7d2eb5d2b4464d6e54f686f31d0.json
Call subcommands from zsh completion This change is inspired by the way that the git zsh completions work by foisting the responsibility for sub commands onto the command themselves. It is paired with another change that takes the oh-my-zsh brew cask plugin and makes it into a first class completion rather than it overriding this. This change requires fixes in brew, oh-my-zsh and the zsh-completions, and will likely cause the brew cask completions to break until these have been fully accepted into each project.
share/zsh/site-functions/_brew
@@ -2,8 +2,6 @@ #autoload # Brew ZSH completion function -# -# altered from _fink _brew_all_formulae() { formulae=(`brew search`) @@ -29,6 +27,12 @@ _brew_outdated_formulae() { outdated_formulae=(`brew outdated`) } +__brew_command() { + local command="$1" + local completion_func="_brew_${command//-/_}" + declare -f "$completion_func" >/dev/null && "$completion_func" && return +} + local -a _1st_arguments _1st_arguments=( 'audit:check formulae for Homebrew coding style' @@ -95,7 +99,8 @@ if (( CURRENT == 1 )); then return fi -case "$words[1]" in +local command="$words[1]" +case "$command" in analytics) compadd on off state regenerate-uuid ;; install|reinstall|audit|home|homepage|log|info|abv|uses|cat|deps|desc|edit|options|switch) _brew_all_formulae @@ -145,4 +150,6 @@ case "$words[1]" in _brew_outdated_formulae _wanted outdated_formulae expl 'outdated formulae' compadd -a outdated_formulae fi ;; + *) + __brew_command "$command" ;; esac
false
Other
Homebrew
brew
3e309d4643ab52ce823b8733d72f8665133dbf5e.json
blacklist: update URLs and MacRuby message (#406) * updates link for installing pip * the macruby project has been abandoned and the website is gone
Library/Homebrew/blacklist.rb
@@ -17,15 +17,15 @@ def blacklisted?(name) Homebrew provides pip via: `brew install python`. However you will then have two Pythons installed on your Mac, so alternatively you can install pip via the instructions at: - - https://pip.readthedocs.org/en/stable/installing/#install-pip + https://pip.readthedocs.io/en/stable/installing/ EOS when "pil" then <<-EOS.undent Instead of PIL, consider `pip install pillow` or `brew install Homebrew/python/pillow`. EOS when "macruby" then <<-EOS.undent - MacRuby works better when you install their package: - http://www.macruby.org/ + MacRuby is not packaged and is on an indefinite development hiatus. + You can read more about it at: + https://github.com/MacRuby/MacRuby EOS when /(lib)?lzma/ "lzma is now part of the xz formula."
false
Other
Homebrew
brew
4e927d9ce855cbd74b2f893237bb2b6489f88da8.json
Remove unused variable Step#@time Shadowed by Step#time method.
Library/Homebrew/dev-cmd/test-bot.rb
@@ -96,7 +96,7 @@ def resolve_test_tap # Wraps command invocations. Instantiated by Test#test. # Handles logging and pretty-printing. class Step - attr_reader :command, :name, :status, :output, :time + attr_reader :command, :name, :status, :output # Instantiates a Step object. # @param test [Test] The parent Test object @@ -112,7 +112,6 @@ def initialize(test, command, options = {}) @name = command[1].delete("-") @status = :running @repository = options[:repository] || HOMEBREW_REPOSITORY - @time = 0 end def log_file_path
false
Other
Homebrew
brew
1c27a75ca40cd232bccc59682ad411122c82ad59.json
utils/lock.sh: remove redundant 'local'
Library/Homebrew/utils/lock.sh
@@ -29,7 +29,7 @@ EOS _create_lock() { local lock_fd="$1" local ruby="/usr/bin/ruby" - [[ -x "$ruby" ]] || local ruby="$(which ruby 2>/dev/null)" + [[ -x "$ruby" ]] || ruby="$(which ruby 2>/dev/null)" if [[ -n "$ruby" ]] then
false
Other
Homebrew
brew
db76a0f4cc3838658919570b3453edbcb9ed2fcd.json
Begin documenting environment variables Closes #405.
Library/Homebrew/dev-cmd/test-bot.rb
@@ -25,6 +25,10 @@ # --ci-pr: Shortcut for Homebrew pull request CI options. # --ci-testing: Shortcut for Homebrew testing CI options. # --ci-upload: Homebrew CI bottle upload. +# +# Influential environment variables include: +# TRAVIS_REPO_SLUG: same as --tap +# GIT_URL: if set to URL of a tap remote, same as --tap require "formula" require "utils" @@ -1026,4 +1030,3 @@ def sanitize_output_for_xml(output) output end end -
false
Other
Homebrew
brew
9b36e8377142241218cb472dcaf64561f70b96e9.json
Add magic token to hide commands from man page Closes #402.
Library/Homebrew/cmd/help.rb
@@ -91,8 +91,9 @@ def command_help(path) line.slice(2..-1). sub(/^ \* /, "#{Tty.highlight}brew#{Tty.reset} "). gsub(/`(.*?)`/, "#{Tty.highlight}\\1#{Tty.reset}"). - gsub(/<(.*?)>/, "#{Tty.em}\\1#{Tty.reset}") - end.join + gsub(/<(.*?)>/, "#{Tty.em}\\1#{Tty.reset}"). + gsub("@hide_from_man_page", "") + end.join.strip end end end
true
Other
Homebrew
brew
9b36e8377142241218cb472dcaf64561f70b96e9.json
Add magic token to hide commands from man page Closes #402.
Library/Homebrew/cmd/man.rb
@@ -51,7 +51,7 @@ def build_man_page map { |line| line.slice(2..-1) }. join }. - reject { |s| s.strip.empty? } + reject { |s| s.strip.empty? || s.include?("@hide_from_man_page") } variables[:maintainers] = (HOMEBREW_REPOSITORY/"README.md"). read[/Homebrew's current maintainers are (.*)\./, 1].
true
Other
Homebrew
brew
9b36e8377142241218cb472dcaf64561f70b96e9.json
Add magic token to hide commands from man page Closes #402.
Library/Homebrew/cmd/tests.rb
@@ -1,3 +1,4 @@ +#: @hide_from_man_page #: * `tests` [`-v`] [`--coverage`] [`--generic`] [`--no-compat`] [`--only=`<test_script/test_method>] [`--seed` <seed>] [`--trace`]: #: Run Homebrew's unit and integration tests.
true
Other
Homebrew
brew
3c5f007bfa1a469ef3e1a048ee163f3eaa73cb71.json
bin/brew: fix corner cases in prefix computation If `bin/brew` happens to be symlinked to `/brew`, `/bin/brew`, or some similar location or (worse yet) Homebrew is installed to `/`, then computation of the prefix and/or repository path could break down and result in an invalid or empty path. Closes Homebrew/homebrew-core#2430.
bin/brew
@@ -5,10 +5,13 @@ quiet_cd() { cd "$@" >/dev/null } -BREW_FILE_DIRECTORY="$(quiet_cd "${0%/*}" && pwd -P)" -HOMEBREW_BREW_FILE="$BREW_FILE_DIRECTORY/${0##*/}" +BREW_FILE_DIRECTORY="$(quiet_cd "${0%/*}/" && pwd -P)" +HOMEBREW_BREW_FILE="${BREW_FILE_DIRECTORY%/}/${0##*/}" HOMEBREW_PREFIX="${HOMEBREW_BREW_FILE%/*/*}" +[[ -n "$HOMEBREW_PREFIX" && "$HOMEBREW_PREFIX" != "$HOMEBREW_BREW_FILE" ]] \ + || HOMEBREW_PREFIX="/" + HOMEBREW_REPOSITORY="$HOMEBREW_PREFIX" if [[ -L "$HOMEBREW_BREW_FILE" ]]
false
Other
Homebrew
brew
0d3b5f6849e236272d6a1b83a1869845608b3d10.json
test_formula: add migration_needed test
Library/Homebrew/test/test_formula.rb
@@ -40,6 +40,28 @@ def test_any_version_installed? f.rack.rmtree end + def test_migration_needed + f = Testball.new("newname") + f.instance_variable_set(:@oldname, "oldname") + f.instance_variable_set(:@tap, CoreTap.instance) + + oldname_prefix = HOMEBREW_CELLAR/"oldname/2.20" + oldname_prefix.mkpath + oldname_tab = Tab.empty + oldname_tab.tabfile = oldname_prefix.join("INSTALL_RECEIPT.json") + oldname_tab.write + + refute_predicate f, :migration_needed? + + oldname_tab.tabfile.unlink + oldname_tab.source["tap"] = "homebrew/core" + oldname_tab.write + + assert_predicate f, :migration_needed? + ensure + oldname_prefix.parent.rmtree + end + def test_installed? f = Testball.new f.stubs(:installed_prefix).returns(stub(:directory? => false))
false
Other
Homebrew
brew
d47df68cbd03fb621825d12a531f91938571ec04.json
test_formula: add outdated_versions tests
Library/Homebrew/test/test_formula.rb
@@ -406,3 +406,101 @@ def test_pour_bottle_dsl assert f_true.pour_bottle? end end + +class OutdatedVersionsTests < Homebrew::TestCase + attr_reader :outdated_prefix, :same_prefix, :greater_prefix, :head_prefix + attr_reader :f + + def setup + @f = formula { url "foo"; version "1.20" } + @outdated_prefix = HOMEBREW_CELLAR/"#{f.name}/1.11" + @same_prefix = HOMEBREW_CELLAR/"#{f.name}/1.20" + @greater_prefix = HOMEBREW_CELLAR/"#{f.name}/1.21" + @head_prefix = HOMEBREW_CELLAR/"#{f.name}/HEAD" + end + + def teardown + @f.rack.rmtree + end + + def setup_tab_for_prefix(prefix, tap_string=nil) + prefix.mkpath + tab = Tab.empty + tab.tabfile = prefix.join("INSTALL_RECEIPT.json") + tab.source["tap"] = tap_string if tap_string + tab.write + tab + end + + def test_greater_different_tap_installed + setup_tab_for_prefix(greater_prefix, "user/repo") + assert_predicate f.outdated_versions, :empty? + end + + def test_greater_same_tap_installed + f.instance_variable_set(:@tap, CoreTap.instance) + setup_tab_for_prefix(greater_prefix, "homebrew/core") + assert_predicate f.outdated_versions, :empty? + end + + def test_outdated_different_tap_installed + setup_tab_for_prefix(outdated_prefix, "user/repo") + refute_predicate f.outdated_versions, :empty? + end + + def test_outdated_same_tap_installed + f.instance_variable_set(:@tap, CoreTap.instance) + setup_tab_for_prefix(outdated_prefix, "homebrew/core") + refute_predicate f.outdated_versions, :empty? + end + + def test_same_head_installed + f.instance_variable_set(:@tap, CoreTap.instance) + setup_tab_for_prefix(head_prefix, "homebrew/core") + assert_predicate f.outdated_versions, :empty? + end + + def test_different_head_installed + f.instance_variable_set(:@tap, CoreTap.instance) + setup_tab_for_prefix(head_prefix, "user/repo") + assert_predicate f.outdated_versions, :empty? + end + + def test_mixed_taps_greater_version_installed + f.instance_variable_set(:@tap, CoreTap.instance) + setup_tab_for_prefix(outdated_prefix, "homebrew/core") + setup_tab_for_prefix(greater_prefix, "user/repo") + + assert_predicate f.outdated_versions, :empty? + + setup_tab_for_prefix(greater_prefix, "homebrew/core") + + assert_predicate f.outdated_versions, :empty? + end + + def test_mixed_taps_outdated_version_installed + f.instance_variable_set(:@tap, CoreTap.instance) + + extra_outdated_prefix = HOMEBREW_CELLAR/"#{f.name}/1.0" + + setup_tab_for_prefix(outdated_prefix) + setup_tab_for_prefix(extra_outdated_prefix, "homebrew/core") + + refute_predicate f.outdated_versions, :empty? + + setup_tab_for_prefix(outdated_prefix, "user/repo") + + refute_predicate f.outdated_versions, :empty? + end + + def test_same_version_tap_installed + f.instance_variable_set(:@tap, CoreTap.instance) + setup_tab_for_prefix(same_prefix, "homebrew/core") + + assert_predicate f.outdated_versions, :empty? + + setup_tab_for_prefix(same_prefix, "user/repo") + + assert_predicate f.outdated_versions, :empty? + end +end
false
Other
Homebrew
brew
cb3ad215b4fc011e3405e6e577b97819c683036a.json
test: Add tests for Keg#mach_o_files link behavior. Move dylib_path and bundle_path from test_mach to testing_env to accommodate the new tests. Closes #400. Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
Library/Homebrew/test/test_keg.rb
@@ -304,4 +304,35 @@ def test_removes_broken_symlinks_that_conflict_with_directories keg.unlink keg.uninstall end + + def test_mach_o_files_skips_hardlinks + a = HOMEBREW_CELLAR/"a/1.0" + (a/"lib").mkpath + FileUtils.cp dylib_path("i386"), a/"lib/i386.dylib" + FileUtils.ln a/"lib/i386.dylib", a/"lib/i386_link.dylib" + + keg = Keg.new(a) + keg.link + + assert_equal 1, keg.mach_o_files.size + ensure + keg.unlink + keg.uninstall + end + + def test_mach_o_files_isnt_confused_by_symlinks + a = HOMEBREW_CELLAR/"a/1.0" + (a/"lib").mkpath + FileUtils.cp dylib_path("i386"), a/"lib/i386.dylib" + FileUtils.ln a/"lib/i386.dylib", a/"lib/i386_link.dylib" + FileUtils.ln_s a/"lib/i386.dylib", a/"lib/1.dylib" + + keg = Keg.new(a) + keg.link + + assert_equal 1, keg.mach_o_files.size + ensure + keg.unlink + keg.uninstall + end end
true
Other
Homebrew
brew
cb3ad215b4fc011e3405e6e577b97819c683036a.json
test: Add tests for Keg#mach_o_files link behavior. Move dylib_path and bundle_path from test_mach to testing_env to accommodate the new tests. Closes #400. Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
Library/Homebrew/test/test_mach.rb
@@ -1,14 +1,6 @@ require "testing_env" class MachOPathnameTests < Homebrew::TestCase - def dylib_path(name) - Pathname.new("#{TEST_DIRECTORY}/mach/#{name}.dylib") - end - - def bundle_path(name) - Pathname.new("#{TEST_DIRECTORY}/mach/#{name}.bundle") - end - def test_fat_dylib pn = dylib_path("fat") assert_predicate pn, :universal?
true
Other
Homebrew
brew
cb3ad215b4fc011e3405e6e577b97819c683036a.json
test: Add tests for Keg#mach_o_files link behavior. Move dylib_path and bundle_path from test_mach to testing_env to accommodate the new tests. Closes #400. Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
Library/Homebrew/test/testing_env.rb
@@ -112,5 +112,13 @@ def refute_eql(exp, act, msg = nil) } refute exp.eql?(act), msg end + + def dylib_path(name) + Pathname.new("#{TEST_DIRECTORY}/mach/#{name}.dylib") + end + + def bundle_path(name) + Pathname.new("#{TEST_DIRECTORY}/mach/#{name}.bundle") + end end end
true
Other
Homebrew
brew
d3ef56425a6b4c190317c2527137b97c0ff5daf8.json
keg_relocate: Exclude hardlinks from mach_o_files.
Library/Homebrew/keg_relocate.rb
@@ -157,10 +157,15 @@ def find_dylib(bad_name) end def mach_o_files + hardlinks = Set.new mach_o_files = [] path.find do |pn| next if pn.symlink? || pn.directory? - mach_o_files << pn if pn.dylib? || pn.mach_o_bundle? || pn.mach_o_executable? + next unless pn.dylib? || pn.mach_o_bundle? || pn.mach_o_executable? + # if we've already processed a file, ignore its hardlinks (which have the same dev ID and inode) + # this prevents relocations from being performed on a binary more than once + next unless hardlinks.add? [pn.stat.dev, pn.stat.ino] + mach_o_files << pn end mach_o_files
false
Other
Homebrew
brew
cab97cf4d782ce36762f0cd615ca59718f55b0d5.json
Revert "keg_relocate: Exclude hardlinks from mach_o_files." This reverts commit 3e5e14a59580325faf397b48d62a52f0013a17f2.
Library/Homebrew/keg_relocate.rb
@@ -157,12 +157,8 @@ def find_dylib(bad_name) end def mach_o_files - hardlinks = Set.new mach_o_files = [] path.find do |pn| - # if we've already processed a file, ignore its hardlinks (which have the same dev ID and inode) - # this prevents relocations from being performed on a binary more than once - next unless hardlinks.add? [pn.stat.dev, pn.stat.ino] next if pn.symlink? || pn.directory? mach_o_files << pn if pn.dylib? || pn.mach_o_bundle? || pn.mach_o_executable? end
false
Other
Homebrew
brew
70ceb851a596c4f40ccfb448d543bb5eb5089b4a.json
Revert "test: Add test for Keg#mach_o_files hardlink behavior." This reverts commit 62d7079684cdb568600e22531c62888622a71ff1.
Library/Homebrew/test/test_keg.rb
@@ -304,19 +304,4 @@ def test_removes_broken_symlinks_that_conflict_with_directories keg.unlink keg.uninstall end - - def test_mach_o_files_skips_hardlinks - a = HOMEBREW_CELLAR.join("a", "1.0") - a.join("lib").mkpath - FileUtils.cp dylib_path("i386"), a.join("lib", "i386.dylib") - FileUtils.ln a.join("lib", "i386.dylib"), a.join("lib", "i386_link.dylib") - - keg = Keg.new(a) - keg.link - - assert_equal 1, keg.mach_o_files.size - ensure - keg.unlink - keg.uninstall - end end
true
Other
Homebrew
brew
70ceb851a596c4f40ccfb448d543bb5eb5089b4a.json
Revert "test: Add test for Keg#mach_o_files hardlink behavior." This reverts commit 62d7079684cdb568600e22531c62888622a71ff1.
Library/Homebrew/test/test_mach.rb
@@ -1,6 +1,14 @@ require "testing_env" class MachOPathnameTests < Homebrew::TestCase + def dylib_path(name) + Pathname.new("#{TEST_DIRECTORY}/mach/#{name}.dylib") + end + + def bundle_path(name) + Pathname.new("#{TEST_DIRECTORY}/mach/#{name}.bundle") + end + def test_fat_dylib pn = dylib_path("fat") assert_predicate pn, :universal?
true
Other
Homebrew
brew
70ceb851a596c4f40ccfb448d543bb5eb5089b4a.json
Revert "test: Add test for Keg#mach_o_files hardlink behavior." This reverts commit 62d7079684cdb568600e22531c62888622a71ff1.
Library/Homebrew/test/testing_env.rb
@@ -112,13 +112,5 @@ def refute_eql(exp, act, msg = nil) } refute exp.eql?(act), msg end - - def dylib_path(name) - Pathname.new("#{TEST_DIRECTORY}/mach/#{name}.dylib") - end - - def bundle_path(name) - Pathname.new("#{TEST_DIRECTORY}/mach/#{name}.bundle") - end end end
true
Other
Homebrew
brew
62d7079684cdb568600e22531c62888622a71ff1.json
test: Add test for Keg#mach_o_files hardlink behavior. Move dylib_path and bundle_path from test_mach to testing_env to accommodate the new test. Closes #400. Signed-off-by: Tim D. Smith <git@tim-smith.us>
Library/Homebrew/test/test_keg.rb
@@ -304,4 +304,19 @@ def test_removes_broken_symlinks_that_conflict_with_directories keg.unlink keg.uninstall end + + def test_mach_o_files_skips_hardlinks + a = HOMEBREW_CELLAR.join("a", "1.0") + a.join("lib").mkpath + FileUtils.cp dylib_path("i386"), a.join("lib", "i386.dylib") + FileUtils.ln a.join("lib", "i386.dylib"), a.join("lib", "i386_link.dylib") + + keg = Keg.new(a) + keg.link + + assert_equal 1, keg.mach_o_files.size + ensure + keg.unlink + keg.uninstall + end end
true
Other
Homebrew
brew
62d7079684cdb568600e22531c62888622a71ff1.json
test: Add test for Keg#mach_o_files hardlink behavior. Move dylib_path and bundle_path from test_mach to testing_env to accommodate the new test. Closes #400. Signed-off-by: Tim D. Smith <git@tim-smith.us>
Library/Homebrew/test/test_mach.rb
@@ -1,14 +1,6 @@ require "testing_env" class MachOPathnameTests < Homebrew::TestCase - def dylib_path(name) - Pathname.new("#{TEST_DIRECTORY}/mach/#{name}.dylib") - end - - def bundle_path(name) - Pathname.new("#{TEST_DIRECTORY}/mach/#{name}.bundle") - end - def test_fat_dylib pn = dylib_path("fat") assert_predicate pn, :universal?
true
Other
Homebrew
brew
62d7079684cdb568600e22531c62888622a71ff1.json
test: Add test for Keg#mach_o_files hardlink behavior. Move dylib_path and bundle_path from test_mach to testing_env to accommodate the new test. Closes #400. Signed-off-by: Tim D. Smith <git@tim-smith.us>
Library/Homebrew/test/testing_env.rb
@@ -112,5 +112,13 @@ def refute_eql(exp, act, msg = nil) } refute exp.eql?(act), msg end + + def dylib_path(name) + Pathname.new("#{TEST_DIRECTORY}/mach/#{name}.dylib") + end + + def bundle_path(name) + Pathname.new("#{TEST_DIRECTORY}/mach/#{name}.bundle") + end end end
true
Other
Homebrew
brew
3e5e14a59580325faf397b48d62a52f0013a17f2.json
keg_relocate: Exclude hardlinks from mach_o_files.
Library/Homebrew/keg_relocate.rb
@@ -157,8 +157,12 @@ def find_dylib(bad_name) end def mach_o_files + hardlinks = Set.new mach_o_files = [] path.find do |pn| + # if we've already processed a file, ignore its hardlinks (which have the same dev ID and inode) + # this prevents relocations from being performed on a binary more than once + next unless hardlinks.add? [pn.stat.dev, pn.stat.ino] next if pn.symlink? || pn.directory? mach_o_files << pn if pn.dylib? || pn.mach_o_bundle? || pn.mach_o_executable? end
false
Other
Homebrew
brew
6bd24a7fb806184d401ee98e1f8c82d97f813107.json
audit.rb: require https for ftpmirror.gnu.org (#393) * audit.rb: require https for ftpmirror.gnu.org The situation is similar to other mirror redirectors: the server may subsequently redirect to an insecure url. But it's a step. * manpage: update HOMEBREW_NO_INSECURE_REDIRECT section
Library/Homebrew/cmd/audit.rb
@@ -1135,12 +1135,7 @@ def audit_download_strategy def audit_urls # Check GNU urls; doesn't apply to mirrors if url =~ %r{^(?:https?|ftp)://(?!alpha).+/gnu/} - problem "Please use \"http://ftpmirror.gnu.org\" instead of #{url}." - end - - # GNU's ftpmirror does NOT support SSL/TLS. - if url =~ %r{^https://ftpmirror\.gnu\.org/} - problem "Please use http:// for #{url}" + problem "Please use \"https://ftpmirror.gnu.org\" instead of #{url}." end if mirrors.include?(url) @@ -1154,6 +1149,7 @@ def audit_urls urls.each do |p| case p when %r{^http://ftp\.gnu\.org/}, + %r{^http://ftpmirror\.gnu\.org/}, %r{^http://[^/]*\.apache\.org/}, %r{^http://code\.google\.com/}, %r{^http://fossies\.org/},
true
Other
Homebrew
brew
6bd24a7fb806184d401ee98e1f8c82d97f813107.json
audit.rb: require https for ftpmirror.gnu.org (#393) * audit.rb: require https for ftpmirror.gnu.org The situation is similar to other mirror redirectors: the server may subsequently redirect to an insecure url. But it's a step. * manpage: update HOMEBREW_NO_INSECURE_REDIRECT section
Library/Homebrew/manpages/brew.1.md.erb
@@ -180,8 +180,8 @@ can take several different forms: to insecure HTTP. While ensuring your downloads are fully secure, this is likely - to cause from-source Sourceforge & GNOME based formulae - to fail to download. + to cause from-source Sourceforge, some GNU & GNOME based + formulae to fail to download. * `HOMEBREW_NO_GITHUB_API`: If set, Homebrew will not use the GitHub API for e.g searches or
true
Other
Homebrew
brew
6bd24a7fb806184d401ee98e1f8c82d97f813107.json
audit.rb: require https for ftpmirror.gnu.org (#393) * audit.rb: require https for ftpmirror.gnu.org The situation is similar to other mirror redirectors: the server may subsequently redirect to an insecure url. But it's a step. * manpage: update HOMEBREW_NO_INSECURE_REDIRECT section
share/doc/homebrew/brew.1.html
@@ -561,7 +561,7 @@ <h2 id="ENVIRONMENT">ENVIRONMENT</h2> to insecure HTTP.</p> <p>While ensuring your downloads are fully secure, this is likely -to cause from-source Sourceforge &amp; GNOME based formulae +to cause from-source Sourceforge, some GNU &amp; GNOME based formulae to fail to download.</p></dd> <dt><code>HOMEBREW_NO_GITHUB_API</code></dt><dd><p>If set, Homebrew will not use the GitHub API for e.g searches or fetching relevant issues on a failed install.</p></dd>
true
Other
Homebrew
brew
6bd24a7fb806184d401ee98e1f8c82d97f813107.json
audit.rb: require https for ftpmirror.gnu.org (#393) * audit.rb: require https for ftpmirror.gnu.org The situation is similar to other mirror redirectors: the server may subsequently redirect to an insecure url. But it's a step. * manpage: update HOMEBREW_NO_INSECURE_REDIRECT section
share/man/man1/brew.1
@@ -783,7 +783,7 @@ If set, Homebrew will not print the \fBHOMEBREW_INSTALL_BADGE\fR on a successful If set, Homebrew will not permit redirects from secure HTTPS to insecure HTTP\. . .IP -While ensuring your downloads are fully secure, this is likely to cause from\-source Sourceforge & GNOME based formulae to fail to download\. +While ensuring your downloads are fully secure, this is likely to cause from\-source Sourceforge, some GNU & GNOME based formulae to fail to download\. . .TP \fBHOMEBREW_NO_GITHUB_API\fR
true
Other
Homebrew
brew
915eed4c6427271c5b4c01fa36239361c3680c40.json
update-report: remove unconditional cask/formula uninstall.
Library/Homebrew/cmd/update-report.rb
@@ -252,7 +252,6 @@ def migrate_tap_migration new_tap = Tap.fetch(new_tap_name) # For formulae migrated to cask: Auto-install cask or provide install instructions. if new_tap_name == "caskroom/cask" - system HOMEBREW_BREW_FILE, "uninstall", name if new_tap.installed? && (HOMEBREW_REPOSITORY/"Caskroom").directory? ohai "#{name} has been moved to Homebrew Cask. Installing #{name}..." system HOMEBREW_BREW_FILE, "uninstall", "--force", name @@ -261,7 +260,7 @@ def migrate_tap_migration ohai "#{name} has been moved to Homebrew Cask.", <<-EOS.undent To uninstall the formula and install the cask run: brew uninstall --force #{name} - brew cask install #{name} + brew cask install #{name} EOS end else
false
Other
Homebrew
brew
6dc72f2679208f34d9d09f547dda5a2ba0714a9f.json
boneyard-formula-pr: relax hub requirement Don't force installation of the `hub` formula if it can be found in the search path. (Avoids unnecessary installation when switching between multiple Homebrew installations for different tasks.) Closes #384. Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
Library/Homebrew/dev-cmd/boneyard-formula-pr.rb
@@ -60,7 +60,7 @@ def boneyard_formula_pr tap_migrations = tap_migrations.sort.inject({}) { |a, e| a.merge!(e[0] => e[1]) } tap_migrations_path.atomic_write(JSON.pretty_generate(tap_migrations) + "\n") end - unless Formula["hub"].any_version_installed? || local_only + unless which("hub") || local_only if ARGV.dry_run? puts "brew install hub" else
false
Other
Homebrew
brew
3b3da02cf35103d490459508aaa827b7995aa0c6.json
boneyard-formula-pr: fix local branch creation In local-only mode, the created branches end up tracking `origin/master` which isn't desirable.
Library/Homebrew/dev-cmd/boneyard-formula-pr.rb
@@ -70,7 +70,7 @@ def boneyard_formula_pr branch = "#{formula.name}-boneyard" if ARGV.dry_run? puts "cd #{formula.tap.path}" - puts "git checkout -b #{branch} origin/master" + puts "git checkout --no-track -b #{branch} origin/master" puts "git commit --no-edit --verbose --message=\"#{formula.name}: migrate to boneyard\" -- #{formula_relpath} #{tap_migrations_path.basename}" unless local_only @@ -82,7 +82,7 @@ def boneyard_formula_pr end else cd formula.tap.path - safe_system "git", "checkout", "-b", branch, "origin/master" + safe_system "git", "checkout", "--no-track", "-b", branch, "origin/master" safe_system "git", "commit", "--no-edit", "--verbose", "--message=#{formula.name}: migrate to boneyard", "--", formula_relpath, tap_migrations_path.basename @@ -104,7 +104,7 @@ def boneyard_formula_pr if ARGV.dry_run? puts "cd #{boneyard_tap.path}" - puts "git checkout -b #{branch} origin/master" + puts "git checkout --no-track -b #{branch} origin/master" if bottle_block puts "Removing bottle block" else @@ -122,7 +122,7 @@ def boneyard_formula_pr end else cd boneyard_tap.formula_dir - safe_system "git", "checkout", "-b", branch, "origin/master" + safe_system "git", "checkout", "--no-track", "-b", branch, "origin/master" if bottle_block Utils::Inreplace.inreplace formula_file, / bottle do.+?end\n\n/m, "" end
false
Other
Homebrew
brew
806cfeee189bb6e08209186c46e21e84777b78df.json
linkage: simplify display logic Move check for emptiness into the display method, avoiding repetitive checks on the call site. Closes #381. Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
Library/Homebrew/dev-cmd/linkage.rb
@@ -77,36 +77,24 @@ def check_dylibs end def display_normal_output - unless @system_dylibs.empty? - display_items "System libraries", @system_dylibs - end - unless @brewed_dylibs.empty? - display_items "Homebrew libraries", @brewed_dylibs - end - unless @variable_dylibs.empty? - display_items "Variable-referenced libraries", @variable_dylibs - end - unless @broken_dylibs.empty? - display_items "Missing libraries", @broken_dylibs - end - unless @undeclared_deps.empty? - display_items "Possible undeclared dependencies", @undeclared_deps - end + display_items "System libraries", @system_dylibs + display_items "Homebrew libraries", @brewed_dylibs + display_items "Variable-referenced libraries", @variable_dylibs + display_items "Missing libraries", @broken_dylibs + display_items "Possible undeclared dependencies", @undeclared_deps end def display_test_output - if @broken_dylibs.empty? - puts "No broken dylib links" - else - display_items "Missing libraries", @broken_dylibs - end + display_items "Missing libraries", @broken_dylibs + puts "No broken dylib links" if @broken_dylibs.empty? end private # Display a list of things. # Things may either be an array, or a hash of (label -> array) def display_items(label, things) + return if things.empty? puts "#{label}:" if things.is_a? Hash things.sort.each do |list_label, list|
false
Other
Homebrew
brew
af94c4fc50384924752bc917f6a56b28f257500f.json
pull: skip non-ruby files when collecting formulae names Closes #377. Signed-off-by: Baptiste Fontaine <b@ptistefontaine.fr>
Library/Homebrew/cmd/pull.rb
@@ -113,21 +113,23 @@ def pull "git", "diff-tree", "-r", "--name-only", "--diff-filter=AM", orig_revision, "HEAD", "--", tap.formula_dir.to_s ).each_line do |line| + next unless line.end_with? ".rb\n" name = "#{tap.name}/#{File.basename(line.chomp, ".rb")}" - begin - changed_formulae_names << name - # Make sure we catch syntax errors. - rescue Exception - next - end + changed_formulae_names << name end end fetch_bottles = false changed_formulae_names.each do |name| next if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"] - f = Formula[name] + begin + f = Formula[name] + # Make sure we catch syntax errors. + rescue Exception + next + end + if ARGV.include? "--bottle" if f.bottle_unneeded? ohai "#{f}: skipping unneeded bottle."
false
Other
Homebrew
brew
d7b6e9bba92ccc5884dcb9dd0859d16e2bf3fe9c.json
config: expose used Git version and path Due to our SCM wrapper in `Library/ENV/scm/git`, lookup is a bit more complicated than just picking the first match in `PATH`. Make debugging easier by printing the version and path of the Git actually used by us.
Library/Homebrew/system_config.rb
@@ -107,6 +107,11 @@ def describe_java javas.uniq.join(", ") end + def describe_git + return "N/A" unless Utils.git_available? + "#{Utils.git_version} => #{Utils.git_path}" + end + def dump_verbose_config(f = $stdout) f.puts "HOMEBREW_VERSION: #{HOMEBREW_VERSION}" f.puts "ORIGIN: #{origin}" @@ -127,6 +132,7 @@ def dump_verbose_config(f = $stdout) f.puts "GCC-4.0: build #{gcc_40}" if gcc_40 f.puts "GCC-4.2: build #{gcc_42}" if gcc_42 f.puts "Clang: #{clang ? "#{clang} build #{clang_build}" : "N/A"}" + f.puts "Git: #{describe_git}" f.puts "Perl: #{describe_perl}" f.puts "Python: #{describe_python}" f.puts "Ruby: #{describe_ruby}"
false
Other
Homebrew
brew
324a34d8ea8f931dd336dd667bbcdd2531cd3c22.json
utils/git: provide git_path and git_version
Library/Homebrew/utils/git.rb
@@ -4,6 +4,20 @@ def self.git_available? @git = quiet_system HOMEBREW_ENV_PATH/"scm/git", "--version" end + def self.git_path + return unless git_available? + @git_path ||= Utils.popen_read( + HOMEBREW_ENV_PATH/"scm/git", "--homebrew=print-path" + ).chuzzle + end + + def self.git_version + return unless git_available? + @git_version ||= Utils.popen_read( + HOMEBREW_ENV_PATH/"scm/git", "--version" + ).chomp[/git version (\d+(?:\.\d+)*)/, 1] + end + def self.ensure_git_installed! return if git_available? @@ -25,5 +39,7 @@ def self.ensure_git_installed! def self.clear_git_available_cache remove_instance_variable(:@git) if instance_variable_defined?(:@git) + @git_path = nil + @git_version = nil end end
false
Other
Homebrew
brew
a8165b6dbd9837c0ba3c8a0fa368e80aaf5a5dd9.json
scm/git: allow introspecting path lookup Print path of first detected Git instead of executing it. This is hidden behind a `--homebrew=print-path` argument that is unlikely to conflict with any existing or future Git flags.
Library/ENV/scm/git
@@ -23,6 +23,10 @@ def exec(*args) # prevent fork-bombs arg0 = args.first return if arg0 =~ /^#{F}/i || Pathname.new(arg0).realpath == SELF_REAL + if ARGV == %w[--homebrew=print-path] + puts arg0 + exit + end super end
false
Other
Homebrew
brew
96cbce015e0b327bd7d30fc101cbd25452cd2fd8.json
bump-formula-pr: remove formula revision If we're bumping the formula's stable version, then we also must reset the formula revision to zero. Note that if and only if a revision is being removed, this commit will enforce the convention that there should be a blank line before a simple head spec if and only if there is a formula revision. Any preexisting violation of the convention (in particular, a blank line before a simple head spec in the absence of a formula revision) won't be proactively corrected since we'd not be removing a formula revision in that case. Closes #369. Signed-off-by: ilovezfs <ilovezfs@icloud.com>
Library/Homebrew/dev-cmd/bump-formula-pr.rb
@@ -20,7 +20,9 @@ def inreplace_pairs(path, replacement_pairs) contents = path.open("r") { |f| Formulary.set_encoding(f).read } contents.extend(StringInreplaceExtension) replacement_pairs.each do |old, new| - ohai "replace \"#{old}\" with \"#{new}\"" unless ARGV.flag?("--quiet") + unless ARGV.flag?("--quiet") + ohai "replace #{old.inspect} with #{new.inspect}" + end contents.gsub!(old, new) end if contents.errors.any? @@ -30,7 +32,9 @@ def inreplace_pairs(path, replacement_pairs) else Utils::Inreplace.inreplace(path) do |s| replacement_pairs.each do |old, new| - ohai "replace \"#{old}\" with \"#{new}\"" unless ARGV.flag?("--quiet") + unless ARGV.flag?("--quiet") + ohai "replace #{old.inspect} with #{new.inspect}" + end s.gsub!(old, new) end end @@ -86,7 +90,12 @@ def bump_formula_pr old_formula_version = formula_version(formula, requested_spec) - replacement_pairs = if new_url_hash + replacement_pairs = [] + if requested_spec == :stable && formula.revision != 0 + replacement_pairs << [/^ revision \d+\n(\n( head "))?/m, "\\2"] + end + + replacement_pairs += if new_url_hash [ [formula_spec.url, new_url], [old_hash, new_hash],
false
Other
Homebrew
brew
cc0ca73183f1e92579169eb038b10a98bd7c455a.json
bump-formula-pr: reflect new version in dry-run - simulate version change for dry-run - make sure we're using :devel version if called with --devel Closes #318. Signed-off-by: ilovezfs <ilovezfs@icloud.com>
Library/Homebrew/dev-cmd/bump-formula-pr.rb
@@ -15,6 +15,39 @@ require "formula" module Homebrew + def inreplace_pairs(path, replacement_pairs) + if ARGV.dry_run? + contents = path.open("r") { |f| Formulary.set_encoding(f).read } + contents.extend(StringInreplaceExtension) + replacement_pairs.each do |old, new| + ohai "replace \"#{old}\" with \"#{new}\"" unless ARGV.flag?("--quiet") + contents.gsub!(old, new) + end + if contents.errors.any? + raise Utils::InreplaceError, path => contents.errors + end + contents + else + Utils::Inreplace.inreplace(path) do |s| + replacement_pairs.each do |old, new| + ohai "replace \"#{old}\" with \"#{new}\"" unless ARGV.flag?("--quiet") + s.gsub!(old, new) + end + end + path.open("r") { |f| Formulary.set_encoding(f).read } + end + end + + def formula_version(formula, spec, contents = nil) + name = formula.name + path = formula.path + if contents + Formulary.from_contents(name, path, contents, spec).version + else + Formulary::FormulaLoader.new(name, path).get_formula(spec).version + end + end + def bump_formula_pr formula = ARGV.formulae.first odie "No formula found!" unless formula @@ -51,32 +84,35 @@ def bump_formula_pr safe_system "brew", "update" end - Utils::Inreplace.inreplace(formula.path) do |s| - if new_url_hash - old_url = formula_spec.url - if ARGV.dry_run? - ohai "replace '#{old_url}' with '#{new_url}'" - ohai "replace '#{old_hash}' with '#{new_hash}'" - else - s.gsub!(old_url, new_url) - s.gsub!(old_hash, new_hash) - end - else - resource_specs = formula_spec.specs - old_tag = resource_specs[:tag] - old_revision = resource_specs[:revision] - if ARGV.dry_run? - ohai "replace '#{old_tag}' with '#{new_tag}'" - ohai "replace '#{old_revision}' with '#{new_revision}'" - else - s.gsub!(/['"]#{old_tag}['"]/, "\"#{new_tag}\"") - s.gsub!(old_revision, new_revision) - end - end + old_formula_version = formula_version(formula, requested_spec) + + replacement_pairs = if new_url_hash + [ + [formula_spec.url, new_url], + [old_hash, new_hash], + ] + else + [ + [formula_spec.specs[:tag], new_tag], + [formula_spec.specs[:revision], new_revision], + ] end - new_formula = Formulary.load_formula_from_path(formula.name, formula.path) - new_formula_version = new_formula.version + new_contents = inreplace_pairs(formula.path, replacement_pairs) + + new_formula_version = formula_version(formula, requested_spec, new_contents) + + if new_formula_version < old_formula_version + odie <<-EOS.undent + You probably need to bump this formula manually since changing the + version from #{old_formula_version} to #{new_formula_version} would be a downgrade. + EOS + elsif new_formula_version == old_formula_version + odie <<-EOS.undent + You probably need to bump this formula manually since the new version + and old version are both #{new_formula_version}. + EOS + end unless Formula["hub"].any_version_installed? if ARGV.dry_run?
false
Other
Homebrew
brew
cc10c632a8c2803b7e62a37c9490beca8fb48128.json
macOS Sierra: add pkg-config files
Library/ENV/pkgconfig/10.12/libcurl.pc
@@ -0,0 +1,39 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 2004 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### + +# This should most probably benefit from getting a "Requires:" field added +# dynamically by configure. +# +prefix=/usr +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include +supported_protocols="DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP LDAPS POP3 POP3S RTSP SMB SMBS SMTP SMTPS TELNET TFTP" +supported_features="Largefile Kerberos SPNEGO SSL IPv6 libz AsynchDNS NTLM NTLM_WB GSS-API UnixSockets" + +Name: libcurl +URL: https://curl.haxx.se/ +Description: Library to transfer files with ftp, http, etc. +Version: 7.43.0 +Libs: -L${libdir} -lcurl +Libs.private: -lssl -lcrypto -Wl,-weak-lldap -Wl,-weak-lgssapi_krb5 -lresolv -lssl -lcrypto -lz -lz +Cflags: -I${includedir}
true
Other
Homebrew
brew
cc10c632a8c2803b7e62a37c9490beca8fb48128.json
macOS Sierra: add pkg-config files
Library/ENV/pkgconfig/10.12/libexslt.pc
@@ -0,0 +1,12 @@ +prefix=/usr +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + + +Name: libexslt +Version: 0.8.17 +Description: EXSLT Extension library +Requires: libxml-2.0 +Libs: -L${libdir} -lexslt -lxslt -lxml2 -lz -lpthread -licucore -lm +Cflags: -I${includedir}
true
Other
Homebrew
brew
cc10c632a8c2803b7e62a37c9490beca8fb48128.json
macOS Sierra: add pkg-config files
Library/ENV/pkgconfig/10.12/libxml-2.0.pc
@@ -0,0 +1,13 @@ +prefix=/usr +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include +modules=1 + +Name: libXML +Version: 2.9.3 +Description: libXML library version2. +Requires: +Libs: -L${libdir} -lxml2 +Libs.private: -lpthread -lz -lm +Cflags: -I${includedir}/libxml2
true
Other
Homebrew
brew
cc10c632a8c2803b7e62a37c9490beca8fb48128.json
macOS Sierra: add pkg-config files
Library/ENV/pkgconfig/10.12/libxslt.pc
@@ -0,0 +1,12 @@ +prefix=/usr +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + + +Name: libxslt +Version: 1.1.28 +Description: XSLT library version 2. +Requires: libxml-2.0 +Libs: -L${libdir} -lxslt -lxml2 -lz -lpthread -licucore -lm +Cflags: -I${includedir}
true
Other
Homebrew
brew
cc10c632a8c2803b7e62a37c9490beca8fb48128.json
macOS Sierra: add pkg-config files
Library/ENV/pkgconfig/10.12/sqlite3.pc
@@ -0,0 +1,11 @@ +prefix=/usr +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: SQLite +Description: SQL database engine +Version: 3.13.0 +Libs: -L${libdir} -lsqlite3 +Libs.private: +Cflags: -I${includedir}
true
Other
Homebrew
brew
cc10c632a8c2803b7e62a37c9490beca8fb48128.json
macOS Sierra: add pkg-config files
Library/ENV/pkgconfig/10.12/zlib.pc
@@ -0,0 +1,13 @@ +prefix=/usr +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +sharedlibdir=${libdir} +includedir=${prefix}/include + +Name: zlib +Description: zlib compression library +Version: 1.2.5 + +Requires: +Libs: -L${libdir} -L${sharedlibdir} -lz +Cflags: -I${includedir}
true
Other
Homebrew
brew
7727c7764c9941bbe78c342dbe5b3c1a57ac5cd6.json
hardware: prettify config output on 6/8-core CPUs (#313)
Library/Homebrew/hardware.rb
@@ -55,6 +55,8 @@ def self.cores_as_words when 1 then "single" when 2 then "dual" when 4 then "quad" + when 6 then "hexa" + when 8 then "octa" else Hardware::CPU.cores end
false
Other
Homebrew
brew
8a70b000e55dbeadf2372b1c75360ca837219605.json
tests: fix problems in 'log with formula' test (#350) Problems fixed: - Broken and leaking test if run as part of `brew tests --coverage` due to the `cmd` call being nested in the `Pathname#cd` block. - Output during `git clone` operation because of a missing `shutup do`. - Still incomplete coverage for `cmd/log.rb` because `brew log` is invoked on the formula in the origin instead of the shallow clone. - Minor stylistic fixes: - Superfluous parentheses around `core_tap.path.dirname`. - Overly long lines.
Library/Homebrew/test/test_integration_cmds.rb
@@ -717,19 +717,20 @@ class Testball < Formula end end - homebrew_core_clone = Pathname.new core_tap.path.dirname/"homebrew-core-clone" - shallow = Pathname.new homebrew_core_clone/".git/shallow" - - (core_tap.path.dirname).cd do - system "git", "clone", "--depth=1", "file://#{core_tap.path}", "homebrew-core-clone" - - assert_match "This is a test commit for Testball", cmd("log", "testball") - assert_predicate shallow, :exist?, "A shallow clone should have been created." + core_tap_url = "file://#{core_tap.path}" + shallow_tap = Tap.fetch("homebrew", "shallow") + shutup do + system "git", "clone", "--depth=1", core_tap_url, shallow_tap.path end + + assert_match "This is a test commit for Testball", + cmd("log", "#{shallow_tap}/testball") + assert_predicate shallow_tap.path/".git/shallow", :exist?, + "A shallow clone should have been created." ensure formula_file.unlink (core_tap.path/".git").rmtree - (core_tap.path.dirname/"homebrew-core-clone").rmtree + shallow_tap.path.rmtree end def test_leaves
false
Other
Homebrew
brew
86538c9d6ac6fb898a6b2bba30239acc5eabf96c.json
tests: simplify SimpleCov configuration (#348) There is no good reason to configure the options specific to integration tests in a completely different location from all other options.
Library/Homebrew/test/.simplecov
@@ -13,9 +13,17 @@ SimpleCov.start do add_filter "Homebrew/vendor/" add_filter "Taps/" - # Not using this during integration tests makes the tests 4x times faster - # without changing the coverage. - unless ENV["HOMEBREW_INTEGRATION_TEST"] + if ENV["HOMEBREW_INTEGRATION_TEST"] + command_name ENV["HOMEBREW_INTEGRATION_TEST"] + at_exit do + exit_code = $!.nil? ? 0 : $!.status + $stdout.reopen("/dev/null") + SimpleCov.result # Just save result, but don't write formatted output. + exit! exit_code + end + else + # Not using this during integration tests makes the tests 4x times faster + # without changing the coverage. track_files "#{SimpleCov.root}/**/*.rb" end @@ -33,16 +41,6 @@ SimpleCov.start do ] end -if ENV["HOMEBREW_INTEGRATION_TEST"] - SimpleCov.command_name ENV["HOMEBREW_INTEGRATION_TEST"] - SimpleCov.at_exit do - exit_code = $!.nil? ? 0 : $!.status - $stdout.reopen("/dev/null") - SimpleCov.result # Just save result, but don't write formatted output. - exit! exit_code - end -end - # Don't use Coveralls outside of CI, as it will override SimpleCov's default # formatter causing the `index.html` not to be written once all tests finish. if RUBY_VERSION.split(".").first.to_i >= 2 && !ENV["HOMEBREW_INTEGRATION_TEST"] && ENV["CI"]
false
Other
Homebrew
brew
92f51abf597db6323bbc3ffa6eac99fb22336f32.json
tests: avoid compat code in --no-compat mode (#347) Simply drop because the `require`s are not actually used by the tests and no file from `compat/` should be loaded unconditionally. (This can otherwise lead to incorrect results for `brew tests --no-compat`.)
Library/Homebrew/test/test_formula_installer.rb
@@ -1,6 +1,5 @@ require "testing_env" require "formula" -require "compat/formula_specialties" require "formula_installer" require "keg" require "tab"
true
Other
Homebrew
brew
92f51abf597db6323bbc3ffa6eac99fb22336f32.json
tests: avoid compat code in --no-compat mode (#347) Simply drop because the `require`s are not actually used by the tests and no file from `compat/` should be loaded unconditionally. (This can otherwise lead to incorrect results for `brew tests --no-compat`.)
Library/Homebrew/test/test_formula_installer_bottle.rb
@@ -1,6 +1,5 @@ require "testing_env" require "formula" -require "compat/formula_specialties" require "formula_installer" require "keg" require "tab"
true
Other
Homebrew
brew
01b514f57a01293c770b6dc63b17c838ff34ce0c.json
tests: add test bottle for Sierra Fixes: ``` 1) Error: FormularyFactoryTest#test_factory_from_bottle: Errno::ENOENT: No such file or directory - /usr/local/Library/Homebrew/test/bottles/testball_bottle-0.1.sierra.bottle.tar.gz /usr/local/Library/Homebrew/formulary.rb:98:in `realpath' /usr/local/Library/Homebrew/formulary.rb:98:in `realpath' /usr/local/Library/Homebrew/formulary.rb:98:in `initialize' /usr/local/Library/Homebrew/formulary.rb:274:in `new' /usr/local/Library/Homebrew/formulary.rb:274:in `loader_for' /usr/local/Library/Homebrew/formulary.rb:215:in `factory' /usr/local/Library/Homebrew/test/test_formulary.rb:79:in `test_factory_from_bottle' ``` Closes #358. Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
Library/Homebrew/test/bottles/testball_bottle-0.1.sierra.bottle.tar.gz
@@ -0,0 +1 @@ +testball_bottle-0.1.yosemite.bottle.tar.gz \ No newline at end of file
false
Other
Homebrew
brew
425eedf43e7e6171f18e42f1d43c400bea3b0d02.json
xcode: expect 8.0 on macOS 10.12 Closes #357. Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
Library/Homebrew/os/mac/xcode.rb
@@ -16,10 +16,11 @@ def latest_version when "10.9" then "6.2" when "10.10" then "7.2.1" when "10.11" then "7.3.1" + when "10.12" then "8.0" else # Default to newest known version of Xcode for unreleased OSX versions. if OS::Mac.prerelease? - "7.3.1" + "8.0" else raise "OS X '#{MacOS.version}' is invalid" end @@ -123,7 +124,8 @@ def uncached_version when 61 then "6.1" when 70 then "7.0" when 73 then "7.3" - else "7.3" + when 80 then "8.0" + else "8.0" end end @@ -161,6 +163,7 @@ def installed? def latest_version case MacOS.version + when "10.12" then "800.0.24.1" when "10.11" then "703.0.31" when "10.10" then "700.1.81" when "10.9" then "600.0.57"
false
Other
Homebrew
brew
1c46db9a73e6d0fa56d0a83db2ed04a1d62837b4.json
os/mac/version: add macOS Sierra. (#353)
Library/Homebrew/os/mac/version.rb
@@ -4,6 +4,7 @@ module OS module Mac class Version < ::Version SYMBOLS = { + :sierra => "10.12", :el_capitan => "10.11", :yosemite => "10.10", :mavericks => "10.9",
false
Other
Homebrew
brew
e9cc2a5d88da6d1719763a26c1fc455c51e2c3db.json
Add "build_dependencies" key to JSON output (#340) This gives the JSON output the same type of information as `recommended_dependencies` or `optional_dependencies`, but for those marked `:build` in the formula.
Library/Homebrew/formula.rb
@@ -1256,6 +1256,7 @@ def to_hash "dependencies" => deps.map(&:name).uniq, "recommended_dependencies" => deps.select(&:recommended?).map(&:name).uniq, "optional_dependencies" => deps.select(&:optional?).map(&:name).uniq, + "build_dependencies" => deps.select(&:build?).map(&:name).uniq, "conflicts_with" => conflicts.map(&:name), "caveats" => caveats }
false
Other
Homebrew
brew
11d47e8325f50ab7993f3fca0432876da0ea1c11.json
boneyard-formula-pr: add new command. Add a new developer command (i.e., requires `HOMEBREW_DEVELOPER` set in your environment) to "boneyard" a formula, by creating one pull request removing the formula from its current tap and updating (or creating) tap_migrations.json, and another pull request importing the formula into homebrew/boneyard with any bottle block removed. Closes #53. Signed-off-by: ilovezfs <ilovezfs@icloud.com>
Library/Homebrew/dev-cmd/boneyard-formula-pr.rb
@@ -0,0 +1,136 @@ +# Creates a pull request to boneyard a formula. +# +# Usage: brew boneyard-formula-pr [options...] <formula-name> +# +# Options: +# --dry-run: Print what would be done rather than doing it. + +require "formula" +require "utils/json" +require "fileutils" + +begin + require "json" +rescue LoadError + puts "Homebrew does not provide Ruby dependencies; install with:" + puts " gem install json" + odie "Dependency json is not installed." +end + +module Homebrew + def boneyard_formula_pr + formula = ARGV.formulae.first + odie "No formula found!" unless formula + + formula_relpath = formula.path.relative_path_from(formula.tap.path) + formula_file = "#{formula.name}.rb" + bottle_block = File.read(formula.path).include? " bottle do" + boneyard_tap = Tap.fetch("homebrew", "boneyard") + tap_migrations_path = formula.tap.path/"tap_migrations.json" + if ARGV.dry_run? + puts "brew update" + puts "brew tap #{boneyard_tap.name}" + puts "cd #{formula.tap.path}" + cd formula.tap.path + puts "cp #{formula_relpath} #{boneyard_tap.path}" + puts "git rm #{formula_relpath}" + unless File.exist? tap_migrations_path + puts "Creating tap_migrations.json for #{formula.tap.name}" + puts "git add #{tap_migrations_path}" + end + puts "Loading tap_migrations.json" + puts "Adding #{formula.name} to tap_migrations.json" + else + safe_system HOMEBREW_BREW_FILE, "update" + safe_system HOMEBREW_BREW_FILE, "tap", boneyard_tap.name + cd formula.tap.path + cp formula_relpath, boneyard_tap.formula_dir + safe_system "git", "rm", formula_relpath + unless File.exist? tap_migrations_path + tap_migrations_path.write <<-EOS.undent + { + } + EOS + safe_system "git", "add", tap_migrations_path + end + tap_migrations = Utils::JSON.load(File.read(tap_migrations_path)) + tap_migrations[formula.name] = boneyard_tap.name + tap_migrations = tap_migrations.sort.inject({}) { |a, e| a.merge!(e[0] => e[1]) } + tap_migrations_path.atomic_write(JSON.pretty_generate(tap_migrations) + "\n") + end + unless Formula["hub"].any_version_installed? + if ARGV.dry_run? + puts "brew install hub" + else + safe_system HOMEBREW_BREW_FILE, "install", "hub" + end + end + branch = "#{formula.name}-boneyard" + if ARGV.dry_run? + puts "cd #{formula.tap.path}" + puts "git checkout -b #{branch} origin/master" + puts "git commit --no-edit --verbose --message=\"#{formula.name}: migrate to boneyard\" -- #{formula_relpath} #{tap_migrations_path.basename}" + puts "hub fork --no-remote" + puts "hub fork" + puts "hub fork (to read $HUB_REMOTE)" + puts "git push $HUB_REMOTE #{branch}:#{branch}" + puts "hub pull-request -m $'#{formula.name}: migrate to boneyard\\n\\nCreated with `brew boneyard-formula-pr`.'" + else + cd formula.tap.path + safe_system "git", "checkout", "-b", branch, "origin/master" + safe_system "git", "commit", "--no-edit", "--verbose", + "--message=#{formula.name}: migrate to boneyard", + "--", formula_relpath, tap_migrations_path.basename + safe_system "hub", "fork", "--no-remote" + quiet_system "hub", "fork" + remote = Utils.popen_read("hub fork 2>&1")[/fatal: remote (.+) already exists./, 1] + odie "cannot get remote from 'hub'!" unless remote + safe_system "git", "push", remote, "#{branch}:#{branch}" + pr_message = <<-EOS.undent + #{formula.name}: migrate to boneyard + + Created with `brew boneyard-formula-pr`. + EOS + pr_url = Utils.popen_read("hub", "pull-request", "-m", pr_message).chomp + end + + if ARGV.dry_run? + puts "cd #{boneyard_tap.path}" + puts "git checkout -b #{branch} origin/master" + if bottle_block + puts "Removing bottle block" + else + puts "No bottle block to remove" + end + puts "git add #{formula_file}" + puts "git commit --no-edit --verbose --message=\"#{formula.name}: migrate from #{formula.tap.repo}\" -- #{formula_file}" + puts "hub fork --no-remote" + puts "hub fork" + puts "hub fork (to read $HUB_REMOTE)" + puts "git push $HUB_REMOTE #{branch}:#{branch}" + puts "hub pull-request --browse -m $'#{formula.name}: migrate from #{formula.tap.repo}\\n\\nGoes together with $PR_URL\\n\\nCreated with `brew boneyard-formula-pr`.'" + else + cd boneyard_tap.formula_dir + safe_system "git", "checkout", "-b", branch, "origin/master" + if bottle_block + Utils::Inreplace.inreplace formula_file, / bottle do.+?end\n\n/m, "" + end + safe_system "git", "add", formula_file + safe_system "git", "commit", "--no-edit", "--verbose", + "--message=#{formula.name}: migrate from #{formula.tap.repo}", + "--", formula_file + safe_system "hub", "fork", "--no-remote" + quiet_system "hub", "fork" + remote = Utils.popen_read("hub fork 2>&1")[/fatal: remote (.+) already exists./, 1] + odie "cannot get remote from 'hub'!" unless remote + safe_system "git", "push", remote, "#{branch}:#{branch}" + safe_system "hub", "pull-request", "--browse", "-m", <<-EOS.undent + #{formula.name}: migrate from #{formula.tap.repo} + + Goes together with #{pr_url}. + + Created with `brew boneyard-formula-pr`. + EOS + end + end +end
false
Other
Homebrew
brew
8d64b6a02d78811f50d5f747ce10df09d54b4791.json
introduce global lock directory (#337) Since #292, HOMEBREW_CACHE was moved to a per-user directory. This makes it unsuitable to store global lock files on multiple users environment. Therefore, introducing a global lock directory `/Library/Lock.d` to store lock files from formula lockers as well as `brew update`.
.gitignore
@@ -15,6 +15,7 @@ /Library/Homebrew/test/coverage /Library/Homebrew/test/fs_leak_log /Library/LinkedKegs +/Library/Locks /Library/PinnedKegs /Library/PinnedTaps /Library/Taps
true
Other
Homebrew
brew
8d64b6a02d78811f50d5f747ce10df09d54b4791.json
introduce global lock directory (#337) Since #292, HOMEBREW_CACHE was moved to a per-user directory. This makes it unsuitable to store global lock files on multiple users environment. Therefore, introducing a global lock directory `/Library/Lock.d` to store lock files from formula lockers as well as `brew update`.
Library/Homebrew/cleanup.rb
@@ -106,9 +106,9 @@ def self.cleanup_path(path) end def self.cleanup_lockfiles - return unless HOMEBREW_CACHE_FORMULA.directory? - candidates = HOMEBREW_CACHE_FORMULA.children - lockfiles = candidates.select { |f| f.file? && f.extname == ".brewing" } + return unless HOMEBREW_LOCK_DIR.directory? + candidates = HOMEBREW_LOCK_DIR.children + lockfiles = candidates.select(&:file?) lockfiles.each do |file| next unless file.readable? file.open.flock(File::LOCK_EX | File::LOCK_NB) && file.unlink
true
Other
Homebrew
brew
8d64b6a02d78811f50d5f747ce10df09d54b4791.json
introduce global lock directory (#337) Since #292, HOMEBREW_CACHE was moved to a per-user directory. This makes it unsuitable to store global lock files on multiple users environment. Therefore, introducing a global lock directory `/Library/Lock.d` to store lock files from formula lockers as well as `brew update`.
Library/Homebrew/config.rb
@@ -1,7 +1,7 @@ HOMEBREW_CACHE = Pathname.new(ENV["HOMEBREW_CACHE"] || "~/Library/Caches/Homebrew").expand_path # Where brews installed via URL are cached -HOMEBREW_CACHE_FORMULA = HOMEBREW_CACHE+"Formula" +HOMEBREW_CACHE_FORMULA = HOMEBREW_CACHE/"Formula" if ENV["HOMEBREW_BREW_FILE"] HOMEBREW_BREW_FILE = Pathname.new(ENV["HOMEBREW_BREW_FILE"]) @@ -19,6 +19,9 @@ HOMEBREW_ENV_PATH = HOMEBREW_LIBRARY/"ENV" HOMEBREW_CONTRIB = HOMEBREW_REPOSITORY/"Library/Contributions" +# Where we store lock files +HOMEBREW_LOCK_DIR = HOMEBREW_LIBRARY/"Locks" + # Where we store built products HOMEBREW_CELLAR = Pathname.new(ENV["HOMEBREW_CELLAR"])
true
Other
Homebrew
brew
8d64b6a02d78811f50d5f747ce10df09d54b4791.json
introduce global lock directory (#337) Since #292, HOMEBREW_CACHE was moved to a per-user directory. This makes it unsuitable to store global lock files on multiple users environment. Therefore, introducing a global lock directory `/Library/Lock.d` to store lock files from formula lockers as well as `brew update`.
Library/Homebrew/formula_lock.rb
@@ -1,7 +1,7 @@ require "fcntl" class FormulaLock - LOCKDIR = HOMEBREW_CACHE_FORMULA + LOCKDIR = HOMEBREW_LOCK_DIR def initialize(name) @name = name
true
Other
Homebrew
brew
8d64b6a02d78811f50d5f747ce10df09d54b4791.json
introduce global lock directory (#337) Since #292, HOMEBREW_CACHE was moved to a per-user directory. This makes it unsuitable to store global lock files on multiple users environment. Therefore, introducing a global lock directory `/Library/Lock.d` to store lock files from formula lockers as well as `brew update`.
Library/Homebrew/test/lib/config.rb
@@ -18,6 +18,7 @@ HOMEBREW_LOAD_PATH = [File.expand_path("..", __FILE__), HOMEBREW_LIBRARY_PATH].join(":") HOMEBREW_CACHE = HOMEBREW_PREFIX.parent+"cache" HOMEBREW_CACHE_FORMULA = HOMEBREW_PREFIX.parent+"formula_cache" +HOMEBREW_LOCK_DIR = HOMEBREW_PREFIX.parent+"locks" HOMEBREW_CELLAR = HOMEBREW_PREFIX.parent+"cellar" HOMEBREW_LOGS = HOMEBREW_PREFIX.parent+"logs"
true
Other
Homebrew
brew
8d64b6a02d78811f50d5f747ce10df09d54b4791.json
introduce global lock directory (#337) Since #292, HOMEBREW_CACHE was moved to a per-user directory. This makes it unsuitable to store global lock files on multiple users environment. Therefore, introducing a global lock directory `/Library/Lock.d` to store lock files from formula lockers as well as `brew update`.
Library/Homebrew/test/testing_env.rb
@@ -7,7 +7,7 @@ # Test environment setup (HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-core/Formula").mkpath -%w[cache formula_cache cellar logs].each { |d| HOMEBREW_PREFIX.parent.join(d).mkpath } +%w[cache formula_cache locks cellar logs].each { |d| HOMEBREW_PREFIX.parent.join(d).mkpath } # Test fixtures and files can be found relative to this path TEST_DIRECTORY = File.dirname(File.expand_path(__FILE__))
true
Other
Homebrew
brew
8d64b6a02d78811f50d5f747ce10df09d54b4791.json
introduce global lock directory (#337) Since #292, HOMEBREW_CACHE was moved to a per-user directory. This makes it unsuitable to store global lock files on multiple users environment. Therefore, introducing a global lock directory `/Library/Lock.d` to store lock files from formula lockers as well as `brew update`.
Library/Homebrew/utils/lock.sh
@@ -3,7 +3,9 @@ # Noted due to the fixed FD, a shell process can only create one lock. lock() { local name="$1" - local lock_file="/tmp/homebrew${HOMEBREW_REPOSITORY//\//-}-${name}.lock" + local lock_dir="$HOMEBREW_LIBRARY/Locks" + local lock_file="$lock_dir/$name" + [[ -d "$lock_dir" ]] || mkdir -p "$lock_dir" # 200 is the file descriptor used in the lock. # This FD should be used exclusively for lock purpose. # Any value except 0(stdin), 1(stdout) and 2(stderr) can do the job.
true
Other
Homebrew
brew
21ca138edf584daebf1795a52d6edd6ec34ce605.json
Resource.unpack: install invisible files and dirs Since patches sometimes change .gitignore and .travis.yml, it's desirable to install them along with everything else if a resource needs patching. Also, for resources that are git respositories, this allows install to interact with git objects other than the commit specifically checked out. More generally, this may help to avoid subtle issues by preserving the fidelity of resources in cases where invisible dot files play a functional role. Closes #329. Signed-off-by: ilovezfs <ilovezfs@icloud.com>
Library/Homebrew/resource.rb
@@ -98,7 +98,7 @@ def unpack(target = nil) yield ResourceStageContext.new(self, staging) elsif target target = Pathname.new(target) unless target.is_a? Pathname - target.install Dir["*"] + target.install Pathname.pwd.children end end end
false
Other
Homebrew
brew
af42deca4ab70816216ffc060f3aa8f55e469cac.json
audit: detect more 'pkgshare' candidates (#328) The new check also allows the `+` operator instead of our (still heavily preferred) `/` operator for path concatenation and also triggers if the operator is surrounded by whitespace. Also recognizes single-quoted strings and uses a back reference to match the closing quote for a slightly lower chance of false positives. Closes #322.
Library/Homebrew/cmd/audit.rb
@@ -919,8 +919,8 @@ def audit_line(line, lineno) problem "Use \#{pkgshare} instead of \#{share}/#{formula.name}" end - if line =~ %r{share/"#{Regexp.escape(formula.name)}[/'"]} - problem "Use pkgshare instead of (share/\"#{formula.name}\")" + if line =~ %r{share(\s*[/+]\s*)(['"])#{Regexp.escape(formula.name)}(?:\2|/)} + problem "Use pkgshare instead of (share#{$1}\"#{formula.name}\")" end end end
false
Other
Homebrew
brew
2cd81e50513f96a657454031e52fa4aec773ea97.json
update: pop the stash more quietly git stash pop -q will print "Already up-to-date!" if untracked changes are being poppped. This quiets it down unless verbose is set. Closes #320. Signed-off-by: ilovezfs <ilovezfs@icloud.com>
Library/Homebrew/cmd/update.sh
@@ -95,11 +95,13 @@ read_current_revision() { pop_stash() { [[ -z "$STASHED" ]] && return - git stash pop "${QUIET_ARGS[@]}" if [[ -n "$HOMEBREW_VERBOSE" ]] then + git stash pop echo "Restoring your stashed changes to $DIR:" git status --short --untracked-files + else + git stash pop "${QUIET_ARGS[@]}" 1>/dev/null fi unset STASHED }
false
Other
Homebrew
brew
d363ae53c08abd7e658a0124e7d3bb79d38a1f08.json
doc/External-Commands: update default HOMEBREW_CACHE (#316)
share/doc/homebrew/External-Commands.md
@@ -27,7 +27,7 @@ A shell script for an command named `extcmd` should be named `brew-extcmd`. This </tr> <tr> <td>HOMEBREW_CACHE</td> - <td>Where Homebrew caches downloaded tarballs to, typically <code>/Library/Caches/Homebrew</code>. </td> + <td>Where Homebrew caches downloaded tarballs to, by default <code>~/Library/Caches/Homebrew</code>. </td> </tr> <tr> <td>HOMEBREW_CELLAR</td>
false
Other
Homebrew
brew
656c713d6c549a1ae1dc25cdc1f9bb887dfd8440.json
bottle: use short formula name in bottle commit
Library/Homebrew/cmd/bottle.rb
@@ -427,11 +427,12 @@ def merge end unless ARGV.include? "--no-commit" + short_name = formula_name.split("/", -1).last pkg_version = bottle_hash["formula"]["pkg_version"] path.parent.cd do safe_system "git", "commit", "--no-edit", "--verbose", - "--message=#{formula_name}: #{update_or_add} #{pkg_version} bottle.", + "--message=#{short_name}: #{update_or_add} #{pkg_version} bottle.", "--", path end end
false
Other
Homebrew
brew
b2c9625d780277f021c63e21cac4a7c954170784.json
formula_installer: accumulate inherited options When a given dependency appears multiple times in a formula's dependency tree, the inherited options for that dependency should accumulate rather than being overwritten each time that dependency is considered by expand_dependencies. In particular, this impacts "universal" since the dependency should be built with universal unless all of its instances in the dependency tree don't have "universal" as opposed to only if the last instance considered has "universal." Closes Homebrew/homebrew-core#1604. Closes #308. Signed-off-by: ilovezfs <ilovezfs@icloud.com>
Library/Homebrew/formula_installer.rb
@@ -341,10 +341,10 @@ def expand_requirements end def expand_dependencies(deps) - inherited_options = {} + inherited_options = Hash.new { |hash, key| hash[key] = Options.new } expanded_deps = Dependency.expand(formula, deps) do |dependent, dep| - options = inherited_options[dep.name] = inherited_options_for(dep) + inherited_options[dep.name] |= inherited_options_for(dep) build = effective_build_options_for( dependent, inherited_options.fetch(dependent.name, []) @@ -354,7 +354,7 @@ def expand_dependencies(deps) Dependency.prune elsif dep.build? && install_bottle_for?(dependent, build) Dependency.prune - elsif dep.satisfied?(options) + elsif dep.satisfied?(inherited_options[dep.name]) Dependency.skip end end
false
Other
Homebrew
brew
5b1372e7587e5b1ea34301111d05685d773de728.json
README: add 1Password for Teams.
README.md
@@ -56,6 +56,10 @@ Our bottles (binary packages) are hosted by Bintray. [![Downloads by Bintray](https://bintray.com/docs/images/downloads_by_bintray_96.png)](https://bintray.com/homebrew) +Secure password storage and syncing provided by [1Password for Teams](https://1password.com/teams/) by AgileBits + +[![AgileBits](https://da36klfizjv29.cloudfront.net/assets/branding/agilebits-fcca96e9b8e815c5c48c6b3e98156cb5.png)](https://agilebits.com) + Homebrew is a member of the [Software Freedom Conservancy](https://sfconservancy.org) [![Software Freedom Conservancy](https://sfconservancy.org/img/conservancy_64x64.png)](https://sfconservancy.org)
false
Other
Homebrew
brew
d2cdbcbb18aaf667077eb46c2abc2cfd8690f919.json
tests: add missing require Amends e4d0187120e61bc80d31ebecc3b38f0740b20bb5. The `require` was accidentally omitted causing the tests to fail very sporadically (or always, when invoked as `brew tests --only=integration_cmds`).
Library/Homebrew/test/test_integration_cmds.rb
@@ -2,6 +2,7 @@ require "testing_env" require "fileutils" require "pathname" +require "formula" class IntegrationCommandTests < Homebrew::TestCase def setup
false
Other
Homebrew
brew
4da713dd9a8538588b763cc99a31c165f6b434a3.json
xquartz: expect 2.7.9 on 10.6-10.11 (#307)
Library/Homebrew/os/mac/xquartz.rb
@@ -23,7 +23,8 @@ module XQuartz "2.7.54" => "2.7.5", "2.7.61" => "2.7.6", "2.7.73" => "2.7.7", - "2.7.86" => "2.7.8" + "2.7.86" => "2.7.8", + "2.7.94" => "2.7.9", }.freeze # This returns the version number of XQuartz, not of the upstream X.org. @@ -50,7 +51,7 @@ def latest_version when "10.5" "2.6.3" else - "2.7.8" + "2.7.9" end end
false
Other
Homebrew
brew
a9abbab9175379d990d49d06341c14579db92bb2.json
Move HOMEBREW_CACHE to ~/Library/Caches (#292) * cleanup: accept cache as an argument. * config: move default HOMEBREW_CACHE to ~/Library. * brew.1: document new default Homebrew cache. * update-report: migrate legacy Homebrew cache.
Library/Homebrew/cleanup.rb
@@ -43,9 +43,9 @@ def self.cleanup_cellar end end - def self.cleanup_cache - return unless HOMEBREW_CACHE.directory? - HOMEBREW_CACHE.children.each do |path| + def self.cleanup_cache(cache=HOMEBREW_CACHE) + return unless cache.directory? + cache.children.each do |path| if path.to_s.end_with? ".incomplete" cleanup_path(path) { path.unlink } next
true
Other
Homebrew
brew
a9abbab9175379d990d49d06341c14579db92bb2.json
Move HOMEBREW_CACHE to ~/Library/Caches (#292) * cleanup: accept cache as an argument. * config: move default HOMEBREW_CACHE to ~/Library. * brew.1: document new default Homebrew cache. * update-report: migrate legacy Homebrew cache.
Library/Homebrew/cmd/update-report.rb
@@ -2,6 +2,7 @@ require "migrator" require "formulary" require "descriptions" +require "cleanup" module Homebrew def update_preinstall_header @@ -69,6 +70,8 @@ def update_report updated = true end + migrate_legacy_cache_if_necessary + if !updated if !ARGV.include?("--preinstall") && !ENV["HOMEBREW_UPDATE_FAILED"] puts "Already up-to-date." @@ -101,6 +104,52 @@ def install_core_tap_if_necessary ENV["HOMEBREW_UPDATE_BEFORE_HOMEBREW_HOMEBREW_CORE"] = revision ENV["HOMEBREW_UPDATE_AFTER_HOMEBREW_HOMEBREW_CORE"] = revision end + + def migrate_legacy_cache_if_necessary + legacy_cache = Pathname.new "/Library/Caches/Homebrew" + return if HOMEBREW_CACHE.to_s == legacy_cache.to_s + return unless legacy_cache.directory? + return unless legacy_cache.readable_real? + + migration_attempted_file = legacy_cache/".migration_attempted" + return if migration_attempted_file.exist? + + return unless legacy_cache.writable_real? + FileUtils.touch migration_attempted_file + + # Cleanup to avoid copying files unnecessarily + ohai "Cleaning up #{legacy_cache}..." + Cleanup.cleanup_cache legacy_cache + + # This directory could have been compromised if it's world-writable/ + # a symlink/owned by another user so don't copy files in those cases. + return if legacy_cache.world_writable? + return if legacy_cache.symlink? + return if !legacy_cache.owned? && legacy_cache.lstat.uid != 0 + + ohai "Migrating #{legacy_cache} to #{HOMEBREW_CACHE}..." + HOMEBREW_CACHE.mkpath + legacy_cache.cd do + legacy_cache.entries.each do |f| + next if [".", "..", ".migration_attempted"].include? "#{f}" + begin + FileUtils.cp_r f, HOMEBREW_CACHE + rescue + @migration_failed ||= true + end + end + end + + if @migration_failed + opoo <<-EOS.undent + Failed to migrate #{legacy_cache} to + #{HOMEBREW_CACHE}. Please do so manually. + EOS + else + ohai "Deleting #{legacy_cache}..." + FileUtils.rm_rf legacy_cache + end + end end class Reporter
true
Other
Homebrew
brew
a9abbab9175379d990d49d06341c14579db92bb2.json
Move HOMEBREW_CACHE to ~/Library/Caches (#292) * cleanup: accept cache as an argument. * config: move default HOMEBREW_CACHE to ~/Library. * brew.1: document new default Homebrew cache. * update-report: migrate legacy Homebrew cache.
Library/Homebrew/config.rb
@@ -1,27 +1,4 @@ -def cache - if ENV["HOMEBREW_CACHE"] - Pathname.new(ENV["HOMEBREW_CACHE"]).expand_path - else - # we do this for historic reasons, however the cache *should* be the same - # directory whichever user is used and whatever instance of brew is executed - home_cache = Pathname.new("~/Library/Caches/Homebrew").expand_path - if home_cache.directory? && home_cache.writable_real? - home_cache - else - Pathname.new("/Library/Caches/Homebrew").extend Module.new { - def mkpath - unless exist? - super - chmod 0775 - end - end - } - end - end -end - -HOMEBREW_CACHE = cache -undef cache +HOMEBREW_CACHE = Pathname.new(ENV["HOMEBREW_CACHE"] || "~/Library/Caches/Homebrew").expand_path # Where brews installed via URL are cached HOMEBREW_CACHE_FORMULA = HOMEBREW_CACHE+"Formula"
true
Other
Homebrew
brew
a9abbab9175379d990d49d06341c14579db92bb2.json
Move HOMEBREW_CACHE to ~/Library/Caches (#292) * cleanup: accept cache as an argument. * config: move default HOMEBREW_CACHE to ~/Library. * brew.1: document new default Homebrew cache. * update-report: migrate legacy Homebrew cache.
Library/Homebrew/manpages/brew.1.md.erb
@@ -118,8 +118,7 @@ can take several different forms: * `HOMEBREW_CACHE`: If set, instructs Homebrew to use the given directory as the download cache. - *Default:* `~/Library/Caches/Homebrew` if it exists; otherwise, - `/Library/Caches/Homebrew`. + *Default:* `~/Library/Caches/Homebrew`. * `HOMEBREW_CURL_VERBOSE`: If set, Homebrew will pass `--verbose` when invoking `curl`(1).
true
Other
Homebrew
brew
a9abbab9175379d990d49d06341c14579db92bb2.json
Move HOMEBREW_CACHE to ~/Library/Caches (#292) * cleanup: accept cache as an argument. * config: move default HOMEBREW_CACHE to ~/Library. * brew.1: document new default Homebrew cache. * update-report: migrate legacy Homebrew cache.
share/doc/homebrew/brew.1.html
@@ -523,8 +523,7 @@ <h2 id="ENVIRONMENT">ENVIRONMENT</h2> using this environment variable.</p></dd> <dt><code>HOMEBREW_CACHE</code></dt><dd><p>If set, instructs Homebrew to use the given directory as the download cache.</p> -<p><em>Default:</em> <code>~/Library/Caches/Homebrew</code> if it exists; otherwise, -<code>/Library/Caches/Homebrew</code>.</p></dd> +<p><em>Default:</em> <code>~/Library/Caches/Homebrew</code>.</p></dd> <dt><code>HOMEBREW_CURL_VERBOSE</code></dt><dd><p>If set, Homebrew will pass <code>--verbose</code> when invoking <code>curl</code>(1).</p></dd> <dt><code>HOMEBREW_DEBUG</code></dt><dd><p>If set, any commands that can emit debugging information will do so.</p></dd> <dt><code>HOMEBREW_DEBUG_INSTALL</code></dt><dd><p>When <code>brew install -d</code> or <code>brew install -i</code> drops into a shell,
true
Other
Homebrew
brew
a9abbab9175379d990d49d06341c14579db92bb2.json
Move HOMEBREW_CACHE to ~/Library/Caches (#292) * cleanup: accept cache as an argument. * config: move default HOMEBREW_CACHE to ~/Library. * brew.1: document new default Homebrew cache. * update-report: migrate legacy Homebrew cache.
share/man/man1/brew.1
@@ -720,7 +720,7 @@ If set, instructs Homebrew to compile from source even when a formula provides a If set, instructs Homebrew to use the given directory as the download cache\. . .IP -\fIDefault:\fR \fB~/Library/Caches/Homebrew\fR if it exists; otherwise, \fB/Library/Caches/Homebrew\fR\. +\fIDefault:\fR \fB~/Library/Caches/Homebrew\fR\. . .TP \fBHOMEBREW_CURL_VERBOSE\fR
true
Other
Homebrew
brew
8486f6e04d46323e3e17a71c4c8b3ce948d35bae.json
Prefer $stderr over STDERR for consistency (#304) Prior to this change there were only 3 instances of `STD(IN|OUT|ERR)` versus 74 instances of `$std(in|out|err)` in the Homebrew code base. The latter variant is also strongly suggested by bbatsov's Ruby Style Guide.
Library/Homebrew/formulary.rb
@@ -86,7 +86,7 @@ def klass private def load_file - STDERR.puts "#{$0} (#{self.class.name}): loading #{path}" if ARGV.debug? + $stderr.puts "#{$0} (#{self.class.name}): loading #{path}" if ARGV.debug? raise FormulaUnavailableError.new(name) unless path.file? Formulary.load_formula_from_path(name, path) end @@ -199,7 +199,7 @@ def initialize(name, path, contents) end def klass - STDERR.puts "#{$0} (#{self.class.name}): loading #{path}" if ARGV.debug? + $stderr.puts "#{$0} (#{self.class.name}): loading #{path}" if ARGV.debug? namespace = "FormulaNamespace#{Digest::MD5.hexdigest(contents)}" Formulary.load_formula(name, path, contents, namespace) end
true
Other
Homebrew
brew
8486f6e04d46323e3e17a71c4c8b3ce948d35bae.json
Prefer $stderr over STDERR for consistency (#304) Prior to this change there were only 3 instances of `STD(IN|OUT|ERR)` versus 74 instances of `$std(in|out|err)` in the Homebrew code base. The latter variant is also strongly suggested by bbatsov's Ruby Style Guide.
Library/Homebrew/utils/popen.rb
@@ -20,7 +20,7 @@ def self.popen(args, mode) return pipe.read end else - STDERR.reopen("/dev/null", "w") + $stderr.reopen("/dev/null", "w") exec(*args) end end
true
Other
Homebrew
brew
8e728d6604720b75e1442e9c2ed5f10b780b58a4.json
style: unify indentation in RuboCop configuration Some elements already used two-space indentation and we also prefer two spaces in our Ruby code. Closes #306. Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
Library/.rubocop.yml
@@ -5,111 +5,111 @@ AllCops: # 1.8-style hash keys Style/HashSyntax: - EnforcedStyle: hash_rockets + EnforcedStyle: hash_rockets # ruby style guide favorite Style/StringLiterals: - EnforcedStyle: double_quotes + EnforcedStyle: double_quotes # consistency with above Style/StringLiteralsInInterpolation: - EnforcedStyle: double_quotes + EnforcedStyle: double_quotes # percent-x is allowed for multiline Style/CommandLiteral: - EnforcedStyle: mixed + EnforcedStyle: mixed # paths abound, easy escape Style/RegexpLiteral: - EnforcedStyle: slashes + EnforcedStyle: slashes # our current conditional style is established, clear and # requiring users to change that now would be confusing. Style/ConditionalAssignment: - Enabled: false + Enabled: false # no metrics for formulas Metrics/AbcSize: - Enabled: false + Enabled: false Metrics/CyclomaticComplexity: - Enabled: false + Enabled: false Metrics/MethodLength: - Enabled: false + Enabled: false Metrics/ClassLength: - Enabled: false + Enabled: false Metrics/PerceivedComplexity: - Enabled: false + Enabled: false # we often need very long lines Metrics/LineLength: - Enabled: false + Enabled: false # formulas have no mandatory doc Style/Documentation: - Enabled: false + Enabled: false # favor parens-less DSL-style arguments Lint/AmbiguousOperator: - Enabled: false + Enabled: false Lint/AmbiguousRegexpLiteral: - Enabled: false + Enabled: false Lint/AssignmentInCondition: - Enabled: false + Enabled: false Lint/ParenthesesAsGroupedExpression: - Enabled: false + Enabled: false # compact style Style/EmptyLineBetweenDefs: - AllowAdjacentOneLineDefs: true + AllowAdjacentOneLineDefs: true # port numbers and such tech stuff Style/NumericLiterals: - Enabled: false + Enabled: false # consistency and readability when faced with string interpolation Style/PercentLiteralDelimiters: - PreferredDelimiters: - '%': '()' - '%i': '()' - '%q': '()' - '%Q': '()' - '%r': '{}' - '%s': '()' - '%w': '[]' - '%W': '[]' - '%x': '()' + PreferredDelimiters: + '%': '()' + '%i': '()' + '%q': '()' + '%Q': '()' + '%r': '{}' + '%s': '()' + '%w': '[]' + '%W': '[]' + '%x': '()' # conflicts with DSL-style path concatenation with `/` Style/SpaceAroundOperators: - Enabled: false + Enabled: false # not a problem for typical shell users Style/SpecialGlobalVars: - Enabled: false + Enabled: false # `system` is a special case and aligns on second argument Style/AlignParameters: - Enabled: false + Enabled: false # counterproductive in formulas, notably within the install method Style/GuardClause: - Enabled: false + Enabled: false Style/IfUnlessModifier: - Enabled: false + Enabled: false # dashes in filenames are typical # TODO: enforce when rubocop has fixed this # https://github.com/bbatsov/rubocop/issues/1545 Style/FileName: - Enabled: false + Enabled: false # no percent word array, being friendly to non-ruby users # TODO: enforce when rubocop has fixed this # https://github.com/bbatsov/rubocop/issues/1543 Style/WordArray: - Enabled: false + Enabled: false Style/UnneededCapitalW: - Enabled: false + Enabled: false # we use raise, not fail Style/SignalException:
false
Other
Homebrew
brew
8b97a00036124da6a0bcc23dbd76c411600b2377.json
style: use RuboCop 0.40
Library/Homebrew/cmd/style.rb
@@ -47,7 +47,7 @@ def check_style_json(files, options = {}) def check_style_impl(files, output_type, options = {}) fix = options[:fix] - Homebrew.install_gem_setup_path! "rubocop", "0.39" + Homebrew.install_gem_setup_path! "rubocop", "0.40" args = %W[ --force-exclusion
false
Other
Homebrew
brew
331fdba29d9364ba20e99e1fa8db074ac482ca9c.json
audit: prefer https/s over ftp where known available The FTP protocol is prone to getting firewalled to death in places, so where we know we can avoid that by using either secure or more commonly accepted protocols let's do so. Examples of output: ``` * Stable: ftp://ftp.cpan.org/pub/CPAN/authors/id/N/NE/NEILB/Time-Duration-1.20.tar.gz should be `http://search.cpan.org/CPAN/authors/id/N/NE/NEILB/Time-Duration-1.20.tar.gz` * Stable: Please use https:// for ftp://ftp.mirrorservice.org/sites/lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_4.89.tar.bz2 ```
Library/Homebrew/cmd/audit.rb
@@ -1175,6 +1175,16 @@ def audit_urls end end + # Prefer HTTP/S when possible over FTP protocol due to possible firewalls. + urls.each do |p| + case p + when %r{^ftp://ftp\.mirrorservice\.org} + problem "Please use https:// for #{p}" + when %r{^ftp://ftp\.cpan\.org/pub/CPAN(.*)}i + problem "#{p} should be `http://search.cpan.org/CPAN#{$1}`" + end + end + # Check SourceForge urls urls.each do |p| # Skip if the URL looks like a SVN repo
false
Other
Homebrew
brew
7dad182ed1f457258d9fd6f7a10e880669d8a268.json
Bottle: remove local installation instructions. These aren't targeted at end users.
share/doc/homebrew/Bottles.md
@@ -6,9 +6,6 @@ If a bottle is available and usable it will be downloaded and poured automatical Bottles will not be used if the user requests it (see above), if the formula requests it (with `pour_bottle?`), if any options are specified on installation (bottles are all compiled with default options), if the bottle is not up to date (e.g. lacking a checksum) or the bottle's `cellar` is not `:any` or equal to the current `HOMEBREW_CELLAR`. -### Local Bottle Usage -Bottles can also be cached locally and installed by path e.g. `brew install /Library/Caches/Homebrew/qt-4.8.4.mountain_lion.bottle.1.tar.gz`. - ## Bottle Creation Bottles are currently created using the [Brew Test Bot](Brew-Test-Bot.md). We will be slowly adding them to all formulae.
false
Other
Homebrew
brew
f946693b561bae7f065d06776751a19d199f7031.json
test-bot: remove support for legacy Homebrew repo. (#287) We're not really getting any more PRs here and this code makes this file harder to follow and refactor.
Library/Homebrew/cmd/test-bot.rb
@@ -11,8 +11,6 @@ # --junit: Generate a JUnit XML test results file. # --no-bottle: Run brew install without --build-bottle. # --keep-old: Run brew bottle --keep-old to build new bottles for a single platform. -# --legacy Build formula from legacy Homebrew/legacy-homebrew repo. -# (TODO remove it when it's not longer necessary) # --HEAD: Run brew install with --HEAD. # --local: Ask Homebrew to write verbose logs under ./logs/ and set HOME to ./home/. # --tap=<tap>: Use the git repository of the given tap. @@ -342,11 +340,7 @@ def diff_formulae(start_revision, end_revision, path, filter) # the right commit to BrewTestBot. unless travis_pr diff_start_sha1 = current_sha1 - if ARGV.include?("--legacy") - test "brew", "pull", "--clean", "--legacy", @url - else - test "brew", "pull", "--clean", @url - end + test "brew", "pull", "--clean", @url diff_end_sha1 = current_sha1 end @short_url = @url.gsub("https://github.com/", "") @@ -789,7 +783,6 @@ def test_ci_upload(tap) ENV["HUDSON_COOKIE"] = nil ARGV << "--verbose" - ARGV << "--legacy" if ENV["UPSTREAM_BOTTLE_LEGACY"] bottles = Dir["#{jenkins}/jobs/#{job}/configurations/axis-version/*/builds/#{id}/archive/*.bottle*.*"] return if bottles.empty? @@ -810,13 +803,8 @@ def test_ci_upload(tap) safe_system "brew", "update" if pr - if ARGV.include?("--legacy") - pull_pr = "https://github.com/Homebrew/legacy-homebrew/pull/#{pr}" - safe_system "brew", "pull", "--clean", "--legacy", pull_pr - else - pull_pr = "https://github.com/#{tap.user}/homebrew-#{tap.repo}/pull/#{pr}" - safe_system "brew", "pull", "--clean", pull_pr - end + pull_pr = "https://github.com/#{tap.user}/homebrew-#{tap.repo}/pull/#{pr}" + safe_system "brew", "pull", "--clean", pull_pr end json_files = Dir.glob("*.bottle.json")
false
Other
Homebrew
brew
6ba466f5d858c5e6f9d162c11ec03134df6e686e.json
Use JSON files for bottle upload data. (#166) This means that we do not need to read formulae or evaluate Ruby at upload time.
Library/Homebrew/cmd/bottle.rb
@@ -281,7 +281,8 @@ def bottle_formula(f) bottle.prefix prefix end bottle.revision bottle_revision - bottle.sha256 bottle_path.sha256 => Utils::Bottles.tag + sha256 = bottle_path.sha256 + bottle.sha256 sha256 => Utils::Bottles.tag old_spec = f.bottle_specification if ARGV.include?("--keep-old") && !old_spec.checksums.empty? @@ -300,74 +301,104 @@ def bottle_formula(f) puts "./#{filename}" puts output - if ARGV.include? "--rb" - File.open("#{filename.prefix}.bottle.rb", "w") do |file| - file.write("\# #{f.full_name}\n") - file.write(output) + if ARGV.include? "--json" + json = { + f.full_name => { + "formula" => { + "pkg_version" => f.pkg_version.to_s, + "path" => f.path.to_s.strip_prefix("#{HOMEBREW_REPOSITORY}/"), + }, + "bottle" => { + "root_url" => bottle.root_url, + "prefix" => bottle.prefix, + "cellar" => bottle.cellar.to_s, + "revision" => bottle.revision, + "tags" => { + Utils::Bottles.tag.to_s => { + "filename" => filename.to_s, + "sha256" => sha256, + }, + } + }, + "bintray" => { + "package" => Utils::Bottles::Bintray.package(f.full_name), + "repository" => Utils::Bottles::Bintray.repository(f.tap), + }, + }, + } + File.open("#{filename.prefix}.bottle.json", "w") do |file| + file.write Utils::JSON.dump json end end end - module BottleMerger - def bottle(&block) - instance_eval(&block) - end - end - def merge write = ARGV.include? "--write" - keep_old = ARGV.include? "--keep-old" - - merge_hash = {} - ARGV.named.each do |argument| - bottle_block = IO.read(argument) - formula_name = bottle_block.lines.first.sub(/^# /, "").chomp - merge_hash[formula_name] ||= [] - merge_hash[formula_name] << bottle_block + + bottles_hash = ARGV.named.reduce({}) do |hash, json_file| + hash.merge! Utils::JSON.load(IO.read(json_file)) end - merge_hash.each do |formula_name, bottle_blocks| + bottles_hash.each do |formula_name, bottle_hash| ohai formula_name - f = Formulary.factory(formula_name) - if f.bottle_disabled? - ofail "Formula #{f.full_name} has disabled bottle" - puts f.bottle_disable_reason - next + bottle = BottleSpecification.new + bottle.root_url bottle_hash["bottle"]["root_url"] + cellar = bottle_hash["bottle"]["cellar"] + if cellar == "any" || cellar == "any_skip_relocation" + cellar = cellar.to_sym end - - bottle = if keep_old - f.bottle_specification.dup - else - BottleSpecification.new - end - bottle.extend(BottleMerger) - bottle_blocks.each { |block| bottle.instance_eval(block) } - - old_spec = f.bottle_specification - if keep_old && !old_spec.checksums.empty? - bad_fields = [:root_url, :prefix, :cellar, :revision].select do |field| - old_spec.send(field) != bottle.send(field) - end - bad_fields.delete(:cellar) if old_spec.cellar == :any && bottle.cellar == :any_skip_relocation - if bad_fields.any? - ofail "--keep-old is passed but there are changes in: #{bad_fields.join ", "}" - next - end + bottle.cellar cellar + bottle.prefix bottle_hash["bottle"]["prefix"] + bottle.revision bottle_hash["bottle"]["revision"] + bottle_hash["bottle"]["tags"].each do |tag, tag_hash| + bottle.sha256 tag_hash["sha256"] => tag.to_sym end output = bottle_output bottle - puts output if write + path = Pathname.new("#{HOMEBREW_REPOSITORY/bottle_hash["formula"]["path"]}") update_or_add = nil - Utils::Inreplace.inreplace(f.path) do |s| + Utils::Inreplace.inreplace(path) do |s| if s.include? "bottle do" update_or_add = "update" + if ARGV.include? "--keep-old" + mismatches = [] + s =~ / bottle do(.+?)end\n/m + bottle_block_contents = $1 + bottle_block_contents.lines.each do |line| + line = line.strip + next if line.empty? + key, value, _, tag = line.split " ", 4 + value = value.to_s.delete ":'\"" + tag = tag.to_s.delete ":" + + if !tag.empty? + if !bottle_hash["bottle"]["tags"][tag].to_s.empty? + mismatches << "#{key} => #{tag}" + else + bottle.send(key, value => tag.to_sym) + end + next + end + + old_value = bottle_hash["bottle"][key].to_s + next if key == "cellar" && old_value == "any" && value == "any_skip_relocation" + mismatches << key if old_value.empty? || value != old_value + end + if mismatches.any? + odie "--keep-old was passed but there were changes in #{mismatches.join(", ")}!" + end + output = bottle_output bottle + end + puts output string = s.sub!(/ bottle do.+?end\n/m, output) odie "Bottle block update failed!" unless string else + odie "--keep-old was passed but there was no existing bottle block!" + puts output update_or_add = "add" if s.include? "stable do" indent = s.slice(/^ +stable do/).length - "stable do".length @@ -392,12 +423,16 @@ def merge end unless ARGV.include? "--no-commit" - f.path.parent.cd do + pkg_version = bottle_hash["formula"]["pkg_version"] + + path.parent.cd do safe_system "git", "commit", "--no-edit", "--verbose", - "--message=#{f.name}: #{update_or_add} #{f.pkg_version} bottle.", - "--", f.path + "--message=#{formula_name}: #{update_or_add} #{pkg_version} bottle.", + "--", path end end + else + puts output end end end
true
Other
Homebrew
brew
6ba466f5d858c5e6f9d162c11ec03134df6e686e.json
Use JSON files for bottle upload data. (#166) This means that we do not need to read formulae or evaluate Ruby at upload time.
Library/Homebrew/cmd/pull.rb
@@ -119,7 +119,7 @@ def pull end patch_puller.apply_patch - changed_formulae = [] + changed_formulae_names = [] if tap Utils.popen_read( @@ -128,7 +128,7 @@ def pull ).each_line do |line| name = "#{tap.name}/#{File.basename(line.chomp, ".rb")}" begin - changed_formulae << Formula[name] + changed_formulae_names << name # Make sure we catch syntax errors. rescue Exception next @@ -137,7 +137,10 @@ def pull end fetch_bottles = false - changed_formulae.each do |f| + changed_formulae_names.each do |name| + next if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"] + + f = Formula[name] if ARGV.include? "--bottle" if f.bottle_unneeded? ohai "#{f}: skipping unneeded bottle." @@ -164,12 +167,16 @@ def pull message += "\n#{close_message}" unless message.include? close_message end - if changed_formulae.empty? + if changed_formulae_names.empty? odie "cannot bump: no changed formulae found after applying patch" if do_bump is_bumpable = false end - if is_bumpable && !ARGV.include?("--clean") - formula = changed_formulae.first + + is_bumpable = false if ARGV.include?("--clean") + is_bumpable = false if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"] + + if is_bumpable + formula = Formula[changed_formulae_names.first] new_versions = current_versions_from_info_external(patch_changes[:formulae].first) orig_subject = message.empty? ? "" : message.lines.first.chomp bump_subject = subject_for_bump(formula, old_versions, new_versions) @@ -219,7 +226,7 @@ def pull # Publish bottles on Bintray unless ARGV.include? "--no-publish" - published = publish_changed_formula_bottles(tap, changed_formulae) + published = publish_changed_formula_bottles(tap, changed_formulae_names) bintray_published_formulae.concat(published) end end @@ -239,11 +246,16 @@ def force_utf8!(str) private - def publish_changed_formula_bottles(tap, changed_formulae) + def publish_changed_formula_bottles(tap, changed_formulae_names) + if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"] + raise "Need to load formulae to publish them!" + end + published = [] bintray_creds = { :user => ENV["BINTRAY_USER"], :key => ENV["BINTRAY_KEY"] } if bintray_creds[:user] && bintray_creds[:key] - changed_formulae.each do |f| + changed_formulae_names.each do |name| + f = Formula[name] next if f.bottle_unneeded? || f.bottle_disabled? ohai "Publishing on Bintray: #{f.name} #{f.pkg_version}" publish_bottle_file_on_bintray(f, bintray_creds) @@ -493,6 +505,11 @@ def initialize(url, sha256) # version of a formula. def verify_bintray_published(formulae_names) return if formulae_names.empty? + + if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"] + raise "Need to load formulae to verify their publication!" + end + ohai "Verifying bottles published on Bintray" formulae = formulae_names.map { |n| Formula[n] } max_retries = 300 # shared among all bottles
true
Other
Homebrew
brew
6ba466f5d858c5e6f9d162c11ec03134df6e686e.json
Use JSON files for bottle upload data. (#166) This means that we do not need to read formulae or evaluate Ruby at upload time.
Library/Homebrew/cmd/test-bot.rb
@@ -114,7 +114,7 @@ def log_file_path end def command_short - (@command - %w[brew --force --retry --verbose --build-bottle --rb]).join(" ") + (@command - %w[brew --force --retry --verbose --build-bottle --json]).join(" ") end def passed? @@ -570,15 +570,15 @@ def formula(formula_name) test "brew", "audit", *audit_args if install_passed if formula.stable? && !ARGV.include?("--fast") && !ARGV.include?("--no-bottle") && !formula.bottle_disabled? - bottle_args = ["--verbose", "--rb", formula_name] + bottle_args = ["--verbose", "--json", formula_name] bottle_args << "--keep-old" if ARGV.include? "--keep-old" test "brew", "bottle", *bottle_args bottle_step = steps.last if bottle_step.passed? && bottle_step.has_output? bottle_filename = bottle_step.output.gsub(/.*(\.\/\S+#{Utils::Bottles::native_regex}).*/m, '\1') - bottle_rb_filename = bottle_filename.gsub(/\.(\d+\.)?tar\.gz$/, ".rb") - bottle_merge_args = ["--merge", "--write", "--no-commit", bottle_rb_filename] + bottle_json_filename = bottle_filename.gsub(/\.(\d+\.)?tar\.gz$/, ".json") + bottle_merge_args = ["--merge", "--write", "--no-commit", bottle_json_filename] bottle_merge_args << "--keep-old" if ARGV.include? "--keep-old" test "brew", "bottle", *bottle_merge_args test "brew", "uninstall", "--force", formula_name @@ -768,6 +768,9 @@ def run end def test_ci_upload(tap) + # Don't trust formulae we're uploading + ENV["HOMEBREW_DISABLE_LOAD_FORMULA"] = "1" + jenkins = ENV["JENKINS_HOME"] job = ENV["UPSTREAM_JOB_NAME"] id = ENV["UPSTREAM_BUILD_ID"] @@ -779,14 +782,13 @@ def test_ci_upload(tap) raise "Missing BINTRAY_USER or BINTRAY_KEY variables!" end - # Don't pass keys/cookies to subprocesses.. + # Don't pass keys/cookies to subprocesses ENV["BINTRAY_KEY"] = nil ENV["HUDSON_SERVER_COOKIE"] = nil ENV["JENKINS_SERVER_COOKIE"] = nil ENV["HUDSON_COOKIE"] = nil ARGV << "--verbose" - ARGV << "--keep-old" if ENV["UPSTREAM_BOTTLE_KEEP_OLD"] ARGV << "--legacy" if ENV["UPSTREAM_BOTTLE_LEGACY"] bottles = Dir["#{jenkins}/jobs/#{job}/configurations/axis-version/*/builds/#{id}/archive/*.bottle*.*"] @@ -817,53 +819,58 @@ def test_ci_upload(tap) end end - bottle_args = ["--merge", "--write", *Dir["*.bottle.rb"]] - bottle_args << "--keep-old" if ARGV.include? "--keep-old" - system "brew", "bottle", *bottle_args + json_files = Dir.glob("*.bottle.json") + system "brew", "bottle", "--merge", "--write", *json_files remote = "git@github.com:BrewTestBot/homebrew-#{tap.repo}.git" - tag = pr ? "pr-#{pr}" : "testing-#{number}" + git_tag = pr ? "pr-#{pr}" : "testing-#{number}" + safe_system "git", "push", "--force", remote, "master:master", ":refs/tags/#{git_tag}" - bintray_repo = Utils::Bottles::Bintray.repository(tap) - bintray_repo_url = "https://api.bintray.com/packages/homebrew/#{bintray_repo}" formula_packaged = {} - Dir.glob("*.bottle*.tar.gz") do |filename| - formula_name, canonical_formula_name = Utils::Bottles.resolve_formula_names filename - formula = Formulary.factory canonical_formula_name - version = formula.pkg_version - bintray_package = Utils::Bottles::Bintray.package formula_name - - if system "curl", "-I", "--silent", "--fail", "--output", "/dev/null", - "#{BottleSpecification::DEFAULT_DOMAIN}/#{bintray_repo}/#{filename}" - raise <<-EOS.undent - #{filename} is already published. Please remove it manually from - https://bintray.com/homebrew/#{bintray_repo}/#{bintray_package}/view#files - EOS - end + bottles_hash = json_files.reduce({}) do |hash, json_file| + hash.merge! Utils::JSON.load(IO.read(json_file)) + end - unless formula_packaged[formula_name] - package_url = "#{bintray_repo_url}/#{bintray_package}" - unless system "curl", "--silent", "--fail", "--output", "/dev/null", package_url - package_blob = <<-EOS.undent - {"name": "#{bintray_package}", - "public_download_numbers": true, - "public_stats": true} + bottles_hash.each do |formula_name, bottle_hash| + version = bottle_hash["formula"]["pkg_version"] + bintray_package = bottle_hash["bintray"]["package"] + bintray_repo = bottle_hash["bintray"]["repository"] + bintray_repo_url = "https://api.bintray.com/packages/homebrew/#{bintray_repo}" + + bottle_hash["bottle"]["tags"].each do |tag, tag_hash| + filename = tag_hash["filename"] + if system "curl", "-I", "--silent", "--fail", "--output", "/dev/null", + "#{BottleSpecification::DEFAULT_DOMAIN}/#{bintray_repo}/#{filename}" + raise <<-EOS.undent + #{filename} is already published. Please remove it manually from + https://bintray.com/homebrew/#{bintray_repo}/#{bintray_package}/view#files EOS - curl "--silent", "--fail", "-u#{bintray_user}:#{bintray_key}", - "-H", "Content-Type: application/json", - "-d", package_blob, bintray_repo_url - puts end - formula_packaged[formula_name] = true - end - content_url = "https://api.bintray.com/content/homebrew" - content_url += "/#{bintray_repo}/#{bintray_package}/#{version}/#{filename}" - content_url += "?override=1" - curl "--silent", "--fail", "-u#{bintray_user}:#{bintray_key}", - "-T", filename, content_url - puts + unless formula_packaged[formula_name] + package_url = "#{bintray_repo_url}/#{bintray_package}" + unless system "curl", "--silent", "--fail", "--output", "/dev/null", package_url + package_blob = <<-EOS.undent + {"name": "#{bintray_package}", + "public_download_numbers": true, + "public_stats": true} + EOS + curl "--silent", "--fail", "-u#{bintray_user}:#{bintray_key}", + "-H", "Content-Type: application/json", + "-d", package_blob, bintray_repo_url + puts + end + formula_packaged[formula_name] = true + end + + content_url = "https://api.bintray.com/content/homebrew" + content_url += "/#{bintray_repo}/#{bintray_package}/#{version}/#{filename}" + content_url += "?override=1" + curl "--silent", "--fail", "-u#{bintray_user}:#{bintray_key}", + "-T", filename, content_url + puts + end end safe_system "git", "tag", "--force", tag
true
Other
Homebrew
brew
6ba466f5d858c5e6f9d162c11ec03134df6e686e.json
Use JSON files for bottle upload data. (#166) This means that we do not need to read formulae or evaluate Ruby at upload time.
Library/Homebrew/formulary.rb
@@ -16,6 +16,10 @@ def self.formula_class_get(path) end def self.load_formula(name, path, contents, namespace) + if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"] + raise "Formula loading disabled by HOMEBREW_DISABLE_LOAD_FORMULA!" + end + mod = Module.new const_set(namespace, mod) mod.module_eval(contents, path)
true
Other
Homebrew
brew
9cf2710dc95f1c81e8c5111e22681836225e32e2.json
os/mac/*_mach: move shared code into 'SharedMachO' (#282) Both the `CctoolsMachO` and `RubyMachO` module implement a common set of methods that simplify querying `mach_data`. Move these into a shared module, that gets included after either of these implementations is loaded and included in `Pathname`.
Library/Homebrew/os/mac/cctools_mach.rb
@@ -1,5 +1,3 @@ -require "os/mac/architecture_list" - module CctoolsMachO # @private OTOOL_RX = /\t(.*) \(compatibility version (?:\d+\.)*\d+, current version (?:\d+\.)*\d+\)/ @@ -54,53 +52,6 @@ def mach_data end end - def archs - mach_data.map { |m| m.fetch :arch }.extend(ArchitectureListExtension) - end - - def arch - case archs.length - when 0 then :dunno - when 1 then archs.first - else :universal - end - end - - def universal? - arch == :universal - end - - def i386? - arch == :i386 - end - - def x86_64? - arch == :x86_64 - end - - def ppc7400? - arch == :ppc7400 - end - - def ppc64? - arch == :ppc64 - end - - # @private - def dylib? - mach_data.any? { |m| m.fetch(:type) == :dylib } - end - - # @private - def mach_o_executable? - mach_data.any? { |m| m.fetch(:type) == :executable } - end - - # @private - def mach_o_bundle? - mach_data.any? { |m| m.fetch(:type) == :bundle } - end - # @private class Metadata attr_reader :path, :dylib_id, :dylibs
true
Other
Homebrew
brew
9cf2710dc95f1c81e8c5111e22681836225e32e2.json
os/mac/*_mach: move shared code into 'SharedMachO' (#282) Both the `CctoolsMachO` and `RubyMachO` module implement a common set of methods that simplify querying `mach_data`. Move these into a shared module, that gets included after either of these implementations is loaded and included in `Pathname`.
Library/Homebrew/os/mac/pathname.rb
@@ -1,3 +1,5 @@ +require "os/mac/shared_mach" + class Pathname if ENV["HOMEBREW_RUBY_MACHO"] require "os/mac/ruby_mach" @@ -6,4 +8,6 @@ class Pathname require "os/mac/cctools_mach" include CctoolsMachO end + + include SharedMachO end
true
Other
Homebrew
brew
9cf2710dc95f1c81e8c5111e22681836225e32e2.json
os/mac/*_mach: move shared code into 'SharedMachO' (#282) Both the `CctoolsMachO` and `RubyMachO` module implement a common set of methods that simplify querying `mach_data`. Move these into a shared module, that gets included after either of these implementations is loaded and included in `Pathname`.
Library/Homebrew/os/mac/ruby_mach.rb
@@ -1,5 +1,4 @@ require "vendor/macho/macho" -require "os/mac/architecture_list" module RubyMachO # @private @@ -54,53 +53,6 @@ def mach_data end end - def archs - mach_data.map { |m| m.fetch :arch }.extend(ArchitectureListExtension) - end - - def arch - case archs.length - when 0 then :dunno - when 1 then archs.first - else :universal - end - end - - def universal? - arch == :universal - end - - def i386? - arch == :i386 - end - - def x86_64? - arch == :x86_64 - end - - def ppc7400? - arch == :ppc7400 - end - - def ppc64? - arch == :ppc64 - end - - # @private - def dylib? - mach_data.any? { |m| m.fetch(:type) == :dylib } - end - - # @private - def mach_o_executable? - mach_data.any? { |m| m.fetch(:type) == :executable } - end - - # @private - def mach_o_bundle? - mach_data.any? { |m| m.fetch(:type) == :bundle } - end - def dynamically_linked_libraries macho.linked_dylibs end
true
Other
Homebrew
brew
9cf2710dc95f1c81e8c5111e22681836225e32e2.json
os/mac/*_mach: move shared code into 'SharedMachO' (#282) Both the `CctoolsMachO` and `RubyMachO` module implement a common set of methods that simplify querying `mach_data`. Move these into a shared module, that gets included after either of these implementations is loaded and included in `Pathname`.
Library/Homebrew/os/mac/shared_mach.rb
@@ -0,0 +1,50 @@ +require "os/mac/architecture_list" + +module SharedMachO + def archs + mach_data.map { |m| m.fetch :arch }.extend(ArchitectureListExtension) + end + + def arch + case archs.length + when 0 then :dunno + when 1 then archs.first + else :universal + end + end + + def universal? + arch == :universal + end + + def i386? + arch == :i386 + end + + def x86_64? + arch == :x86_64 + end + + def ppc7400? + arch == :ppc7400 + end + + def ppc64? + arch == :ppc64 + end + + # @private + def dylib? + mach_data.any? { |m| m.fetch(:type) == :dylib } + end + + # @private + def mach_o_executable? + mach_data.any? { |m| m.fetch(:type) == :executable } + end + + # @private + def mach_o_bundle? + mach_data.any? { |m| m.fetch(:type) == :bundle } + end +end
true
Other
Homebrew
brew
78f8c60343b514ee7129cf3c86f216460a4ed3ab.json
tests: fix external command test and code style (#281) The check that `t4` is not an external command would always succeed, but not because the file wasn't executable, but because it wasn't even found due to the missing `brew-` prefix. Also change the valid but atypical file mode from 0744 to 0755 and apply minor code style fixes.
Library/Homebrew/test/test_commands.rb
@@ -19,7 +19,7 @@ def setup end def teardown - @cmds.each { |f| f.unlink } + @cmds.each(&:unlink) end def test_internal_commands @@ -43,12 +43,12 @@ def test_external_commands %w[brew-t1 brew-t2.rb brew-t3.py].each do |file| path = "#{dir}/#{file}" FileUtils.touch path - FileUtils.chmod 0744, path + FileUtils.chmod 0755, path end - FileUtils.touch "#{dir}/t4" + FileUtils.touch "#{dir}/brew-t4" - ENV["PATH"] = "#{ENV["PATH"]}#{File::PATH_SEPARATOR}#{dir}" + ENV["PATH"] += "#{File::PATH_SEPARATOR}#{dir}" cmds = Homebrew.external_commands assert cmds.include?("t1"), "Executable files should be included"
false
Other
Homebrew
brew
1c581a232cb59bea25d5cb3a4d4885854938ccb8.json
search: add alias -S back to zero-argument help Amends 132ada2b0ebb3751c0f8f42ca83bb257b55a50fd until we properly figure out a way of documenting built-in aliases (or not doing that) across all commands that currently have aliases. See #270 for full discussion.
Library/Homebrew/cmd/search.rb
@@ -1,4 +1,4 @@ -#: * `search`: +#: * `search`, `-S`: #: Display all locally available formulae for brewing (including tapped ones). #: No online search is performed if called without arguments. #:
true
Other
Homebrew
brew
1c581a232cb59bea25d5cb3a4d4885854938ccb8.json
search: add alias -S back to zero-argument help Amends 132ada2b0ebb3751c0f8f42ca83bb257b55a50fd until we properly figure out a way of documenting built-in aliases (or not doing that) across all commands that currently have aliases. See #270 for full discussion.
share/doc/homebrew/brew.1.html
@@ -314,7 +314,7 @@ <h2 id="COMMANDS">COMMANDS</h2> <p>If <code>--dry-run</code> or <code>-n</code> is passed, show what would be removed, but do not actually remove anything.</p></dd> <dt><code>reinstall</code> <var>formula</var></dt><dd><p>Uninstall then install <var>formula</var></p></dd> -<dt class="flush"><code>search</code></dt><dd><p>Display all locally available formulae for brewing (including tapped ones). +<dt><code>search</code>, <code>-S</code></dt><dd><p>Display all locally available formulae for brewing (including tapped ones). No online search is performed if called without arguments.</p></dd> <dt><code>search</code> [<code>--desc</code>] <var>text</var>|<code>/</code><var>text</var><code>/</code></dt><dd><p>Perform a substring search of formula names for <var>text</var>. If <var>text</var> is surrounded with slashes, then it is interpreted as a regular expression.
true
Other
Homebrew
brew
1c581a232cb59bea25d5cb3a4d4885854938ccb8.json
search: add alias -S back to zero-argument help Amends 132ada2b0ebb3751c0f8f42ca83bb257b55a50fd until we properly figure out a way of documenting built-in aliases (or not doing that) across all commands that currently have aliases. See #270 for full discussion.
share/man/man1/brew.1
@@ -426,7 +426,7 @@ If \fB\-\-dry\-run\fR or \fB\-n\fR is passed, show what would be removed, but do Uninstall then install \fIformula\fR . .TP -\fBsearch\fR +\fBsearch\fR, \fB\-S\fR Display all locally available formulae for brewing (including tapped ones)\. No online search is performed if called without arguments\. . .TP
true
Other
Homebrew
brew
75ab94c8ea8940f1609e62d23d45d8729dd4a83f.json
CurlDownloadStrategy: move no insecure redirect check to _fetch This mainly fixes the problems for subclasses of CurlDownloadStrategy. More specifically it fixes two things: * It allows the no insecure redirect check to be applied to CurlApacheMirrorDownloadStrategy. * It fixes previous broken CurlPostDownloadStrategy. Closes #280. Signed-off-by: Xu Cheng <xucheng@me.com>
Library/Homebrew/download_strategy.rb
@@ -284,17 +284,6 @@ def fetch ohai "Downloading #{@url}" unless cached_location.exist? - urls = actual_urls - unless urls.empty? - ohai "Downloading from #{urls.last}" - if !ENV["HOMEBREW_NO_INSECURE_REDIRECT"].nil? && @url.start_with?("https://") && - urls.any? { |u| !u.start_with? "https://" } - puts "HTTPS to HTTP redirect detected & HOMEBREW_NO_INSECURE_REDIRECT is set." - raise CurlDownloadStrategyError.new(@url) - end - @url = urls.last - end - had_incomplete_download = temporary_path.exist? begin _fetch @@ -334,6 +323,17 @@ def clear_cache # Private method, can be overridden if needed. def _fetch + urls = actual_urls + unless urls.empty? + ohai "Downloading from #{urls.last}" + if !ENV["HOMEBREW_NO_INSECURE_REDIRECT"].nil? && @url.start_with?("https://") && + urls.any? { |u| !u.start_with? "https://" } + puts "HTTPS to HTTP redirect detected & HOMEBREW_NO_INSECURE_REDIRECT is set." + raise CurlDownloadStrategyError.new(@url) + end + @url = urls.last + end + curl @url, "-C", downloaded_size, "-o", temporary_path end
false