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
76bfd0cecbe8ca74af5b8ea35a4a7251dd1fc729.json
Add superenv for Linux
Library/Homebrew/extend/os/extend/ENV/super.rb
@@ -1 +1,5 @@ -require "extend/os/mac/extend/ENV/super" if OS.mac? +if OS.mac? + require "extend/os/mac/extend/ENV/super" +elsif OS.linux? + require "extend/os/linux/extend/ENV/super" +end
true
Other
Homebrew
brew
76bfd0cecbe8ca74af5b8ea35a4a7251dd1fc729.json
Add superenv for Linux
Library/Homebrew/extend/os/linux/extend/ENV/super.rb
@@ -0,0 +1,33 @@ +module Superenv + # @private + def self.bin + (HOMEBREW_SHIMS_PATH/"linux/super").realpath + end + + def homebrew_extra_paths + paths = [] + paths += %w[binutils make].map do |f| + begin + bin = Formula[f].opt_bin + bin if bin.directory? + rescue FormulaUnavailableError + nil + end + end.compact + paths + end + + def determine_extra_rpath_paths(formula) + PATH.new( + formula&.lib, + "#{HOMEBREW_PREFIX}/lib", + PATH.new(run_time_deps.map { |dep| dep.opt_lib.to_s }).existing, + ) + end + + def determine_dynamic_linker_path + path = "#{HOMEBREW_PREFIX}/lib/ld.so" + return unless File.readable? path + path + end +end
true
Other
Homebrew
brew
76bfd0cecbe8ca74af5b8ea35a4a7251dd1fc729.json
Add superenv for Linux
Library/Homebrew/extend/os/mac/extend/ENV/super.rb
@@ -58,6 +58,14 @@ def homebrew_extra_isystem_paths def homebrew_extra_library_paths paths = [] + if compiler == :llvm_clang + if MacOS::CLT.installed? + paths << "/usr/lib" + else + paths << "#{MacOS.sdk_path}/usr/lib" + end + paths << Formula["llvm"].opt_lib.to_s + end paths << MacOS::X11.lib.to_s if x11? paths << "#{effective_sysroot}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries" paths
true
Other
Homebrew
brew
db56b1add5eddfe1413b3d8828635757a977ea39.json
python_virtualenv_constants: update virtualenv to 16.0.0
Library/Homebrew/language/python_virtualenv_constants.rb
@@ -1,2 +1,2 @@ -PYTHON_VIRTUALENV_URL = "https://files.pythonhosted.org/packages/b1/72/2d70c5a1de409ceb3a27ff2ec007ecdd5cc52239e7c74990e32af57affe9/virtualenv-15.2.0.tar.gz".freeze -PYTHON_VIRTUALENV_SHA256 = "1d7e241b431e7afce47e77f8843a276f652699d1fa4f93b9d8ce0076fd7b0b54".freeze +PYTHON_VIRTUALENV_URL = "https://files.pythonhosted.org/packages/33/bc/fa0b5347139cd9564f0d44ebd2b147ac97c36b2403943dbee8a25fd74012/virtualenv-16.0.0.tar.gz".freeze +PYTHON_VIRTUALENV_SHA256 = "ca07b4c0b54e14a91af9f34d0919790b016923d157afda5efdde55c96718f752".freeze
false
Other
Homebrew
brew
16e5799f8607b5120b05793b09d4c3bcc4703c8f.json
shims/linux/super/cc: Make changes for Linux
Library/Homebrew/shims/linux/super/cc
@@ -14,7 +14,7 @@ require "pathname" require "set" class Cmd - attr_reader :config, :prefix, :cellar, :opt, :tmpdir, :sysroot, :deps + attr_reader :config, :prefix, :cellar, :opt, :tmpdir, :deps attr_reader :archflags, :optflags, :keg_regex, :formula_prefix def initialize(arg0, args) @@ -25,7 +25,6 @@ class Cmd @cellar = ENV["HOMEBREW_CELLAR"] @opt = ENV["HOMEBREW_OPT"] @tmpdir = ENV["HOMEBREW_TEMP"] - @sysroot = ENV["HOMEBREW_SDKROOT"] @archflags = ENV.fetch("HOMEBREW_ARCHFLAGS") { "" }.split(" ") @optflags = ENV.fetch("HOMEBREW_OPTFLAGS") { "" }.split(" ") @deps = Set.new(ENV.fetch("HOMEBREW_DEPENDENCIES") { "" }.split(",")) @@ -37,6 +36,8 @@ class Cmd def mode if @arg0 == "cpp" || @arg0 == "ld" @arg0.to_sym + elsif @arg0 == "gold" || @arg0 == "ld.gold" + :ld elsif @args.include? "-c" if @arg0 =~ /(?:c|g|clang)\+\+/ :cxx @@ -59,6 +60,7 @@ class Cmd def tool @tool ||= case @arg0 when "ld" then "ld" + when "gold", "ld.gold" then "ld.gold" when "cpp" then "cpp" when /llvm_(clang(\+\+)?)/ "#{ENV["HOMEBREW_PREFIX"]}/opt/llvm/bin/#{$1}" @@ -74,11 +76,7 @@ class Cmd else # Note that this is a universal fallback, so that we'll always invoke # HOMEBREW_CC regardless of what name under which the tool was invoked. - if ENV["HOMEBREW_CC"] == "llvm_clang" - "#{ENV["HOMEBREW_PREFIX"]}/opt/llvm/bin/clang" - else - ENV["HOMEBREW_CC"] - end + ENV["HOMEBREW_CC"] end end @@ -96,14 +94,6 @@ class Cmd args = refurbished_args end - if sysroot - if tool == "ld" - args << "-syslibroot" << sysroot - else - args << "-isysroot" << sysroot << "--sysroot=#{sysroot}" - end - end - case mode when :ccld cflags + args + cppflags + ldflags @@ -123,7 +113,7 @@ class Cmd end def refurbished_args - @lset = Set.new(library_paths + system_library_paths) + @lset = Set.new(library_paths) @iset = Set.new(isystem_paths + include_paths) args = [] @@ -162,6 +152,8 @@ class Cmd /^-O[0-9zs]?$/, "-fast", "-no-cpp-precomp", "-pedantic", "-pedantic-errors", "-Wno-long-double", "-Wno-unused-but-set-variable" + when "-liconv", "-lintl" + # Not needed on Linux. when "-fopenmp", "-lgomp", "-mno-fused-madd", "-fforce-addr", "-fno-defer-pop", "-mno-dynamic-no-pic", "-fearly-inlining", /^-f(?:no-)?inline-functions-called-once/, /^-finline-limit/, /^-f(?:no-)?check-new/, "-fno-delete-null-pointer-checks", @@ -183,18 +175,10 @@ class Cmd args << arg when /^-W.*/ # prune warnings - when "-macosx_version_min", "-dylib_install_name" - args << "-Wl,#{arg},#{enum.next}" when "-multiply_definedsuppress" args << "-Wl,-multiply_defined,suppress" when "-undefineddynamic_lookup" args << "-Wl,-undefined,dynamic_lookup" - when /^-isysroot/, /^--sysroot/ - sdk = enum.next - # We set the sysroot for macOS SDKs - args << "-isysroot" << sdk unless sdk.downcase.include? "osx" - when "-dylib" - args << "-Wl,#{arg}" when /^-I(.+)?/ # Support both "-Ifoo" (one argument) and "-I foo" (two arguments) val = chuzzle($1) || enum.next @@ -204,6 +188,11 @@ class Cmd val = chuzzle($1) || enum.next path = canonical_path(val) args << "-L#{val}" if keep?(path) && @lset.add?(path) + when /^-R(.+)?/ + # -R is not the correct way to pass rpaths to the linker + path = chuzzle($1) || enum.next + wl = "-Wl," unless mode == :ld + args << "#{wl}-rpath=" if keep?(path) else args << arg end @@ -220,11 +209,8 @@ class Cmd elsif path.start_with?(cellar) || path.start_with?(opt) dep = path[keg_regex, 2] dep && @deps.include?(dep) - elsif path.start_with?(prefix) - true else - # ignore MacPorts, Boxen's Homebrew, X11, fink - !path.start_with?("/opt/local", "/opt/boxen/homebrew", "/opt/X11", "/sw", "/usr/X11") + path.start_with?(prefix, tmpdir) end end @@ -255,16 +241,12 @@ class Cmd end def ldflags - args = path_flags("-L", library_paths) - case mode - when :ld - args << "-headerpad_max_install_names" - args << "-no_weak_imports" if no_weak_imports? - when :ccld, :cxxld - args << "-Wl,-headerpad_max_install_names" - args << "-Wl,-no_weak_imports" if no_weak_imports? - end - args + wl = "-Wl," unless mode == :ld + args = [] + args += ["#{wl}--dynamic-linker=#{dynamic_linker_path}"] if dynamic_linker_path + args << "-B#{@opt}/glibc/lib" unless mode == :ld + args += path_flags("-L", library_paths) + args += rpath_flags("#{wl}-rpath=", rpath_paths) end def isystem_paths @@ -279,10 +261,12 @@ class Cmd path_split("HOMEBREW_LIBRARY_PATHS") end - def system_library_paths - paths = ["#{sysroot}/usr/lib"] - paths << "/usr/local/lib" unless sysroot || ENV["SDKROOT"] - paths + def rpath_paths + path_split("HOMEBREW_RPATH_PATHS") + end + + def dynamic_linker_path + chuzzle(ENV["HOMEBREW_DYNAMIC_LINKER"]) end def configure? @@ -310,10 +294,6 @@ class Cmd config.include?("K") end - def no_weak_imports? - config.include?("w") - end - def canonical_path(path) path = Pathname.new(path) path = path.realpath if path.exist? @@ -325,6 +305,12 @@ class Cmd paths.map! { |path| prefix + path } end + # Unlike path_flags, do not prune non-existant directories. + # formula.lib for example does not yet exist, but should not be pruned. + def rpath_flags(prefix, paths) + paths.uniq.map { |path| prefix + path } + end + def path_split(key) ENV.fetch(key) { "" }.split(File::PATH_SEPARATOR) end @@ -355,7 +341,7 @@ if __FILE__ == $PROGRAM_NAME if (cc = ENV["HOMEBREW_CC"]).nil? || cc.empty? || cc == "cc" # those values are not allowed - ENV["HOMEBREW_CC"] = "clang" + ENV["HOMEBREW_CC"] = "gcc" end ####################################################################### main @@ -368,6 +354,13 @@ if __FILE__ == $PROGRAM_NAME log(basename, ARGV, tool, args) + superbin = Pathname.new(__FILE__).dirname.realpath + paths = ENV["PATH"].split(":").reject do |x| + path = Pathname.new(x) + path.directory? && path.realpath == superbin + end + paths.unshift "#{ENV["HOMEBREW_PREFIX"]}/bin" + ENV["PATH"] = paths.join(":") args << { :close_others => false } - exec "#{dirname}/xcrun", tool, *args + exec tool, *args end
false
Other
Homebrew
brew
c8084244996e6b7a6f0e018f18703ff5c4190ed2.json
Adjust alignment of select and sort.
Library/Homebrew/cmd/outdated.rb
@@ -41,9 +41,8 @@ def print_outdated(formulae) verbose = ($stdout.tty? || ARGV.verbose?) && !ARGV.flag?("--quiet") fetch_head = ARGV.fetch_head? - outdated_formulae = formulae - .select { |f| f.outdated?(fetch_head: fetch_head) } - .sort + outdated_formulae = formulae.select { |f| f.outdated?(fetch_head: fetch_head) } + .sort outdated_formulae.each do |f| if verbose
false
Other
Homebrew
brew
8ab71de3e90838c685e85bd7c467041501fc3c8d.json
docs/_config.yml: use brew.sh theme name. This has been updated now we have a newer version of jekyll-remote-theme.
docs/_config.yml
@@ -1,7 +1,7 @@ title: Homebrew Documentation description: Documentation for the missing package manager for macOS. -remote_theme: Homebrew/brew-sh +remote_theme: Homebrew/brew.sh exclude: - bin
false
Other
Homebrew
brew
11c7b08a345142775be8b9f647618920f7cb03ca.json
formula: add versioned_formulae to to_hash.
Library/Homebrew/formula.rb
@@ -1559,6 +1559,7 @@ def to_hash "full_name" => full_name, "oldname" => oldname, "aliases" => aliases.sort, + "versioned_formulae" => versioned_formulae.map(&:name), "desc" => desc, "homepage" => homepage, "versions" => {
false
Other
Homebrew
brew
840c97c1cce29cdb7c5e453deb17b2023b35ea42.json
formula: add versioned formulae method.
Library/Homebrew/dev-cmd/audit.rb
@@ -251,11 +251,9 @@ def audit_file problem "#{formula} is versioned but no #{unversioned_name} formula exists" end elsif ARGV.build_stable? && formula.stable? && - !(versioned_formulae = Dir[formula.path.to_s.gsub(/\.rb$/, "@*.rb")]).empty? + !(versioned_formulae = formula.versioned_formulae).empty? versioned_aliases = formula.aliases.grep(/.@\d/) - _, last_alias_version = - File.basename(versioned_formulae.sort.reverse.first) - .gsub(/\.rb$/, "").split("@") + _, last_alias_version = versioned_formulae.map(&:name).last.split("@") major, minor, = formula.version.to_s.split(".") alias_name_major = "#{formula.name}@#{major}" alias_name_major_minor = "#{alias_name_major}.#{minor}"
true
Other
Homebrew
brew
840c97c1cce29cdb7c5e453deb17b2023b35ea42.json
formula: add versioned formulae method.
Library/Homebrew/formula.rb
@@ -370,6 +370,15 @@ def versioned_formula? name.include?("@") end + # Returns any `@`-versioned formulae for an non-`@`-versioned formula. + def versioned_formulae + return [] if versioned_formula? + + Pathname.glob(path.to_s.gsub(/\.rb$/, "@*.rb")).map do |path| + Formula[path.basename(".rb").to_s] + end.sort + end + # A named Resource for the currently active {SoftwareSpec}. # Additional downloads can be defined as {#resource}s. # {Resource#stage} will create a temporary directory and yield to a block.
true
Other
Homebrew
brew
840c97c1cce29cdb7c5e453deb17b2023b35ea42.json
formula: add versioned formulae method.
Library/Homebrew/test/formula_spec.rb
@@ -107,6 +107,56 @@ end end + describe "#versioned_formula?" do + let(:f) do + formula "foo" do + url "foo-1.0" + end + end + + let(:f2) do + formula "foo@2.0" do + url "foo-2.0" + end + end + + it "returns true for @-versioned formulae" do + expect(f2.versioned_formula?).to be true + end + + it "returns false for non-@-versioned formulae" do + expect(f.versioned_formula?).to be false + end + end + + describe "#versioned_formulae" do + let(:f) do + formula "foo" do + url "foo-1.0" + end + end + + let(:f2) do + formula "foo@2.0" do + url "foo-2.0" + end + end + + it "returns true by default" do + FileUtils.touch f.path + FileUtils.touch f2.path + allow(Formulary).to receive(:load_formula_from_path).with(f2.name, f2.path).and_return(f2) + allow(Formulary).to receive(:factory).with(f2.name).and_return(f2) + expect(f.versioned_formulae).to eq [f2] + end + + it "returns empty array for non-@-versioned formulae" do + FileUtils.touch f.path + FileUtils.touch f2.path + expect(f2.versioned_formulae).to be_empty + end + end + example "installed alias with core" do f = formula do url "foo-1.0" @@ -708,7 +758,7 @@ def test expect(f3.runtime_dependencies.map(&:name)).to eq(["foo/bar/f1", "baz/qux/f2"]) end - it "includes non-declared direct dependencies", :focus do + it "includes non-declared direct dependencies" do formula = Class.new(Testball).new dependency = formula("dependency") { url "f-1.0" }
true
Other
Homebrew
brew
524379e89785865370dab5300a6e566bef0a0b81.json
formula: improve dependencies hash output. It doesn't really make any sense for the `dependencies` hash to include all optional, recommended and build dependencies when these are already separately output.
Library/Homebrew/formula.rb
@@ -1564,7 +1564,7 @@ def to_hash "keg_only" => keg_only?, "options" => [], "build_dependencies" => dependencies.select(&:build?).map(&:name).uniq, - "dependencies" => dependencies.map(&:name).uniq, + "dependencies" => dependencies.reject(&:optional?).reject(&:recommended?).reject(&:build?).map(&:name).uniq, "recommended_dependencies" => dependencies.select(&:recommended?).map(&:name).uniq, "optional_dependencies" => dependencies.select(&:optional?).map(&:name).uniq, "requirements" => [],
false
Other
Homebrew
brew
efec2fa0c5cd868ec66a1e3e4ffc737b911ae5be.json
lines_cop: Add deprected options audit for depends_on
Library/Homebrew/rubocops/extend/formula_cop.rb
@@ -58,7 +58,7 @@ def audit_urls(urls, regex) # Returns all string nodes among the descendants of given node def find_strings(node) return [] if node.nil? - return node if node.str_type? + return [node] if node.str_type? node.each_descendant(:str) end
true
Other
Homebrew
brew
efec2fa0c5cd868ec66a1e3e4ffc737b911ae5be.json
lines_cop: Add deprected options audit for depends_on
Library/Homebrew/rubocops/lines_cop.rb
@@ -228,12 +228,15 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node) end find_every_method_call_by_name(body_node, :depends_on).each do |method| - next if modifier?(method.parent) param = parameters(method).first - dep, option = hash_dep(param) - next if dep.nil? || option.nil? - offending_node(param) - problem "Dependency #{string_content(dep)} should not use option #{string_content(option)}" + dep, option_child_nodes = hash_dep(param) + next if dep.nil? || option_child_nodes.empty? + option_child_nodes.each do |option| + find_strings(option).each do |dependency| + next unless match = regex_match_group(dependency, /(with(out)?-\w+|c\+\+11)/) + problem "Dependency #{string_content(dep)} should not use option #{match[0]}" + end + end end find_instance_method_call(body_node, :version, :==) do |method| @@ -363,10 +366,8 @@ def modifier?(node) (send nil? :depends_on $({str sym} _)))} EOS - # Match depends_on with hash as argument def_node_matcher :hash_dep, <<~EOS - {(hash (pair $(str _) $(str _))) - (hash (pair $(str _) (array $(str _) ...)))} + (hash (pair $(str _) $...)) EOS def_node_matcher :destructure_hash, <<~EOS
true
Other
Homebrew
brew
efec2fa0c5cd868ec66a1e3e4ffc737b911ae5be.json
lines_cop: Add deprected options audit for depends_on
Library/Homebrew/test/rubocops/lines_cop_spec.rb
@@ -693,13 +693,27 @@ class Foo < Formula RUBY end - it "dependencies with invalid options" do + it "dependencies with invalid options which lead to force rebuild" do expect_offense(<<~RUBY) class Foo < Formula desc "foo" url 'http://example.com/foo-1.0.tgz' depends_on "foo" => "with-bar" - ^^^^^^^^^^^^^^^^^^^ Dependency foo should not use option with-bar + ^^^^^^^^ Dependency foo should not use option with-bar + end + RUBY + end + + it "dependencies with invalid options in array value which lead to force rebuild" do + expect_offense(<<~RUBY) + class Foo < Formula + desc "foo" + url 'http://example.com/foo-1.0.tgz' + depends_on "httpd" => [:build, :test] + depends_on "foo" => [:optional, "with-bar"] + ^^^^^^^^ Dependency foo should not use option with-bar + depends_on "icu4c" => [:optional, "c++11"] + ^^^^^ Dependency icu4c should not use option c++11 end RUBY end
true
Other
Homebrew
brew
1ec12ebbf89c8f06fdf1ee5c9588ab4f58525bca.json
Add more Probots We're already using the stale bot which seems to work quite well for us. Let's also add: - [No Response](https://probot.github.io/apps/no-response/) (replacing [github-snooze-button](https://github.com/tdsmith/github-snooze-button)) - [Move Issues](https://probot.github.io/apps/move/) - [Support Requests](https://probot.github.io/apps/support/) - [Lock Threads](https://probot.github.io/apps/lock/)
.github/lock.yml
@@ -0,0 +1,13 @@ +# Configuration for lock-threads - https://github.com/dessant/lock-threads + +# Number of days of inactivity before a closed issue or pull request is locked +daysUntilLock: 30 +# Comment to post before locking. Set to `false` to disable +lockComment: false +# Issues or pull requests with these labels will not be locked +# exemptLabels: +# - no-locking +# Limit to only `issues` or `pulls` +# only: issues +# Add a label when locking. Set to `false` to disable +lockLabel: outdated
true
Other
Homebrew
brew
1ec12ebbf89c8f06fdf1ee5c9588ab4f58525bca.json
Add more Probots We're already using the stale bot which seems to work quite well for us. Let's also add: - [No Response](https://probot.github.io/apps/no-response/) (replacing [github-snooze-button](https://github.com/tdsmith/github-snooze-button)) - [Move Issues](https://probot.github.io/apps/move/) - [Support Requests](https://probot.github.io/apps/support/) - [Lock Threads](https://probot.github.io/apps/lock/)
.github/move.yml
@@ -0,0 +1,15 @@ +# Configuration for move-issues - https://github.com/dessant/move-issues + +# Delete the command comment. Ignored when the comment also contains other content +deleteCommand: true +# Close the source issue after moving +closeSourceIssue: true +# Lock the source issue after moving +lockSourceIssue: true +# Mention issue and comment authors +mentionAuthors: true +# Preserve mentions in the issue content +keepContentMentions: true +# Set custom aliases for targets +aliases: + core: Homebrew/homebrew-core
true
Other
Homebrew
brew
1ec12ebbf89c8f06fdf1ee5c9588ab4f58525bca.json
Add more Probots We're already using the stale bot which seems to work quite well for us. Let's also add: - [No Response](https://probot.github.io/apps/no-response/) (replacing [github-snooze-button](https://github.com/tdsmith/github-snooze-button)) - [Move Issues](https://probot.github.io/apps/move/) - [Support Requests](https://probot.github.io/apps/support/) - [Lock Threads](https://probot.github.io/apps/lock/)
.github/no-response.yml
@@ -0,0 +1,13 @@ +# Configuration for probot-no-response - https://github.com/probot/no-response + +# Number of days of inactivity before an Issue is closed for lack of response +daysUntilClose: 14 +# Label requiring a response +responseRequiredLabel: needs response +# Comment to post when closing an Issue for lack of response. Set to `false` to disable +closeComment: > + This issue has been automatically closed because there has been no response + to our request for more information from the original author. With only the + information that is currently in the issue, we don't have enough information + to take action. Please reach out if you have or find the answers we need so + that we can investigate further.
true
Other
Homebrew
brew
1ec12ebbf89c8f06fdf1ee5c9588ab4f58525bca.json
Add more Probots We're already using the stale bot which seems to work quite well for us. Let's also add: - [No Response](https://probot.github.io/apps/no-response/) (replacing [github-snooze-button](https://github.com/tdsmith/github-snooze-button)) - [Move Issues](https://probot.github.io/apps/move/) - [Support Requests](https://probot.github.io/apps/support/) - [Lock Threads](https://probot.github.io/apps/lock/)
.github/support.yml
@@ -0,0 +1,16 @@ +# Configuration for support-requests - https://github.com/dessant/support-requests + +# Label used to mark issues as support requests +supportLabel: support-request +# Comment to post on issues marked as support requests. Add a link +# to a support page, or set to `false` to disable +supportComment: > + We use the issue tracker exclusively for bug reports and feature requests. + However, this issue appears to be a support request. Please use our + [Discourse](https://discourse.brew.sh) or + [IRC channel](irc://irc.freenode.net/#machomebrew) to get help with + the project. +# Whether to close issues marked as support requests +close: true +# Whether to lock issues marked as support requests +lock: true
true
Other
Homebrew
brew
877f0595529e4bab54f8bce61604cc9ea43f2a99.json
docs/_config.yml: remove GitHub repository. This seems like it could fix the GitHub Pages build.
docs/_config.yml
@@ -1,7 +1,7 @@ title: Homebrew Documentation description: Documentation for the missing package manager for macOS. -remote_theme: Homebrew/jekyll-theme-homebrew +remote_theme: Homebrew/brew-sh exclude: - bin @@ -25,9 +25,6 @@ defaults: logo: /assets/img/homebrew-256x256.png -github: - repository_nwo: Homebrew/brew - twitter: username: MacHomebrew
false
Other
Homebrew
brew
38ae15fe7d9a90166cad8b1d6f180eac485bfcc0.json
Remove completions for (un)linkapps commands These were deleted in cffa5a9864e771f19231537b812b9b32a1160be0.
completions/bash/brew
@@ -251,17 +251,6 @@ _brew_link() { __brew_complete_installed } -_brew_linkapps() { - local cur="${COMP_WORDS[COMP_CWORD]}" - case "$cur" in - --*) - __brewcomp "--local" - return - ;; - esac - __brew_complete_installed -} - _brew_list() { local allopts="--unbrewed --verbose --pinned --versions --multiple" local cur="${COMP_WORDS[COMP_CWORD]}" @@ -482,17 +471,6 @@ _brew_uninstall() { __brew_complete_installed } -_brew_unlinkapps() { - local cur="${COMP_WORDS[COMP_CWORD]}" - case "$cur" in - --*) - __brewcomp "--dry-run --local" - return - ;; - esac - __brew_complete_installed -} - _brew_unpack() { local cur="${COMP_WORDS[COMP_CWORD]}" case "$cur" in @@ -827,7 +805,6 @@ _brew() { install|instal) _brew_install ;; irb) _brew_irb ;; link|ln) _brew_link ;; - linkapps) _brew_linkapps ;; list|ls) _brew_list ;; log) _brew_log ;; man) _brew_man ;; @@ -852,7 +829,6 @@ _brew() { tests) _brew_tests ;; uninstall|remove|rm) _brew_uninstall ;; unlink) __brew_complete_installed ;; - unlinkapps) _brew_unlinkapps ;; unpack) _brew_unpack ;; unpin) __brew_complete_formulae ;; untap) __brew_complete_tapped ;;
true
Other
Homebrew
brew
38ae15fe7d9a90166cad8b1d6f180eac485bfcc0.json
Remove completions for (un)linkapps commands These were deleted in cffa5a9864e771f19231537b812b9b32a1160be0.
completions/zsh/_brew
@@ -89,7 +89,6 @@ __brew_common_commands() { 'reinstall:install a formula anew; re-using its current options' 'leaves:show installed formulae that are not dependencies of another installed formula' 'link:link a formula' - 'linkapps:symlink .app bundles provided by formulae into /Applications' 'list:list files in a formula or not-installed formulae' 'log:git commit log for a formula' 'missing:check all installed formuale for missing dependencies.' @@ -108,7 +107,6 @@ __brew_common_commands() { 'test-bot:test a formula and build a bottle' 'uninstall:uninstall a formula' 'unlink:unlink a formula' - 'unlinkapps:remove symlinked .app bundles provided by formulae from /Applications' 'unpin:unpin specified formulae' 'untap:remove a tapped repository' 'update:fetch latest version of Homebrew and all formulae' @@ -448,13 +446,6 @@ _brew_linkage() { ':formula:__brew_installed_formulae' } -# brew linkapps [--local] [formulae]: -_brew_linkapps() { - _arguments \ - '(--local)--local[symlink into ~/Application instead of the system directory]' \ - '::formula:__brew_installed_formulae' -} - # brew list, ls [--full-name]: # brew list, ls --unbrewed: # brew list, ls [--versions [--multiple]] [--pinned] [formulae]: @@ -704,14 +695,6 @@ _brew_unlink() { ':formula:__brew_installed_formulae' } -# brew unlinkapps [--local] [--dry-run] [formulae]: -_brew_unlinkapps() { - _arguments \ - '(--local)--local[remove symlinks from ~/Applications instead of the system directory]' \ - '(--dry-run -n)'{--dry-run,-n}'[don''t unlink or delete any files]' \ - ':formula:__brew_installed_formulae' -} - # brew unpack [--git|--patch] [--destdir=path] formulae: _brew_unpack() { _arguments \
true
Other
Homebrew
brew
191724ce83b165479e2663625cf18ef4b50c11ee.json
formula: read runtime dependencies from more tabs. The fixes the issue mentioned in: https://github.com/Homebrew/brew/pull/4066#issuecomment-381308153 where `brew missing` was not reading from a tab of an outdated formula. The `installed_prefix.directory?` check is unnecessary as the following `opt_or_installed_prefix_keg` call is already checking that when it is necessary. In this case it's not necessary anyway as `opt_prefix` is preferred and makes more sense on outdated formulae.
Library/Homebrew/formula.rb
@@ -1502,7 +1502,6 @@ def opt_or_installed_prefix_keg # @private def runtime_dependencies(read_from_tab: true) if read_from_tab && - installed_prefix.directory? && (keg = opt_or_installed_prefix_keg) && (tab_deps = keg.runtime_dependencies) return tab_deps.map { |d| Dependency.new d["full_name"] }.compact
false
Other
Homebrew
brew
8035afcc36ac45ebd127f670b13ab32414c310fa.json
linkage_checker: fix generic pathname calls.
Library/Homebrew/extend/pathname.rb
@@ -472,9 +472,17 @@ def inspect } end + def binary_executable? + false + end + def mach_o_bundle? false end + + def dylib? + false + end end require "extend/os/pathname"
true
Other
Homebrew
brew
8035afcc36ac45ebd127f670b13ab32414c310fa.json
linkage_checker: fix generic pathname calls.
Library/Homebrew/linkage_checker.rb
@@ -66,7 +66,7 @@ def check_dylibs checked_dylibs = Set.new @keg.find do |file| next if file.symlink? || file.directory? - next unless file.dylib? || file.binary_executable? || file.mach_o_bundle? + next if !file.dylib? && !file.binary_executable? && !file.mach_o_bundle? # weakly loaded dylibs may not actually exist on disk, so skip them # when checking for broken linkage
true
Other
Homebrew
brew
3454d6a96199cc4f405a52d1525d0cc760a0ebf8.json
runtime_deps: improve documentation and consistency.
Library/Homebrew/formula.rb
@@ -1487,34 +1487,45 @@ def recursive_requirements(&block) Requirement.expand(self, &block) end + # Returns a Keg for the opt_prefix or installed_prefix if they exist. + # If not, return nil. + # @private + def opt_or_installed_prefix_keg + if optlinked? && opt_prefix.exist? + Keg.new(opt_prefix) + elsif installed_prefix.directory? + Keg.new(installed_prefix) + end + end + # Returns a list of Dependency objects that are required at runtime. # @private def runtime_dependencies(read_from_tab: true) if read_from_tab && installed_prefix.directory? && - (keg = Keg.new(installed_prefix)) && + (keg = opt_or_installed_prefix_keg) && (tab_deps = keg.runtime_dependencies) return tab_deps.map { |d| Dependency.new d["full_name"] }.compact end declared_runtime_dependencies | undeclared_runtime_dependencies end + # Returns a list of Dependency objects that are declared in the formula. + # @private def declared_runtime_dependencies recursive_dependencies do |_, dependency| Dependency.prune if dependency.build? Dependency.prune if !dependency.required? && build.without?(dependency) end end + # Returns a list of Dependency objects that are not declared in the formula + # but the formula links to. + # @private def undeclared_runtime_dependencies - if optlinked? - keg = Keg.new(opt_prefix) - elsif prefix.directory? - keg = Keg.new(prefix) - else - return [] - end + keg = opt_or_installed_prefix_keg + return [] unless keg linkage_checker = LinkageChecker.new(keg, self) linkage_checker.undeclared_deps.map { |n| Dependency.new(n) }
true
Other
Homebrew
brew
3454d6a96199cc4f405a52d1525d0cc760a0ebf8.json
runtime_deps: improve documentation and consistency.
Library/Homebrew/linkage_checker.rb
@@ -2,6 +2,8 @@ require "formula" class LinkageChecker + attr_reader :undeclared_deps + def initialize(keg, formula = nil) @keg = keg @formula = formula || resolve_formula(keg) @@ -142,7 +144,7 @@ def check_undeclared_deps missing_deps = @broken_deps.values.flatten.map { |d| dylib_to_dep(d) } unnecessary_deps -= missing_deps - + [indirect_deps, undeclared_deps, unnecessary_deps] end
true
Other
Homebrew
brew
3454d6a96199cc4f405a52d1525d0cc760a0ebf8.json
runtime_deps: improve documentation and consistency.
Library/Homebrew/test/formula_spec.rb
@@ -708,19 +708,18 @@ def test expect(f3.runtime_dependencies.map(&:name)).to eq(["foo/bar/f1", "baz/qux/f2"]) end - it "includes non-declared direct dependencies" do + it "includes non-declared direct dependencies", :focus do formula = Class.new(Testball).new dependency = formula("dependency") { url "f-1.0" } formula.brew { formula.install } - keg = Keg.for(formula.prefix) + keg = Keg.for(formula.installed_prefix) keg.link linkage_checker = double("linkage checker", undeclared_deps: [dependency.name]) - allow(LinkageChecker).to receive(:new).with(keg, any_args) - .and_return(linkage_checker) + allow(LinkageChecker).to receive(:new).and_return(linkage_checker) - expect(formula.runtime_dependencies).to include an_object_having_attributes(name: dependency.name) + expect(formula.runtime_dependencies.map(&:name)).to eq [dependency.name] end end
true
Other
Homebrew
brew
71f4f522d7b9d8f3d4996feb6cc36003d3a4246e.json
missing_formula: improve migration messaging. Particularly in the cask case we can do a better job of communicating how the new formula can be installed. Fixes #4089.
Library/Homebrew/missing_formula.rb
@@ -93,17 +93,26 @@ def tap_migration_reason(name) new_tap = old_tap.tap_migrations[name] next unless new_tap - new_tap_user, new_tap_repo, = new_tap.split("/") + new_tap_user, new_tap_repo, new_tap_new_name = new_tap.split("/") new_tap_name = "#{new_tap_user}/#{new_tap_repo}" message = <<~EOS It was migrated from #{old_tap} to #{new_tap}. EOS break if new_tap_name == CoreTap.instance.name + install_cmd = if new_tap_user == "caskroom" + "cask install" + else + "install" + end + new_tap_new_name ||= name + message += <<~EOS You can access it again by running: brew tap #{new_tap_name} + And then you can install it by running: + brew #{install_cmd} #{new_tap_new_name} EOS break end
false
Other
Homebrew
brew
aad17dac3580e80b9f4c915c9e7d9feac4e8eabd.json
Shorten some links in README.md
README.md
@@ -22,7 +22,7 @@ Second, read the [Troubleshooting Checklist](https://docs.brew.sh/Troubleshootin [![Travis](https://img.shields.io/travis/Homebrew/brew.svg)](https://travis-ci.org/Homebrew/brew) [![Codecov](https://img.shields.io/codecov/c/github/Homebrew/brew.svg)](https://codecov.io/gh/Homebrew/brew) -We'd love you to contribute to Homebrew. First, please read our [Contribution Guide](https://github.com/Homebrew/brew/blob/master/CONTRIBUTING.md) and [Code of Conduct](https://github.com/Homebrew/brew/blob/master/CODE_OF_CONDUCT.md#code-of-conduct). +We'd love you to contribute to Homebrew. First, please read our [Contribution Guide](CONTRIBUTING.md) and [Code of Conduct](CODE_OF_CONDUCT.md#code-of-conduct). We explicitly welcome contributions from people who have never contributed to open-source before: we were all beginners once! We can help build on a partially working pull request with the aim of getting it merged. We are also actively seeking to diversify our contributors and especially welcome contributions from women from all backgrounds and people of colour. @@ -52,7 +52,7 @@ Former maintainers with significant contributions include [Tim Smith](https://gi - [@MacHomebrew (Twitter)](https://twitter.com/MacHomebrew) ## License -Code is under the [BSD 2-clause "Simplified" License](https://github.com/Homebrew/brew/tree/master/LICENSE.txt). +Code is under the [BSD 2-clause "Simplified" License](LICENSE.txt). Documentation is under the [Creative Commons Attribution license](https://creativecommons.org/licenses/by/4.0/). ## Donations
false
Other
Homebrew
brew
9f1b64a9d44650ac36f8bfacfc325c67364a2837.json
Add additional specs for `PATH`.
Library/Homebrew/PATH.rb
@@ -32,7 +32,7 @@ def reject(&block) end def to_ary - @paths + @paths.dup.to_ary end alias to_a to_ary
true
Other
Homebrew
brew
9f1b64a9d44650ac36f8bfacfc325c67364a2837.json
Add additional specs for `PATH`.
Library/Homebrew/test/PATH_spec.rb
@@ -23,6 +23,13 @@ it "returns a PATH array" do expect(described_class.new("/path1", "/path2").to_ary).to eq(["/path1", "/path2"]) end + + it "does not allow mutating the original" do + path = described_class.new("/path1", "/path2") + path.to_ary << "/path3" + + expect(path).not_to include("/path3") + end end describe "#to_str" do @@ -61,6 +68,12 @@ end end + describe "#==" do + it "always returns false when comparing against something which does not respons to `#to_ary` or `#to_str`" do + expect(described_class.new).not_to eq Object.new + end + end + describe "#include?" do it "returns true if a path is included" do path = described_class.new("/path1", "/path2")
true
Other
Homebrew
brew
0432feabd33e4fa02e5089783080e9568c982a77.json
Add missing blacklisted Formulae.
Library/Homebrew/test/missing_formula_spec.rb
@@ -66,6 +66,14 @@ expect("haskell-platform").to be_blacklisted end + specify "mysqldump-secure is blacklisted" do + expect("mysqldump-secure").to be_blacklisted + end + + specify "ngrok is blacklisted" do + expect("ngrok").to be_blacklisted + end + specify "Xcode is blacklisted", :needs_macos do expect(%w[xcode Xcode]).to all be_blacklisted end
false
Other
Homebrew
brew
a4bada575ae7957feb0de1ac4ea6bdc403e44da3.json
requirements: define cask on base class. The `cask` attribute doesn't make as much sense on Linux but can be ignored there. The advantage of this change is that (like #4086) it allows figuring out the relevant cask for a formulae requirement on a Linux machine.
Library/Homebrew/extend/os/mac/requirements/java_requirement.rb
@@ -4,29 +4,10 @@ class JavaRequirement < Requirement env_oracle_jdk || env_apple end - # A strict Java 8 requirement (1.8) should prompt the user to install - # the legacy java8 cask because versions newer than Java 8 are not - # completely backwards compatible, and contain breaking changes such as - # strong encapsulation of JDK-internal APIs and a modified version scheme - # (*.0 not 1.*). - def cask - if @version.nil? || @version.to_s.end_with?("+") || - @version.to_f >= JAVA_CASK_MAP.keys.max.to_f - JAVA_CASK_MAP.fetch(JAVA_CASK_MAP.keys.max) - else - JAVA_CASK_MAP.fetch("1.8") - end - end - private undef possible_javas, oracle_java_os - JAVA_CASK_MAP = { - "1.8" => "caskroom/versions/java8", - "10.0" => "java", - }.freeze - def possible_javas javas = [] javas << Pathname.new(ENV["JAVA_HOME"])/"bin/java" if ENV["JAVA_HOME"]
true
Other
Homebrew
brew
a4bada575ae7957feb0de1ac4ea6bdc403e44da3.json
requirements: define cask on base class. The `cask` attribute doesn't make as much sense on Linux but can be ignored there. The advantage of this change is that (like #4086) it allows figuring out the relevant cask for a formulae requirement on a Linux machine.
Library/Homebrew/extend/os/mac/requirements/osxfuse_requirement.rb
@@ -1,7 +1,6 @@ require "requirement" class OsxfuseRequirement < Requirement - cask "osxfuse" download "https://osxfuse.github.io/" satisfy(build_env: false) { self.class.binary_osxfuse_installed? }
true
Other
Homebrew
brew
a4bada575ae7957feb0de1ac4ea6bdc403e44da3.json
requirements: define cask on base class. The `cask` attribute doesn't make as much sense on Linux but can be ignored there. The advantage of this change is that (like #4086) it allows figuring out the relevant cask for a formulae requirement on a Linux machine.
Library/Homebrew/extend/os/mac/requirements/x11_requirement.rb
@@ -1,7 +1,6 @@ require "requirement" class X11Requirement < Requirement - cask "xquartz" download "https://xquartz.macosforge.org" satisfy build_env: false do
true
Other
Homebrew
brew
a4bada575ae7957feb0de1ac4ea6bdc403e44da3.json
requirements: define cask on base class. The `cask` attribute doesn't make as much sense on Linux but can be ignored there. The advantage of this change is that (like #4086) it allows figuring out the relevant cask for a formulae requirement on a Linux machine.
Library/Homebrew/requirements/java_requirement.rb
@@ -4,6 +4,20 @@ class JavaRequirement < Requirement fatal true download "https://www.oracle.com/technetwork/java/javase/downloads/index.html" + # A strict Java 8 requirement (1.8) should prompt the user to install + # the legacy java8 cask because versions newer than Java 8 are not + # completely backwards compatible, and contain breaking changes such as + # strong encapsulation of JDK-internal APIs and a modified version scheme + # (*.0 not 1.*). + def cask + if @version.nil? || @version.to_s.end_with?("+") || + @version.to_f >= JAVA_CASK_MAP.keys.max.to_f + JAVA_CASK_MAP.fetch(JAVA_CASK_MAP.keys.max) + else + JAVA_CASK_MAP.fetch("1.8") + end + end + satisfy build_env: false do setup_java next false unless @java @@ -42,6 +56,11 @@ def display_s private + JAVA_CASK_MAP = { + "1.8" => "caskroom/versions/java8", + "10.0" => "java", + }.freeze + def version_without_plus if exact_version? @version
true
Other
Homebrew
brew
a4bada575ae7957feb0de1ac4ea6bdc403e44da3.json
requirements: define cask on base class. The `cask` attribute doesn't make as much sense on Linux but can be ignored there. The advantage of this change is that (like #4086) it allows figuring out the relevant cask for a formulae requirement on a Linux machine.
Library/Homebrew/requirements/osxfuse_requirement.rb
@@ -1,6 +1,7 @@ require "requirement" class OsxfuseRequirement < Requirement + cask "osxfuse" fatal true end
true
Other
Homebrew
brew
a4bada575ae7957feb0de1ac4ea6bdc403e44da3.json
requirements: define cask on base class. The `cask` attribute doesn't make as much sense on Linux but can be ignored there. The advantage of this change is that (like #4086) it allows figuring out the relevant cask for a formulae requirement on a Linux machine.
Library/Homebrew/requirements/x11_requirement.rb
@@ -5,6 +5,7 @@ class X11Requirement < Requirement fatal true + cask "xquartz" env { ENV.x11 } def initialize(name = "x11", tags = [])
true
Other
Homebrew
brew
7166289ad757641e54812bde742ea8c883510b0b.json
os/mac/xcode: revert an installed? guard removal. Fixes #4084.
Library/Homebrew/os/mac/xcode.rb
@@ -280,7 +280,9 @@ def version def detect_version # CLT isn't a distinct entity pre-4.3, and pkgutil doesn't exist # at all on Tiger, so just count it as installed if Xcode is installed - return MacOS::Xcode.version if MacOS::Xcode.version < "3.0" + if MacOS::Xcode.installed? && MacOS::Xcode.version < "3.0" + return MacOS::Xcode.version + end version = nil [MAVERICKS_PKG_ID, MAVERICKS_NEW_PKG_ID, STANDALONE_PKG_ID, FROM_XCODE_PKG_ID].each do |id|
false
Other
Homebrew
brew
6714acc09809b3548960ee1d29d180e036348391.json
Add missing `MacOS.release` deprecation.
Library/Homebrew/compat.rb
@@ -8,3 +8,4 @@ require "compat/extend/string" require "compat/gpg" require "compat/dependable" +require "compat/os/mac"
true
Other
Homebrew
brew
6714acc09809b3548960ee1d29d180e036348391.json
Add missing `MacOS.release` deprecation.
Library/Homebrew/compat/os/mac.rb
@@ -0,0 +1,10 @@ +module OS + module Mac + class << self + def release + odeprecated "MacOS.release", "MacOS.version" + version + end + end + end +end
true
Other
Homebrew
brew
20155c8df9569e78a16ea47136a711469a29e5b7.json
bump-formula-pr: Use Parser to parse args
Library/Homebrew/dev-cmd/bump-formula-pr.rb
@@ -42,80 +42,31 @@ #: the preexisting formula already uses. require "formula" +require "cli_parser" module Homebrew module_function - def inreplace_pairs(path, replacement_pairs) - if ARGV.dry_run? - contents = path.open("r") { |f| Formulary.ensure_utf8_encoding(f).read } - contents.extend(StringInreplaceExtension) - replacement_pairs.each do |old, new| - unless ARGV.flag?("--quiet") - ohai "replace #{old.inspect} with #{new.inspect}" - end - contents.gsub!(old, new) - end - unless contents.errors.empty? - raise Utils::InreplaceError, path => contents.errors - end - path.atomic_write(contents) if ARGV.include?("--write") - contents - else - Utils::Inreplace.inreplace(path) do |s| - replacement_pairs.each do |old, new| - unless ARGV.flag?("--quiet") - ohai "replace #{old.inspect} with #{new.inspect}" - end - s.gsub!(old, new) - end - end - path.open("r") { |f| Formulary.ensure_utf8_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 fetch_pull_requests(formula) - GitHub.issues_for_formula(formula.name, tap: formula.tap).select do |pr| - pr["html_url"].include?("/pull/") && - /(^|\s)#{Regexp.quote(formula.name)}(:|\s|$)/i =~ pr["title"] - end - rescue GitHub::RateLimitExceededError => e - opoo e.message - [] - end - - def check_for_duplicate_pull_requests(formula) - pull_requests = fetch_pull_requests(formula) - return unless pull_requests - return if pull_requests.empty? - duplicates_message = <<~EOS - These open pull requests may be duplicates: - #{pull_requests.map { |pr| "#{pr["title"]} #{pr["html_url"]}" }.join("\n")} - EOS - error_message = "Duplicate PRs should not be opened. Use --force to override this error." - if ARGV.force? && !ARGV.flag?("--quiet") - opoo duplicates_message - elsif !ARGV.force? && ARGV.flag?("--quiet") - odie error_message - elsif !ARGV.force? - odie <<~EOS - #{duplicates_message.chomp} - #{error_message} - EOS + def bump_formula_pr + @args = Homebrew::CLI::Parser.parse do + switch "--devel" + switch "-n", "--dry-run" + switch "--write" + switch "--audit" + switch "--strict" + switch "--no-browse" + switch :quiet + switch :force + switch :debug + flag "--url", required: true + flag "--sha256", required: true + flag "--mirror", required: true + flag "--tag", required: true + flag "--revision", required: true + flag "--version", required: true + flag "--message", required: true end - end - def bump_formula_pr # As this command is simplifying user run commands then let's just use a # user path, too. ENV["PATH"] = ENV["HOMEBREW_PATH"] @@ -141,7 +92,7 @@ def bump_formula_pr checked_for_duplicates = true end - new_url = ARGV.value("url") + new_url = @args.url if new_url && !formula # Split the new URL on / and find any formulae that have the same URL # except for the last component, but don't try to match any more than the @@ -152,7 +103,7 @@ def bump_formula_pr components_to_match = [new_url_split.count - 1, maximum_url_components_to_match].min base_url = new_url_split.first(components_to_match).join("/") base_url = /#{Regexp.escape(base_url)}/ - is_devel = ARGV.include?("--devel") + is_devel = @args.devel? guesses = [] Formula.each do |f| if is_devel && f.devel && f.devel.url && f.devel.url.match(base_url) @@ -171,7 +122,7 @@ def bump_formula_pr check_for_duplicate_pull_requests(formula) unless checked_for_duplicates - requested_spec, formula_spec = if ARGV.include?("--devel") + requested_spec, formula_spec = if @args.devel? devel_message = " (devel)" [:devel, formula.devel] else @@ -180,14 +131,14 @@ def bump_formula_pr odie "#{formula}: no #{requested_spec} specification found!" unless formula_spec hash_type, old_hash = if (checksum = formula_spec.checksum) - [checksum.hash_type.to_s, checksum.hexdigest] + [checksum.hash_type, checksum.hexdigest] end - new_hash = ARGV.value(hash_type) - new_tag = ARGV.value("tag") - new_revision = ARGV.value("revision") - new_mirror = ARGV.value("mirror") - forced_version = ARGV.value("version") + new_hash = @args[hash_type] + new_tag = @args.tag + new_revision = @args.revision + new_mirror = @args.mirror + forced_version = @args.version new_url_hash = if new_url && new_hash true elsif new_tag && new_revision @@ -224,7 +175,7 @@ def bump_formula_pr end end - if ARGV.dry_run? + if @args.dry_run? ohai "brew update" else safe_system "brew", "update" @@ -253,7 +204,7 @@ def bump_formula_pr ] end - backup_file = File.read(formula.path) unless ARGV.dry_run? + backup_file = File.read(formula.path) unless @args.dry_run? if new_mirror replacement_pairs << [/^( +)(url \"#{Regexp.escape(new_url)}\"\n)/m, "\\1\\2\\1mirror \"#{new_mirror}\"\n"] @@ -283,31 +234,31 @@ def bump_formula_pr new_formula_version = formula_version(formula, requested_spec, new_contents) if new_formula_version < old_formula_version - formula.path.atomic_write(backup_file) unless ARGV.dry_run? + formula.path.atomic_write(backup_file) unless @args.dry_run? odie <<~EOS 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 - formula.path.atomic_write(backup_file) unless ARGV.dry_run? + formula.path.atomic_write(backup_file) unless @args.dry_run? odie <<~EOS You probably need to bump this formula manually since the new version and old version are both #{new_formula_version}. EOS end - if ARGV.dry_run? - if ARGV.include? "--strict" + if @args.dry_run? + if @args.strict? ohai "brew audit --strict #{formula.path.basename}" - elsif ARGV.include? "--audit" + elsif @args.audit? ohai "brew audit #{formula.path.basename}" end else failed_audit = false - if ARGV.include? "--strict" + if @args.strict? system HOMEBREW_BREW_FILE, "audit", "--strict", formula.path failed_audit = !$CHILD_STATUS.success? - elsif ARGV.include? "--audit" + elsif @args.audit? system HOMEBREW_BREW_FILE, "audit", formula.path failed_audit = !$CHILD_STATUS.success? end @@ -322,7 +273,7 @@ def bump_formula_pr git_dir = Utils.popen_read("git rev-parse --git-dir").chomp shallow = !git_dir.empty? && File.exist?("#{git_dir}/shallow") - if ARGV.dry_run? + if @args.dry_run? ohai "fork repository with GitHub API" ohai "git fetch --unshallow origin" if shallow ohai "git checkout --no-track -b #{branch} origin/master" @@ -337,7 +288,7 @@ def bump_formula_pr # GitHub API responds immediately but fork takes a few seconds to be ready. sleep 3 rescue *gh_api_errors => e - formula.path.atomic_write(backup_file) unless ARGV.dry_run? + formula.path.atomic_write(backup_file) unless @args.dry_run? odie "Unable to fork: #{e.message}!" end @@ -354,7 +305,7 @@ def bump_formula_pr pr_message = <<~EOS Created with `brew bump-formula-pr`. EOS - user_message = ARGV.value("message") + user_message = @args.message if user_message pr_message += "\n" + <<~EOS --- @@ -367,7 +318,7 @@ def bump_formula_pr begin url = GitHub.create_pull_request(formula.tap.full_name, pr_title, "#{username}:#{branch}", "master", pr_message)["html_url"] - if ARGV.include?("--no-browse") + if @args.no_browse? puts url else exec_browser url @@ -378,4 +329,73 @@ def bump_formula_pr end end end + + def inreplace_pairs(path, replacement_pairs) + if @args.dry_run? + contents = path.open("r") { |f| Formulary.ensure_utf8_encoding(f).read } + contents.extend(StringInreplaceExtension) + replacement_pairs.each do |old, new| + unless Homebrew.args.quiet? + ohai "replace #{old.inspect} with #{new.inspect}" + end + contents.gsub!(old, new) + end + unless contents.errors.empty? + raise Utils::InreplaceError, path => contents.errors + end + path.atomic_write(contents) if @args.write? + contents + else + Utils::Inreplace.inreplace(path) do |s| + replacement_pairs.each do |old, new| + unless Homebrew.args.quiet? + ohai "replace #{old.inspect} with #{new.inspect}" + end + s.gsub!(old, new) + end + end + path.open("r") { |f| Formulary.ensure_utf8_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 fetch_pull_requests(formula) + GitHub.issues_for_formula(formula.name, tap: formula.tap).select do |pr| + pr["html_url"].include?("/pull/") && + /(^|\s)#{Regexp.quote(formula.name)}(:|\s|$)/i =~ pr["title"] + end + rescue GitHub::RateLimitExceededError => e + opoo e.message + [] + end + + def check_for_duplicate_pull_requests(formula) + pull_requests = fetch_pull_requests(formula) + return unless pull_requests + return if pull_requests.empty? + duplicates_message = <<~EOS + These open pull requests may be duplicates: + #{pull_requests.map { |pr| "#{pr["title"]} #{pr["html_url"]}" }.join("\n")} + EOS + error_message = "Duplicate PRs should not be opened. Use --force to override this error." + if Homebrew.args.force? && !Homebrew.args.quiet? + opoo duplicates_message + elsif !Homebrew.args.force? && Homebrew.args.quiet? + odie error_message + elsif !Homebrew.args.force? + odie <<~EOS + #{duplicates_message.chomp} + #{error_message} + EOS + end + end end
false
Other
Homebrew
brew
cb5684831e30e133ea9d771d6354adaa7e0af8cc.json
Remove unused `Buffer` class.
Library/Homebrew/cask/lib/hbc/utils.rb
@@ -4,17 +4,6 @@ BUG_REPORTS_URL = "https://github.com/caskroom/homebrew-cask#reporting-bugs".freeze -class Buffer < StringIO - extend Predicable - - attr_predicate :tty? - - def initialize(tty = false) - super() - @tty = tty - end -end - # global methods def odebug(title, *sput)
false
Other
Homebrew
brew
6b3ee9b8fd813c7b1479e629348cb1b096a89819.json
docs/Analytics: note retention period. Due to [GDPR](https://www.eugdpr.org) Google Analytics have added [data retention controls](https://support.google.com/analytics/answer/7667196). Let's set these so that we don't keep any anonymous user data any longer than we need it.
docs/Analytics.md
@@ -8,6 +8,9 @@ Homebrew is provided free of charge and run entirely by volunteers in their spar - If a formula is widely used and is failing often it will enable us to prioritise fixing that formula over others. - Collecting the OS version allows us to decide what versions of macOS to prioritise and support and identify build failures that occur only on single versions. +## How Long? +Homebrew's anonymous user and event data have a 14 month retention period. This is the [lowest possible value for Google Analytics](https://support.google.com/analytics/answer/7667196). + ## What? Homebrew's analytics record some shared information for every event:
false
Other
Homebrew
brew
9b8c30e0c8d04b66c4415c27041423b372c14066.json
compat/extend/string: fix odisabled return. `odisabled` will still return for a formula in `.brew`. This means `EOS.undent` returns `nil` and the formula cannot be parsed. Instead return the actual string in this case to avoid e.g. patches blowing up with `nil` strings. Fixes #4049.
Library/Homebrew/compat/extend/string.rb
@@ -1,6 +1,7 @@ class String def undent odisabled "<<-EOS.undent", "<<~EOS" + self end alias unindent undent
false
Other
Homebrew
brew
d8cc56c1d0dbf3754fa52724dc51d5c234712004.json
release-notes: update documentation and manual page
docs/Manpage.md
@@ -850,7 +850,7 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note * `release-notes` [`--markdown`] [`previous_tag`] [`end_ref`]: Output the merged pull requests on Homebrew/brew between two Git refs. - If no `previous_tag` is provided it defaults to the newest tag. + If no `previous_tag` is provided it defaults to the latest tag. If no `end_ref` is provided it defaults to `origin/master`. If `--markdown` is passed, output as a Markdown list.
true
Other
Homebrew
brew
d8cc56c1d0dbf3754fa52724dc51d5c234712004.json
release-notes: update documentation and manual page
manpages/brew.1
@@ -868,7 +868,7 @@ If \fB\-\-test\-bot\-user=\fR\fItest\-bot\-user\fR is passed, pull the bottle bl . .TP \fBrelease\-notes\fR [\fB\-\-markdown\fR] [\fIprevious_tag\fR] [\fIend_ref\fR] -Output the merged pull requests on Homebrew/brew between two Git refs\. If no \fIprevious_tag\fR is provided it defaults to the newest tag\. If no \fIend_ref\fR is provided it defaults to \fBorigin/master\fR\. +Output the merged pull requests on Homebrew/brew between two Git refs\. If no \fIprevious_tag\fR is provided it defaults to the latest tag\. If no \fIend_ref\fR is provided it defaults to \fBorigin/master\fR\. . .IP If \fB\-\-markdown\fR is passed, output as a Markdown list\.
true
Other
Homebrew
brew
6cdc501a75582613b675acd5294ce7d652854c0e.json
Keg#replace_text_in_files: fix incorrect replace order The order of the regexes in `Keg#replace_text_in_files` matters. Otherwise, `/usr/local/Cellar` will be replaced to `@@HOMEBREW_PREFIX@@/Cellar` instead of `@@HOMEBREW_CELLAR@@`. Fixes Homebrew/homebrew-core#26043.
Library/Homebrew/keg_relocate.rb
@@ -68,7 +68,7 @@ def replace_text_in_files(relocation, files: nil) relocation.old_cellar => relocation.new_cellar, relocation.old_repository => relocation.new_repository, } - changed = s.gsub!(Regexp.union(replacements.keys), replacements) + changed = s.gsub!(Regexp.union(replacements.keys.sort_by(&:length).reverse), replacements) next unless changed changed_files += [first, *rest].map { |file| file.relative_path_from(path) }
false
Other
Homebrew
brew
df68d12be40d3c653e20a682529f2012c08f4b67.json
bottle: Add option --or-later If --or-later is passed, append _or_later to the bottle tag.
Library/Homebrew/dev-cmd/bottle.rb
@@ -1,4 +1,4 @@ -#: * `bottle` [`--verbose`] [`--no-rebuild`|`--keep-old`] [`--skip-relocation`] [`--root-url=`<URL>] [`--force-core-tap`] <formulae>: +#: * `bottle` [`--verbose`] [`--no-rebuild`|`--keep-old`] [`--skip-relocation`] [`--or-later`] [`--root-url=`<URL>] [`--force-core-tap`] <formulae>: #: Generate a bottle (binary package) from a formula installed with #: `--build-bottle`. #: @@ -15,6 +15,8 @@ #: If `--root-url` is passed, use the specified <URL> as the root of the #: bottle's URL instead of Homebrew's default. #: +#: If `--or-later` is passed, append _or_later to the bottle tag. +#: #: If `--force-core-tap` is passed, build a bottle even if <formula> is not #: in homebrew/core or any installed taps. #: @@ -57,7 +59,7 @@ <% checksums.each do |checksum_type, checksum_values| %> <% checksum_values.each do |checksum_value| %> <% checksum, macos = checksum_value.shift %> - <%= checksum_type %> "<%= checksum %>" => :<%= macos %> + <%= checksum_type %> "<%= checksum %>" => :<%= macos %><%= "_or_later" if Homebrew.args.or_later? %> <% end %> <% end %> end @@ -78,6 +80,7 @@ def bottle switch "--write" switch "--no-commit" switch "--json" + switch "--or-later" switch :verbose switch :debug flag "--root-url" @@ -360,6 +363,8 @@ def bottle_formula(f) puts output return unless @args.json? + tag = Utils::Bottles.tag.to_s + tag += "_or_later" if args.or_later? json = { f.full_name => { "formula" => { @@ -372,7 +377,7 @@ def bottle_formula(f) "cellar" => bottle.cellar.to_s, "rebuild" => bottle.rebuild, "tags" => { - Utils::Bottles.tag.to_s => { + tag => { "filename" => filename.to_s, "sha256" => sha256, },
true
Other
Homebrew
brew
df68d12be40d3c653e20a682529f2012c08f4b67.json
bottle: Add option --or-later If --or-later is passed, append _or_later to the bottle tag.
docs/Manpage.md
@@ -664,7 +664,7 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note `audit` exits with a non-zero status if any errors are found. This is useful, for instance, for implementing pre-commit hooks. - * `bottle` [`--verbose`] [`--no-rebuild`|`--keep-old`] [`--skip-relocation`] [`--root-url=``URL`] [`--force-core-tap`] `formulae`: + * `bottle` [`--verbose`] [`--no-rebuild`|`--keep-old`] [`--skip-relocation`] [`--or-later`] [`--root-url=``URL`] [`--force-core-tap`] `formulae`: Generate a bottle (binary package) from a formula installed with `--build-bottle`. @@ -681,6 +681,8 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note If `--root-url` is passed, use the specified `URL` as the root of the bottle's URL instead of Homebrew's default. + If `--or-later` is passed, append _or_later to the bottle tag. + If `--force-core-tap` is passed, build a bottle even if `formula` is not in homebrew/core or any installed taps.
true
Other
Homebrew
brew
df68d12be40d3c653e20a682529f2012c08f4b67.json
bottle: Add option --or-later If --or-later is passed, append _or_later to the bottle tag.
manpages/brew.1
@@ -682,7 +682,7 @@ Passing \fB\-\-only\-cops=\fR\fIcops\fR will check for violations of only the li \fBaudit\fR exits with a non\-zero status if any errors are found\. This is useful, for instance, for implementing pre\-commit hooks\. . .TP -\fBbottle\fR [\fB\-\-verbose\fR] [\fB\-\-no\-rebuild\fR|\fB\-\-keep\-old\fR] [\fB\-\-skip\-relocation\fR] [\fB\-\-root\-url=\fR\fIURL\fR] [\fB\-\-force\-core\-tap\fR] \fIformulae\fR +\fBbottle\fR [\fB\-\-verbose\fR] [\fB\-\-no\-rebuild\fR|\fB\-\-keep\-old\fR] [\fB\-\-skip\-relocation\fR] [\fB\-\-or\-later\fR] [\fB\-\-root\-url=\fR\fIURL\fR] [\fB\-\-force\-core\-tap\fR] \fIformulae\fR Generate a bottle (binary package) from a formula installed with \fB\-\-build\-bottle\fR\. . .IP @@ -698,6 +698,9 @@ If \fB\-\-skip\-relocation\fR is passed, do not check if the bottle can be marke If \fB\-\-root\-url\fR is passed, use the specified \fIURL\fR as the root of the bottle\'s URL instead of Homebrew\'s default\. . .IP +If \fB\-\-or\-later\fR is passed, append _or_later to the bottle tag\. +. +.IP If \fB\-\-force\-core\-tap\fR is passed, build a bottle even if \fIformula\fR is not in homebrew/core or any installed taps\. . .TP
true
Other
Homebrew
brew
f18e4e330241017d3e2503eeecba7925c799eefd.json
docs/Installation: note curl usage on <=10.7. Need to pass `--insecure` there for it to work.
docs/Installation.md
@@ -19,6 +19,10 @@ it does it too. And you have to confirm everything it will do before it starts. ## Alternative Installs +### OS X Lion 10.7 and below + +Using the instructions on https://brew.sh or below whenever you call `curl` you must pass `--insecure` as an argument. This is because your system `curl` is too old to speak to GitHub using HTTPS. Don't worry, on the first `brew update` Homebrew will install a newer, more secure `curl` for your machine. + ### Untar anywhere Just extract (or `git clone`) Homebrew wherever you want. Just avoid:
false
Other
Homebrew
brew
7f7eb7e6cdac080e85450def86db420480bdc695.json
Add message to `set_ownership`
Library/Homebrew/cask/lib/hbc/staged.rb
@@ -33,6 +33,7 @@ def set_permissions(paths, permissions_str) def set_ownership(paths, user: current_user, group: "staff") full_paths = remove_nonexistent(paths) return if full_paths.empty? + ohai "Changing ownership of paths required by #{@cask}; your password may be necessary" @command.run!("/usr/sbin/chown", args: ["-R", "--", "#{user}:#{group}"] + full_paths, sudo: true) end
false
Other
Homebrew
brew
296d48ba7af0daf010fdb412288b395ea2422bfb.json
Handle error when 'brew search' can't reach GitHub
Library/Homebrew/cmd/search.rb
@@ -111,8 +111,16 @@ def search_taps(query, silent: false) end valid_dirnames = ["Formula", "HomebrewFormula", "Casks", "."].freeze - matches = GitHub.search_code(user: ["Homebrew", "caskroom"], filename: query, extension: "rb") - + matches = begin + GitHub.search_code( + user: ["Homebrew", "caskroom"], + filename: query, + extension: "rb", + ) + rescue GitHub::Error => error + opoo "Error searching on GitHub: #{error}\n" + [] + end matches.map do |match| dirname, filename = File.split(match["path"]) next unless valid_dirnames.include?(dirname)
false
Other
Homebrew
brew
0ec47813f10672ab9ef8ce9c2ad5fba0df67634c.json
Prevent .curlrc from being loaded.
Library/Homebrew/cmd/vendor-install.sh
@@ -48,6 +48,7 @@ fetch() { local temporary_path curl_args=( + -q # do not load .curlrc (must be the first argument) --fail --remote-time --location
true
Other
Homebrew
brew
0ec47813f10672ab9ef8ce9c2ad5fba0df67634c.json
Prevent .curlrc from being loaded.
Library/Homebrew/test/utils/curl_spec.rb
@@ -0,0 +1,10 @@ +require "utils/curl" + +describe "curl" do + describe "curl_args" do + it "returns -q as the first argument" do + # -q must be the first argument according to "man curl" + expect(curl_args("foo")[1]).to eq("-q") + end + end +end
true
Other
Homebrew
brew
0ec47813f10672ab9ef8ce9c2ad5fba0df67634c.json
Prevent .curlrc from being loaded.
Library/Homebrew/utils/curl.rb
@@ -14,6 +14,7 @@ def curl_executable def curl_args(*extra_args, show_output: false, user_agent: :default) args = [ curl_executable.to_s, + "-q", # do not load .curlrc (must be the first argument) "--show-error", ]
true
Other
Homebrew
brew
a12b5395d72c09e5409c257e648a003ff61839b3.json
Maintainer-Guidelines: add communication section. Note the best ways for maintainers to communicate with each other.
docs/Maintainer-Guidelines.md
@@ -104,3 +104,14 @@ Whitespace corrections (to Ruby standard etc.) are allowed (in fact this is a good opportunity to do it) provided the line itself has some kind of modification that is not whitespace in it. But be careful about making changes to inline patches—make sure they still apply. + +## Communication +Maintainers have a variety of ways to communicate with each other: + +- Homebrew's public repositories on GitHub +- Homebrew's group communications between more than two maintainers on private channels (e.g. GitHub/Slack/Discourse) +- Homebrew's direct 1:1 messages between two maintainers on private channels (e.g. iMessage/Slack/Discourse/IRC/carrier pigeon) + +All communication should ideally occur in public on GitHub. Where this is not possible or appropriate (e.g. a security disclosure, interpersonal issue between two maintainers, urgent breakage that needs to be resolved) this can move to maintainers' private group communication and, if necessary, 1:1 communication. Technical decisions should not happen in 1:1 communications but if they do (or did in the past) they must end up back as something linkable on GitHub. For example, if a technical decision was made a year ago on Slack and another maintainer/contributor/user asks about it on GitHub, that's a good chance to explain it to them and have something that can be linked to in the future. + +This makes it easier for other maintainers, contributors and users to follow along with what we're doing (and, more importantly, why we're doing it) and means that decisions have a linkable URL.
true
Other
Homebrew
brew
a12b5395d72c09e5409c257e648a003ff61839b3.json
Maintainer-Guidelines: add communication section. Note the best ways for maintainers to communicate with each other.
docs/New-Maintainer-Checklist.md
@@ -55,7 +55,7 @@ If they accept, follow a few steps to get them set up: - Add them to the [Jenkins' GitHub Authorization Settings admin user names](https://jenkins.brew.sh/configureSecurity/) so they can adjust settings and restart jobs - Add them to the [Jenkins' GitHub Pull Request Builder admin list](https://jenkins.brew.sh/configure) to enable `@BrewTestBot test this please` for them - Invite them to the [`homebrew-maintainers` private maintainers mailing list](https://lists.sfconservancy.org/mailman/admin/homebrew-maintainers/members/add) -- Invite them to the [`machomebrew` private maintainers Slack](https://machomebrew.slack.com/admin/invites) +- Invite them to the [`machomebrew` private maintainers Slack](https://machomebrew.slack.com/admin/invites) (and ensure they've read the [communication guidelines](Maintainer-Guidelines.md#communication)) - Invite them to the [`homebrew` private maintainers 1Password](https://homebrew.1password.com/signin) - Invite them to [Google Analytics](https://analytics.google.com/analytics/web/?authuser=1#management/Settings/a76679469w115400090p120682403/%3Fm.page%3DAccountUsers/)
true
Other
Homebrew
brew
1376b9e41c6483b36d5e12e7b8aa30c48091c996.json
diagnostic: remove missing check.
Library/Homebrew/extend/os/mac/diagnostic.rb
@@ -4,7 +4,6 @@ class Checks def development_tools_checks %w[ check_for_unsupported_macos - check_for_bad_install_name_tool check_for_installed_developer_tools check_xcode_license_approved check_xcode_up_to_date
false
Other
Homebrew
brew
7eaaaf6fa294e617969825e973d72e6a3711d403.json
python_virtualenv_constants: update virtualenv to 15.2.0
Library/Homebrew/language/python_virtualenv_constants.rb
@@ -1,2 +1,2 @@ -PYTHON_VIRTUALENV_URL = "https://files.pythonhosted.org/packages/d4/0c/9840c08189e030873387a73b90ada981885010dd9aea134d6de30cd24cb8/virtualenv-15.1.0.tar.gz".freeze -PYTHON_VIRTUALENV_SHA256 = "02f8102c2436bb03b3ee6dede1919d1dac8a427541652e5ec95171ec8adbc93a".freeze +PYTHON_VIRTUALENV_URL = "https://files.pythonhosted.org/packages/b1/72/2d70c5a1de409ceb3a27ff2ec007ecdd5cc52239e7c74990e32af57affe9/virtualenv-15.2.0.tar.gz".freeze +PYTHON_VIRTUALENV_SHA256 = "1d7e241b431e7afce47e77f8843a276f652699d1fa4f93b9d8ce0076fd7b0b54".freeze
false
Other
Homebrew
brew
4cdee1b53d0fb2573d5f2ca71d63b3d6e6156f12.json
brew create: fix meson template
Library/Homebrew/dev-cmd/create.rb
@@ -185,8 +185,9 @@ class #{Formulary.class_s(name)} < Formula <% if mode == :cmake %> depends_on "cmake" => :build <% elsif mode == :meson %> - depends_on "meson" => :build + depends_on "meson-internal" => :build depends_on "ninja" => :build + depends_on "python" => :build <% elsif mode.nil? %> # depends_on "cmake" => :build <% end %> @@ -202,10 +203,11 @@ def install "--disable-silent-rules", "--prefix=\#{prefix}" <% elsif mode == :meson %> + ENV.refurbish_args + mkdir "build" do system "meson", "--prefix=\#{prefix}", ".." system "ninja" - system "ninja", "test" system "ninja", "install" end <% else %>
false
Other
Homebrew
brew
49038a2cd9ad76041ba602caa235dc9d6bca7d30.json
Remove mentions to official taps There are none remaining. We don’t want PHP to get the deprecated messages until all formulae have been deleted so that will be in a later PR.
Library/Homebrew/cmd/tap.rb
@@ -25,9 +25,6 @@ #: * `tap` `--repair`: #: Migrate tapped formulae from symlink-based to directory-based structure. #: -#: * `tap` `--list-official`: -#: List all official taps. -#: #: * `tap` `--list-pinned`: #: List all pinned taps. @@ -40,8 +37,7 @@ def tap if ARGV.include? "--repair" Tap.each(&:link_completions_and_manpages) elsif ARGV.include? "--list-official" - require "official_taps" - puts OFFICIAL_TAPS.map { |t| "homebrew/#{t}" } + odeprecated("brew tap --list-official") elsif ARGV.include? "--list-pinned" puts Tap.select(&:pinned?).map(&:name) elsif ARGV.named.empty?
true
Other
Homebrew
brew
49038a2cd9ad76041ba602caa235dc9d6bca7d30.json
Remove mentions to official taps There are none remaining. We don’t want PHP to get the deprecated messages until all formulae have been deleted so that will be in a later PR.
Library/Homebrew/test/dev-cmd/tap_spec.rb
@@ -15,11 +15,6 @@ .and not_to_output.to_stderr .and be_a_success - expect { brew "tap", "--list-official" } - .to output(%r{homebrew/php}).to_stdout - .and not_to_output.to_stderr - .and be_a_success - expect { brew "tap-info" } .to output(/2 taps/).to_stdout .and not_to_output.to_stderr
true
Other
Homebrew
brew
49038a2cd9ad76041ba602caa235dc9d6bca7d30.json
Remove mentions to official taps There are none remaining. We don’t want PHP to get the deprecated messages until all formulae have been deleted so that will be in a later PR.
completions/bash/brew
@@ -430,11 +430,10 @@ _brew_tap() { local cur="${COMP_WORDS[COMP_CWORD]}" case "$cur" in --*) - __brewcomp "--repair --list-official --list-pinned" + __brewcomp "--repair --list-pinned" return ;; esac - __brewcomp "$(brew tap --list-official)" } _brew_tap_info() { @@ -716,7 +715,7 @@ _brew_cask_upgrade () return ;; esac - __brew_cask_complete_outdated + __brew_cask_complete_outdated } _brew_cask ()
true
Other
Homebrew
brew
49038a2cd9ad76041ba602caa235dc9d6bca7d30.json
Remove mentions to official taps There are none remaining. We don’t want PHP to get the deprecated messages until all formulae have been deleted so that will be in a later PR.
completions/zsh/_brew
@@ -56,12 +56,6 @@ __brew_installed_taps() { _describe -t installed-taps 'installed taps' taps } -__brew_official_taps() { - local -a taps - taps=($(brew tap --list-official)) - _describe -t official-taps 'official taps' taps -} - __brew_pinned_taps() { local -a taps taps=($(brew tap --list-pinned)) @@ -70,8 +64,7 @@ __brew_pinned_taps() { __brew_any_tap() { _alternative \ - 'installed-taps:installed taps:__brew_installed_taps' \ - 'official-taps:official taps:__brew_official_taps' + 'installed-taps:installed taps:__brew_installed_taps' } __brew_common_commands() { @@ -605,19 +598,15 @@ _brew_switch() { # brew tap: # brew tap [--full] user/repo [URL]: # brew tap --repair: -# brew tap --list-official: # brew tap --list-pinned: _brew_tap() { _arguments \ - empty-args \ - repo-args \ '(--full)--full[perform a full clone]' \ - ':repo:__brew_official_taps' \ '::url:_urls' \ - repair-args \ '(--repair)--repair' \ - - list-official \ - '(--list-official)--list-official[list all official taps]' \ - list-pinned \ '(--list-pinned)--list-pinned[list all pinned taps]' }
true
Other
Homebrew
brew
49038a2cd9ad76041ba602caa235dc9d6bca7d30.json
Remove mentions to official taps There are none remaining. We don’t want PHP to get the deprecated messages until all formulae have been deleted so that will be in a later PR.
docs/Formula-Cookbook.md
@@ -31,7 +31,6 @@ Before submitting a new formula make sure your package: * meets all our [Acceptable Formulae](Acceptable-Formulae.md) requirements * isn't already in Homebrew (check `brew search <formula>`) -* isn't in another official [Homebrew tap](https://github.com/Homebrew) * isn't already waiting to be merged (check the [issue tracker](https://github.com/Homebrew/homebrew-core/pulls)) * is still supported by upstream (i.e. doesn't require extensive patching) * has a stable, tagged version (i.e. not just a GitHub repository with no versions)
true
Other
Homebrew
brew
49038a2cd9ad76041ba602caa235dc9d6bca7d30.json
Remove mentions to official taps There are none remaining. We don’t want PHP to get the deprecated messages until all formulae have been deleted so that will be in a later PR.
docs/How-To-Open-a-Homebrew-Pull-Request.md
@@ -25,8 +25,6 @@ Depending on the change you want to make, you need to send the pull request to t 3. Add your pushable forked repository with `git remote add <YOUR_USERNAME> https://github.com/<YOUR_USERNAME>/homebrew-core.git` * `<YOUR_USERNAME>` is your GitHub username, not your local machine username. -For formulae in central taps other than `homebrew/core`, such as `homebrew/php`, substitute that tap's name for `homebrew/core` in each step, and alter the GitHub repository URLs as necessary. - ## Create your pull request from a new branch To make a new branch and submit it for review, create a GitHub pull request with the following steps:
true
Other
Homebrew
brew
49038a2cd9ad76041ba602caa235dc9d6bca7d30.json
Remove mentions to official taps There are none remaining. We don’t want PHP to get the deprecated messages until all formulae have been deleted so that will be in a later PR.
docs/How-to-Create-and-Maintain-a-Tap.md
@@ -16,7 +16,7 @@ repository’s root, or under `Formula` or `HomebrewFormula` subdirectories. We recommend the latter options because it makes the repository organisation easier to grasp, and top-level files are not mixed with formulae. -See [homebrew/php](https://github.com/Homebrew/homebrew-php) for an example of +See [homebrew/core](https://github.com/Homebrew/homebrew-core) for an example of a tap with a `Formula` subdirectory. ### Installing
true
Other
Homebrew
brew
49038a2cd9ad76041ba602caa235dc9d6bca7d30.json
Remove mentions to official taps There are none remaining. We don’t want PHP to get the deprecated messages until all formulae have been deleted so that will be in a later PR.
docs/Interesting-Taps-and-Forks.md
@@ -3,15 +3,9 @@ A _tap_ is homebrew-speak for a Git repository containing extra formulae. Homebrew has the capability to add (and remove) multiple taps to your local installation with the `brew tap` and `brew untap` commands. Type `man brew` in your Terminal. The main repository [https://github.com/Homebrew/homebrew-core](https://github.com/Homebrew/homebrew-core), often called `homebrew/core`, is always built-in. -## Main taps - -* [homebrew/php](https://github.com/Homebrew/homebrew-php): Repository for PHP-related formulae. - -`brew search` looks in these taps as well as in [homebrew/core](https://github.com/Homebrew/homebrew-core) so don't worry about missing stuff. - -You can be added as a maintainer for one of the Homebrew organization taps and aid the project! If you are interested please feel free to ask in an issue or pull request after submitting multiple high-quality pull requests. We want your help! +Your taps are Git repositories located at `$(brew --repository)/Library/Taps`. -## Other interesting taps +## Unsupported interesting taps * [denji/nginx](https://github.com/denji/homebrew-nginx): A tap for NGINX modules, intended for its `nginx-full` formula which includes more module options. @@ -37,12 +31,8 @@ You can be added as a maintainer for one of the Homebrew organization taps and a * [lifepillar/appleii](https://github.com/lifepillar/homebrew-appleii): Formulae for vintage Apple emulation. -## Interesting forks +## Unsupported interesting forks * [mistydemeo/tigerbrew](https://github.com/mistydemeo/tigerbrew): Experimental Tiger PowerPC version. * [Linuxbrew/brew](https://github.com/Linuxbrew/brew): Experimental Linux version. - -## Technical details - -Your taps are Git repositories located at `$(brew --repository)/Library/Taps`.
true
Other
Homebrew
brew
49038a2cd9ad76041ba602caa235dc9d6bca7d30.json
Remove mentions to official taps There are none remaining. We don’t want PHP to get the deprecated messages until all formulae have been deleted so that will be in a later PR.
docs/Manpage.md
@@ -474,9 +474,6 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note * `tap` `--repair`: Migrate tapped formulae from symlink-based to directory-based structure. - * `tap` `--list-official`: - List all official taps. - * `tap` `--list-pinned`: List all pinned taps.
true
Other
Homebrew
brew
49038a2cd9ad76041ba602caa235dc9d6bca7d30.json
Remove mentions to official taps There are none remaining. We don’t want PHP to get the deprecated messages until all formulae have been deleted so that will be in a later PR.
docs/Troubleshooting.md
@@ -17,7 +17,7 @@ Follow these steps to fix common problems: ## Check to see if the issue has been reported * Search the [issue tracker](https://github.com/Homebrew/homebrew-core/issues) to see if someone else has already reported the same issue. -* Make sure you search issues on the correct repository. If a formula that has failed to build is part of a tap like [homebrew/php](https://github.com/Homebrew/homebrew-php/issues) or a cask is part of [caskroom/cask](https://github.com/caskroom/homebrew-cask/issues) check those issue trackers instead. +* Make sure you search issues on the correct repository. If a formula that has failed to build is part of a non-homebrew-core tap or a cask is part of [caskroom/cask](https://github.com/caskroom/homebrew-cask/issues) check those issue trackers instead. ## Create an issue
true
Other
Homebrew
brew
49038a2cd9ad76041ba602caa235dc9d6bca7d30.json
Remove mentions to official taps There are none remaining. We don’t want PHP to get the deprecated messages until all formulae have been deleted so that will be in a later PR.
manpages/brew.1
@@ -483,10 +483,6 @@ By default, the repository is cloned as a shallow copy (\fB\-\-depth=1\fR), but Migrate tapped formulae from symlink\-based to directory\-based structure\. . .TP -\fBtap\fR \fB\-\-list\-official\fR -List all official taps\. -. -.TP \fBtap\fR \fB\-\-list\-pinned\fR List all pinned taps\. .
true
Other
Homebrew
brew
d6e0b7d2bfa41e529c9055c13695afdba50b4a9a.json
use new syntax
Library/Homebrew/linkage_checker.rb
@@ -180,7 +180,7 @@ def display_items(label, things) return if things.empty? puts "#{label}:" if things.is_a? Hash - things.sort_by { |k, | k.to_s }.each do |list_label, list| + things.sort_by(&:to_s).each do |list_label, list| list.sort.each do |item| puts " #{item} (#{list_label})" end
false
Other
Homebrew
brew
5b68bb84d21fc3dbd5d9cac0100fd0ab1d65dc0e.json
cmd/upgrade: output the outdated version. This makes it clearer what version is being updated to what version.
Library/Homebrew/cmd/upgrade.rb
@@ -67,7 +67,14 @@ def upgrade oh1 "No packages to upgrade" else oh1 "Upgrading #{Formatter.pluralize(formulae_to_install.length, "outdated package")}, with result:" - puts formulae_to_install.map { |f| "#{f.full_specified_name} #{f.pkg_version}" } * ", " + formulae_upgrades = formulae_to_install.map do |f| + if f.optlinked? + "#{f.full_specified_name} #{Keg.new(f.opt_prefix).version} -> #{f.pkg_version}" + else + "#{f.full_specified_name} #{f.pkg_version}" + end + end + puts formulae_upgrades.join(", ") end # Sort keg_only before non-keg_only formulae to avoid any needless conflicts
false
Other
Homebrew
brew
262666c82858bfd00b98dd136cbe09d705c73862.json
cleanup_spec: add nicer prune matcher alias.
Library/Homebrew/test/cleanup_spec.rb
@@ -260,6 +260,8 @@ end describe "::prune?" do + alias_matcher :be_pruned, :be_prune + before do foo.mkpath end @@ -268,11 +270,11 @@ it "returns true when path_modified_time < days_default" do allow_any_instance_of(Pathname).to receive(:mtime).and_return(Time.now - sec_in_a_day * 2) - expect(described_class).to be_prune(foo, days_default: "1") + expect(described_class).to be_pruned(foo, days_default: "1") end it "returns false when path_modified_time >= days_default" do - expect(described_class).not_to be_prune(foo, days_default: "2") + expect(described_class).not_to be_pruned(foo, days_default: "2") end end end
false
Other
Homebrew
brew
42a39b16bff43ab6aae516dfd578501f1478e8eb.json
formula: use runtime_dependencies from tab. Don't do so in `linkage_checker` or `tab` which to avoid recursive loops and want the actual values specified in the formula itself.
Library/Homebrew/formula.rb
@@ -1486,7 +1486,14 @@ def recursive_requirements(&block) # Returns a list of Dependency objects that are required at runtime. # @private - def runtime_dependencies + def runtime_dependencies(read_from_tab: true) + if read_from_tab && + installed_prefix.directory? && + (keg = Keg.new(installed_prefix)) && + (tab_deps = keg.runtime_dependencies) + return tab_deps.map { |d| Dependency.new d["full_name"] }.compact + end + recursive_dependencies do |_, dependency| Dependency.prune if dependency.build? Dependency.prune if !dependency.required? && build.without?(dependency)
true
Other
Homebrew
brew
42a39b16bff43ab6aae516dfd578501f1478e8eb.json
formula: use runtime_dependencies from tab. Don't do so in `linkage_checker` or `tab` which to avoid recursive loops and want the actual values specified in the formula itself.
Library/Homebrew/linkage_checker.rb
@@ -63,7 +63,8 @@ def check_undeclared_deps formula.build.without?(dep) end declared_deps = formula.deps.reject { |dep| filter_out.call(dep) }.map(&:name) - recursive_deps = keg.to_formula.runtime_dependencies.map { |dep| dep.to_formula.name } + runtime_deps = keg.to_formula.runtime_dependencies(read_from_tab: false) + recursive_deps = runtime_deps.map { |dep| dep.to_formula.name } declared_dep_names = declared_deps.map { |dep| dep.split("/").last } indirect_deps = [] undeclared_deps = []
true
Other
Homebrew
brew
42a39b16bff43ab6aae516dfd578501f1478e8eb.json
formula: use runtime_dependencies from tab. Don't do so in `linkage_checker` or `tab` which to avoid recursive loops and want the actual values specified in the formula itself.
Library/Homebrew/tab.rb
@@ -17,6 +17,7 @@ class Tab < OpenStruct # Instantiates a Tab for a new installation of a formula. def self.create(formula, compiler, stdlib) build = formula.build + runtime_deps = formula.runtime_dependencies(read_from_tab: false) attributes = { "homebrew_version" => HOMEBREW_VERSION, "used_options" => build.used_options.as_flags, @@ -32,7 +33,7 @@ def self.create(formula, compiler, stdlib) "compiler" => compiler, "stdlib" => stdlib, "aliases" => formula.aliases, - "runtime_dependencies" => formula.runtime_dependencies.map do |dep| + "runtime_dependencies" => runtime_deps.map do |dep| f = dep.to_formula { "full_name" => f.full_name, "version" => f.version.to_s } end,
true
Other
Homebrew
brew
a7727b66b30bdb3c0280a006b763787e9077cc6f.json
keg: add tab, runtime_dependencies methods.
Library/Homebrew/keg.rb
@@ -503,8 +503,16 @@ def remove_oldname_opt_record @oldname_opt_record = nil end + def tab + Tab.for_keg(self) + end + + def runtime_dependencies + tab.runtime_dependencies + end + def aliases - Tab.for_keg(self).aliases || [] + tab.aliases || [] end def optlink(mode = OpenStruct.new)
false
Other
Homebrew
brew
92263f51e97daf1005836069625da2ced2e304a6.json
update-test: Use Parser to parse args
Library/Homebrew/dev-cmd/update-test.rb
@@ -14,25 +14,34 @@ #: If `--keep-tmp` is passed, retain the temporary directory containing #: the new repository clone. +require "cli_parser" + module Homebrew module_function def update_test + args = Homebrew::CLI::Parser.parse do + switch "--to-tag" + switch "--keep-tmp" + flag "--commit", required: true + flag "--before", required: true + end + ENV["HOMEBREW_UPDATE_TEST"] = "1" - if ARGV.include?("--to-tag") + if args.to_tag? ENV["HOMEBREW_UPDATE_TO_TAG"] = "1" branch = "stable" else branch = "master" end cd HOMEBREW_REPOSITORY - start_commit = if commit = ARGV.value("commit") + start_commit = if commit = args.commit commit - elsif date = ARGV.value("before") + elsif date = args.before Utils.popen_read("git", "rev-list", "-n1", "--before=#{date}", "origin/master").chomp - elsif ARGV.include?("--to-tag") + elsif args.to_tag? tags = Utils.popen_read("git", "tag", "--list", "--sort=-version:refname") previous_tag = tags.lines[1] previous_tag ||= begin @@ -62,7 +71,7 @@ def update_test puts "End commit: #{end_commit}" mktemp("update-test") do |staging| - staging.retain! if ARGV.keep_tmp? + staging.retain! if args.keep_tmp? curdir = Pathname.new(Dir.pwd) oh1 "Setup test environment..."
false
Other
Homebrew
brew
74baf04ad3b0111cace6701caeb5939ef8161bf7.json
pull: Use Parser to parse args
Library/Homebrew/dev-cmd/pull.rb
@@ -52,6 +52,7 @@ require "net/https" require "utils" require "json" +require "cli_parser" require "formula" require "formulary" require "tap" @@ -62,8 +63,7 @@ module GitHub module_function # Return the corresponding test-bot user name for the given GitHub organization. - def test_bot_user(user) - test_bot = ARGV.value "test-bot-user" + def test_bot_user(user, test_bot) return test_bot if test_bot return "BrewTestBot" if user.casecmp("homebrew").zero? "#{user.capitalize}TestBot" @@ -76,6 +76,20 @@ module Homebrew def pull odie "You meant `git pull --rebase`." if ARGV[0] == "--rebase" + @args = Homebrew::CLI::Parser.parse do + switch "--bottle" + switch "--bump" + switch "--clean" + switch "--ignore-whitespace" + switch "--resolve" + switch "--branch-okay" + switch "--no-pbcopy" + switch "--no-publish" + switch "--warn-on-publish-failure" + flag "--bintray-org", required: true + flag "--test-bot-user", required: true + end + if ARGV.named.empty? odie "This command requires at least one argument containing a URL or pull request number" end @@ -88,7 +102,7 @@ def pull ENV["GIT_COMMITTER_EMAIL"] = ENV["HOMEBREW_GIT_EMAIL"] end - do_bump = ARGV.include?("--bump") && !ARGV.include?("--clean") + do_bump = @args.bump? && !@args.clean? # Formulae with affected bottles that were published bintray_published_formulae = [] @@ -107,7 +121,7 @@ def pull end _, testing_job = *testing_match url = "https://github.com/Homebrew/homebrew-#{tap.repo}/compare/master...BrewTestBot:testing-#{testing_job}" - odie "Testing URLs require `--bottle`!" unless ARGV.include?("--bottle") + odie "Testing URLs require `--bottle`!" unless @args.bottle? elsif (api_match = arg.match HOMEBREW_PULL_API_REGEX) _, user, repo, issue = *api_match url = "https://github.com/#{user}/#{repo}/pull/#{issue}" @@ -119,7 +133,7 @@ def pull odie "Not a GitHub pull request or commit: #{arg}" end - if !testing_job && ARGV.include?("--bottle") && issue.nil? + if !testing_job && @args.bottle? && issue.nil? odie "No pull request detected!" end @@ -137,11 +151,11 @@ def pull orig_revision = `git rev-parse --short HEAD`.strip branch = `git symbolic-ref --short HEAD`.strip - unless branch == "master" || ARGV.include?("--clean") || ARGV.include?("--branch-okay") + unless branch == "master" || @args.clean? || @args.branch_okay? opoo "Current branch is #{branch}: do you need to pull inside master?" end - patch_puller = PatchPuller.new(url) + patch_puller = PatchPuller.new(url, @args) patch_puller.fetch_patch patch_changes = files_changed_in_patch(patch_puller.patchpath, tap) @@ -189,7 +203,7 @@ def pull end end - if ARGV.include? "--bottle" + if @args.bottle? if f.bottle_unneeded? ohai "#{f}: skipping unneeded bottle." elsif f.bottle_disabled? @@ -204,7 +218,7 @@ def pull end orig_message = message = `git log HEAD^.. --format=%B` - if issue && !ARGV.include?("--clean") + if issue && !@args.clean? ohai "Patch closes issue ##{issue}" close_message = "Closes ##{issue}." # If this is a pull request, append a close message. @@ -216,7 +230,7 @@ def pull is_bumpable = false end - is_bumpable = false if ARGV.include?("--clean") + is_bumpable = false if @args.clean? is_bumpable = false if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"] if is_bumpable @@ -228,7 +242,7 @@ def pull odie "No version changes found for #{formula.name}" if bump_subject.nil? unless orig_subject == bump_subject ohai "New bump commit subject: #{bump_subject}" - pbcopy bump_subject unless ARGV.include? "--no-pbcopy" + pbcopy bump_subject unless @args.no_pbcopy? message = "#{bump_subject}\n\n#{message}" end elsif bump_subject != orig_subject && !bump_subject.nil? @@ -237,7 +251,7 @@ def pull end end - if message != orig_message && !ARGV.include?("--clean") + if message != orig_message && !@args.clean? safe_system "git", "commit", "--amend", "--signoff", "--allow-empty", "-q", "-m", message end @@ -248,7 +262,8 @@ def pull url else bottle_branch = "pull-bottle-#{issue}" - "https://github.com/#{GitHub.test_bot_user user}/homebrew-#{tap.repo}/compare/#{user}:master...pr-#{issue}" + bot_username = GitHub.test_bot_user(user, @args.test_bot_user) + "https://github.com/#{bot_username}/homebrew-#{tap.repo}/compare/#{user}:master...pr-#{issue}" end curl "--silent", "--fail", "--output", "/dev/null", "--head", bottle_commit_url @@ -261,7 +276,7 @@ def pull safe_system "git", "branch", "--quiet", "-D", bottle_branch # Publish bottles on Bintray - unless ARGV.include? "--no-publish" + unless @args.no_publish? published = publish_changed_formula_bottles(tap, changed_formulae_names) bintray_published_formulae.concat(published) end @@ -291,7 +306,7 @@ def publish_changed_formula_bottles(tap, changed_formulae_names) changed_formulae_names.each do |name| f = Formula[name] next if f.bottle_unneeded? || f.bottle_disabled? - bintray_org = ARGV.value("bintray-org") || tap.user.downcase + bintray_org = @args.bintray_org || tap.user.downcase next unless publish_bottle_file_on_bintray(f, bintray_org, bintray_creds) published << f.full_name end @@ -302,20 +317,21 @@ def publish_changed_formula_bottles(tap, changed_formulae_names) end def pull_patch(url, description = nil) - PatchPuller.new(url, description).pull_patch + PatchPuller.new(url, @args, description).pull_patch end class PatchPuller attr_reader :base_url attr_reader :patch_url attr_reader :patchpath - def initialize(url, description = nil) + def initialize(url, args, description = nil) @base_url = url # GitHub provides commits/pull-requests raw patches using this URL. @patch_url = url + ".patch" @patchpath = HOMEBREW_CACHE + File.basename(patch_url) @description = description + @args = args end def pull_patch @@ -338,7 +354,7 @@ def apply_patch patch_args = [] # Normally we don't want whitespace errors, but squashing them can break # patches so an option is provided to skip this step. - if ARGV.include?("--ignore-whitespace") || ARGV.include?("--clean") + if @args.ignore_whitespace? || @args.clean? patch_args << "--whitespace=nowarn" else patch_args << "--whitespace=fix" @@ -351,7 +367,7 @@ def apply_patch begin safe_system "git", "am", *patch_args rescue ErrorDuringExecution - if ARGV.include? "--resolve" + if @args.resolve? odie "Patch failed to apply: try to resolve it." else system "git", "am", "--abort" @@ -464,7 +480,7 @@ def publish_bottle_file_on_bintray(f, bintray_org, creds) "https://api.bintray.com/content/#{bintray_org}/#{repo}/#{package}/#{version}/publish" true rescue => e - raise unless ARGV.include?("--warn-on-publish-failure") + raise unless @args.warn_on_publish_failure? onoe e false end
false
Other
Homebrew
brew
41a05b62fe47baf402639990d3762f85dec60bec.json
bottle: Use Parser to parse args
Library/Homebrew/dev-cmd/bottle.rb
@@ -34,6 +34,7 @@ require "tab" require "keg" require "formula_versions" +require "cli_parser" require "utils/inreplace" require "erb" require "extend/pathname" @@ -68,6 +69,26 @@ module Homebrew module_function + def bottle + @args = Homebrew::CLI::Parser.parse do + switch "--merge" + switch "-v", "--verbose" + switch "--skip-relocation" + switch "--force-core-tap" + switch "--no-rebuild" + switch "--keep-old" + switch "--write" + switch "--no-commit" + switch "--json" + flag "--root-url" + end + + return merge if @args.merge? + ARGV.resolved_formulae.each do |f| + bottle_formula f + end + end + def keg_contain?(string, keg, ignores) @put_string_exists_header, @put_filenames = nil @@ -93,7 +114,7 @@ def keg_contain?(string, keg, ignores) linked_libraries = Keg.file_linked_libraries(file, string) result ||= !linked_libraries.empty? - if ARGV.verbose? + if @args.verbose? print_filename.call(string, file) unless linked_libraries.empty? linked_libraries.each do |lib| puts " #{Tty.bold}-->#{Tty.reset} links to #{lib}" @@ -116,7 +137,7 @@ def keg_contain?(string, keg, ignores) end end - next unless ARGV.verbose? && !text_matches.empty? + next unless @args.verbose? && !text_matches.empty? print_filename.call(string, file) text_matches.first(MAXIMUM_STRING_MATCHES).each do |match, offset| puts " #{Tty.bold}-->#{Tty.reset} match '#{match}' at offset #{Tty.bold}0x#{offset}#{Tty.reset}" @@ -137,7 +158,7 @@ def keg_contain_absolute_symlink_starting_with?(string, keg) absolute_symlinks_start_with_string << pn if link.to_s.start_with?(string) end - if ARGV.verbose? + if @args.verbose? unless absolute_symlinks_start_with_string.empty? opoo "Absolute symlink starting with #{string}:" absolute_symlinks_start_with_string.each do |pn| @@ -160,7 +181,7 @@ def bottle_formula(f) end unless tap = f.tap - unless ARGV.include?("--force-core-tap") + unless @args.force_core_tap? return ofail "Formula not from core or any taps: #{f.full_name}" end @@ -179,9 +200,9 @@ def bottle_formula(f) return ofail "Formula has no stable version: #{f.full_name}" unless f.stable - if ARGV.include?("--no-rebuild") || !f.tap + if @args.no_rebuild? || !f.tap rebuild = 0 - elsif ARGV.include? "--keep-old" + elsif @args.keep_old? rebuild = f.bottle_specification.rebuild else ohai "Determining #{f.full_name} bottle rebuild..." @@ -214,7 +235,7 @@ def bottle_formula(f) begin keg.delete_pyc_files! - unless ARGV.include? "--skip-relocation" + unless @args.skip_relocation? changed_files = keg.replace_locations_with_placeholders end @@ -265,7 +286,7 @@ def bottle_formula(f) end relocatable = true - if ARGV.include? "--skip-relocation" + if @args.skip_relocation? skip_relocation = true else relocatable = false if keg_contain?(prefix_check, keg, ignores) @@ -278,23 +299,21 @@ def bottle_formula(f) end skip_relocation = relocatable && !keg.require_relocation? end - puts if !relocatable && ARGV.verbose? + puts if !relocatable && @args.verbose? rescue Interrupt ignore_interrupts { bottle_path.unlink if bottle_path.exist? } raise ensure ignore_interrupts do original_tab&.write - unless ARGV.include? "--skip-relocation" + unless @args.skip_relocation? keg.replace_placeholders_with_locations changed_files end end end end - root_url = ARGV.value("root-url") - # Use underscored version for legacy reasons. Remove at some point. - root_url ||= ARGV.value("root_url") + root_url = @args.root_url bottle = BottleSpecification.new bottle.tap = tap @@ -314,7 +333,7 @@ def bottle_formula(f) bottle.sha256 sha256 => Utils::Bottles.tag old_spec = f.bottle_specification - if ARGV.include?("--keep-old") && !old_spec.checksums.empty? + if @args.keep_old? && !old_spec.checksums.empty? mismatches = [:root_url, :prefix, :cellar, :rebuild].reject do |key| old_spec.send(key) == bottle.send(key) end @@ -340,7 +359,7 @@ def bottle_formula(f) puts "./#{filename}" puts output - return unless ARGV.include? "--json" + return unless @args.json? json = { f.full_name => { "formula" => { @@ -371,7 +390,7 @@ def bottle_formula(f) end def merge - write = ARGV.include? "--write" + write = @args.write? bottles_hash = ARGV.named.reduce({}) do |hash, json_file| deep_merge_hashes hash, JSON.parse(IO.read(json_file)) @@ -400,7 +419,7 @@ def merge Utils::Inreplace.inreplace(path) do |s| if s.include? "bottle do" update_or_add = "update" - if ARGV.include? "--keep-old" + if @args.keep_old? mismatches = [] bottle_block_contents = s[/ bottle do(.+?)end\n/m, 1] bottle_block_contents.lines.each do |line| @@ -443,7 +462,7 @@ def merge string = s.sub!(/ bottle do.+?end\n/m, output) odie "Bottle block update failed!" unless string else - if ARGV.include? "--keep-old" + if @args.keep_old? odie "--keep-old was passed but there was no existing bottle block!" end puts output @@ -472,7 +491,7 @@ def merge end end - unless ARGV.include? "--no-commit" + unless @args.no_commit? if ENV["HOMEBREW_GIT_NAME"] ENV["GIT_AUTHOR_NAME"] = ENV["GIT_COMMITTER_NAME"] = @@ -498,14 +517,4 @@ def merge end end end - - def bottle - if ARGV.include? "--merge" - merge - else - ARGV.resolved_formulae.each do |f| - bottle_formula f - end - end - end end
false
Other
Homebrew
brew
2019c289cba33b799a6e1ffbf80c7417d01292a9.json
Add libepoxy to gnome_devel_whitelist
Library/Homebrew/dev-cmd/audit.rb
@@ -564,6 +564,7 @@ def audit_specs gtk-doc 1.25 libart 2.3.21 pygtkglext 1.1.0 + libepoxy 1.5.0 ].each_slice(2).to_a.map do |formula, version| [formula, version.split(".")[0..1].join(".")] end
false
Other
Homebrew
brew
191e49511b83dd17e32602de74f3ea7769a02c3a.json
tests: Use Parser to parse args
Library/Homebrew/dev-cmd/tests.rb
@@ -1,4 +1,4 @@ -#: * `tests` [`--verbose`] [`--coverage`] [`--generic`] [`--no-compat`] [`--only=`<test_script>[`:`<line_number>]] [`--seed` <seed>] [`--online`] [`--official-cmd-taps`]: +#: * `tests` [`--verbose`] [`--coverage`] [`--generic`] [`--no-compat`] [`--only=`<test_script>[`:`<line_number>]] [`--seed=`<seed>] [`--online`] [`--official-cmd-taps`]: #: Run Homebrew's unit and integration tests. If provided, #: `--only=`<test_script> runs only <test_script>_spec.rb, and `--seed` #: randomizes tests with the provided value instead of a random seed. @@ -15,30 +15,41 @@ #: If `--online` is passed, include tests that use the GitHub API and tests #: that use any of the taps for official external commands. +require "cli_parser" require "fileutils" require "tap" module Homebrew module_function def tests + args = Homebrew::CLI::Parser.new do + switch "--no-compat" + switch "--generic" + switch "-v", "--verbose" + switch "--coverage" + switch "--online" + flag "--only", required: true + flag "--seed", required: true + end.parse + HOMEBREW_LIBRARY_PATH.cd do ENV.delete("HOMEBREW_VERBOSE") ENV.delete("VERBOSE") ENV.delete("HOMEBREW_CASK_OPTS") ENV.delete("HOMEBREW_TEMP") ENV["HOMEBREW_NO_ANALYTICS_THIS_RUN"] = "1" ENV["HOMEBREW_DEVELOPER"] = "1" - ENV["HOMEBREW_NO_COMPAT"] = "1" if ARGV.include? "--no-compat" - ENV["HOMEBREW_TEST_GENERIC_OS"] = "1" if ARGV.include? "--generic" + ENV["HOMEBREW_NO_COMPAT"] = "1" if args.no_compat? + ENV["HOMEBREW_TEST_GENERIC_OS"] = "1" if args.generic? - if ARGV.include? "--online" + if args.online? ENV["HOMEBREW_TEST_ONLINE"] = "1" else ENV["HOMEBREW_NO_GITHUB_API"] = "1" end - if ARGV.include? "--coverage" + if args.coverage? ENV["HOMEBREW_TESTS_COVERAGE"] = "1" FileUtils.rm_f "test/coverage/.resultset.json" end @@ -58,8 +69,8 @@ def tests parallel = true - files = if ARGV.value("only") - test_name, line = ARGV.value("only").split(":", 2) + files = if args.only + test_name, line = args.only.split(":", 2) if line.nil? Dir.glob("test/{#{test_name},#{test_name}/**/*}_spec.rb") @@ -84,7 +95,7 @@ def tests # Generate seed ourselves and output later to avoid multiple different # seeds being output when running parallel tests. - seed = ARGV.include?("--seed") ? ARGV.next : rand(0xFFFF).to_i + seed = args.seed ? args.seed : rand(0xFFFF).to_i args = ["-I", HOMEBREW_LIBRARY_PATH/"test"] args += %W[
true
Other
Homebrew
brew
191e49511b83dd17e32602de74f3ea7769a02c3a.json
tests: Use Parser to parse args
docs/Manpage.md
@@ -880,7 +880,7 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note Example: `brew install jruby && brew test jruby` - * `tests` [`--verbose`] [`--coverage`] [`--generic`] [`--no-compat`] [`--only=``test_script`[`:``line_number`]] [`--seed` `seed`] [`--online`] [`--official-cmd-taps`]: + * `tests` [`--verbose`] [`--coverage`] [`--generic`] [`--no-compat`] [`--only=``test_script`[`:``line_number`]] [`--seed=``seed`] [`--online`] [`--official-cmd-taps`]: Run Homebrew's unit and integration tests. If provided, `--only=``test_script` runs only `test_script`_spec.rb, and `--seed` randomizes tests with the provided value instead of a random seed.
true
Other
Homebrew
brew
191e49511b83dd17e32602de74f3ea7769a02c3a.json
tests: Use Parser to parse args
manpages/brew.1
@@ -896,7 +896,7 @@ If \fB\-\-keep\-tmp\fR is passed, the temporary files created for the test are n Example: \fBbrew install jruby && brew test jruby\fR . .TP -\fBtests\fR [\fB\-\-verbose\fR] [\fB\-\-coverage\fR] [\fB\-\-generic\fR] [\fB\-\-no\-compat\fR] [\fB\-\-only=\fR\fItest_script\fR[\fB:\fR\fIline_number\fR]] [\fB\-\-seed\fR \fIseed\fR] [\fB\-\-online\fR] [\fB\-\-official\-cmd\-taps\fR] +\fBtests\fR [\fB\-\-verbose\fR] [\fB\-\-coverage\fR] [\fB\-\-generic\fR] [\fB\-\-no\-compat\fR] [\fB\-\-only=\fR\fItest_script\fR[\fB:\fR\fIline_number\fR]] [\fB\-\-seed=\fR\fIseed\fR] [\fB\-\-online\fR] [\fB\-\-official\-cmd\-taps\fR] Run Homebrew\'s unit and integration tests\. If provided, \fB\-\-only=\fR\fItest_script\fR runs only \fItest_script\fR_spec\.rb, and \fB\-\-seed\fR randomizes tests with the provided value instead of a random seed\. . .IP
true
Other
Homebrew
brew
164f47a108c26ede3bf3236c4682ca74cc043e2f.json
irb: Use Parser to parse args
Library/Homebrew/dev-cmd/irb.rb
@@ -5,6 +5,9 @@ #: If `--pry` is passed or HOMEBREW_PRY is set, pry will be #: used instead of irb. +require "cli_parser" +require "utils/env" + class Symbol def f(*args) Formulary.factory(to_s, *args) @@ -21,15 +24,20 @@ module Homebrew module_function def irb - if ARGV.include? "--examples" + args = Homebrew::CLI::Parser.new do + switch "--examples" + switch "--pry" + end.parse + + if args.examples? puts "'v8'.f # => instance of the v8 formula" puts ":hub.f.installed?" puts ":lua.f.methods - 1.methods" puts ":mpd.f.recursive_dependencies.reject(&:installed?)" return end - if ARGV.pry? + if args.pry? || Utils::EnvVars.pry? Homebrew.install_gem_setup_path! "pry" require "pry" Pry.config.prompt_name = "brew" @@ -45,7 +53,7 @@ def irb ohai "Interactive Homebrew Shell" puts "Example commands available with: brew irb --examples" - if ARGV.pry? + if args.pry? || Utils::EnvVars.pry? Pry.start else IRB.start
true
Other
Homebrew
brew
164f47a108c26ede3bf3236c4682ca74cc043e2f.json
irb: Use Parser to parse args
Library/Homebrew/extend/ARGV.rb
@@ -268,10 +268,6 @@ def fetch_head? include? "--fetch-HEAD" end - def pry? - include?("--pry") || !ENV["HOMEBREW_PRY"].nil? - end - # eg. `foo -ns -i --bar` has three switches, n, s and i def switch?(char) return false if char.length > 1
true
Other
Homebrew
brew
164f47a108c26ede3bf3236c4682ca74cc043e2f.json
irb: Use Parser to parse args
Library/Homebrew/utils/env.rb
@@ -0,0 +1,9 @@ +module Utils + module EnvVars + class << self + def pry? + !ENV["HOMEBREW_PRY"].nil? + end + end + end +end
true
Other
Homebrew
brew
78b41b07f12d503bb130170f1cde87176e8fec0c.json
man: Use Parser to parse args
Library/Homebrew/dev-cmd/man.rb
@@ -10,6 +10,7 @@ require "formula" require "erb" require "ostruct" +require "cli_parser" module Homebrew module_function @@ -19,17 +20,22 @@ module Homebrew TARGET_DOC_PATH = HOMEBREW_REPOSITORY/"docs" def man + @args = Homebrew::CLI::Parser.new do + switch "--fail-if-changed" + switch "--link" + end.parse + raise UsageError unless ARGV.named.empty? - if ARGV.flag? "--link" + if @args.link? odie "`brew man --link` is now done automatically by `brew update`." end regenerate_man_pages if system "git", "-C", HOMEBREW_REPOSITORY, "diff", "--quiet", "docs/Manpage.md", "manpages" puts "No changes to manpage output detected." - elsif ARGV.include?("--fail-if-changed") + elsif @args.fail_if_changed? Homebrew.failed = true end end @@ -88,7 +94,7 @@ def convert_man_page(markup, target) # Set the manpage date to the existing one if we're checking for changes. # This avoids the only change being e.g. a new date. - date = if ARGV.include?("--fail-if-changed") && + date = if @args.fail_if_changed? && target.extname == ".1" && target.exist? /"(\d{1,2})" "([A-Z][a-z]+) (\d{4})" "#{organisation}" "#{manual}"/ =~ target.read Date.parse("#{Regexp.last_match(1)} #{Regexp.last_match(2)} #{Regexp.last_match(3)}")
false
Other
Homebrew
brew
56fb2cb67c728f73a1f018eb0da26644ff2ea3c8.json
edit: Use Parser to parse args
Library/Homebrew/dev-cmd/edit.rb
@@ -5,11 +5,16 @@ #: Open <formula> in the editor. require "formula" +require "cli_parser" module Homebrew module_function def edit + args = Homebrew::CLI::Parser.new do + switch "--force" + end.parse + unless (HOMEBREW_REPOSITORY/".git").directory? raise <<~EOS Changes will be lost! @@ -36,7 +41,7 @@ def edit paths = ARGV.named.map do |name| path = Formulary.path(name) - raise FormulaUnavailableError, name unless path.file? || ARGV.force? + raise FormulaUnavailableError, name unless path.file? || args.force? path end
false
Other
Homebrew
brew
93481ab491a3ba2cde3432b49afe5195a56243d4.json
release-notes: Use Parser to parse args
Library/Homebrew/dev-cmd/release-notes.rb
@@ -5,10 +5,16 @@ #: #: If `--markdown` is passed, output as a Markdown list. +require "cli_parser" + module Homebrew module_function def release_notes + args = Homebrew::CLI::Parser.new do + switch "--markdown" + end.parse + previous_tag = ARGV.named.first previous_tag ||= Utils.popen_read("git tag --list --sort=-version:refname") .lines.first.chomp @@ -28,7 +34,7 @@ def release_notes s.gsub(%r{.*Merge pull request #(\d+) from ([^/]+)/[^>]*(>>)*}, "https://github.com/Homebrew/brew/pull/\\1 (@\\2)") end - if ARGV.include?("--markdown") + if args.markdown? output.map! do |s| /(.*\d)+ \(@(.+)\) - (.*)/ =~ s "- [#{Regexp.last_match(3)}](#{Regexp.last_match(1)}) (@#{Regexp.last_match(2)})"
false
Other
Homebrew
brew
fc7fb60b72d47aaf527bf53a7313db8fb84e7bdd.json
system_config: use some puts for clang.
Library/Homebrew/system_config.rb
@@ -212,16 +212,15 @@ def dump_verbose_config(f = $stdout) f.puts "GCC-4.2: build #{gcc_4_2}" unless gcc_4_2.null? f.print "Clang: " if clang.null? - f.print "N/A" + f.puts "N/A" else f.print "#{clang} build " if clang_build.null? - f.print "(parse error)" + f.puts "(parse error)" else - f.print clang_build + f.puts clang_build end end - f.print "\n" f.puts "Git: #{describe_git}" f.puts "Curl: #{describe_curl}" f.puts "Perl: #{describe_perl}"
false
Other
Homebrew
brew
0513d9de5c3c1cd860474df3dfba3847e70331ff.json
display_items: handle nil keys
Library/Homebrew/linkage_checker.rb
@@ -22,11 +22,8 @@ def initialize(keg, formula = nil) end def dylib_to_dep(dylib) - if dylib =~ %r{#{Regexp.escape(HOMEBREW_PREFIX)}/(opt|Cellar)/([\w+-.@]+)/} - Regexp.last_match(2) - else - "Not a Homebrew library" - end + dylib =~ %r{#{Regexp.escape(HOMEBREW_PREFIX)}/(opt|Cellar)/([\w+-.@]+)/} + Regexp.last_match(2) end def check_dylibs @@ -170,7 +167,7 @@ def display_items(label, things) return if things.empty? puts "#{label}:" if things.is_a? Hash - things.sort.each do |list_label, list| + things.sort_by { |k, _| k.to_s }.each do |list_label, list| list.sort.each do |item| puts " #{item} (#{list_label})" end
false
Other
Homebrew
brew
8634f19107d98e56fa12165e92800a2120e9b13e.json
linkage: consider missing links to Cellar
Library/Homebrew/linkage_checker.rb
@@ -88,8 +88,8 @@ def check_undeclared_deps end missing = [] @broken_dylibs.each do |str| - next unless str.start_with? "#{HOMEBREW_PREFIX}/opt" - missing << str.sub("#{HOMEBREW_PREFIX}/opt/", "").split("/")[0] + next unless str.start_with?("#{HOMEBREW_PREFIX}/opt", HOMEBREW_CELLAR) + missing << str.sub("#{HOMEBREW_PREFIX}/opt/", "").sub("#{HOMEBREW_CELLAR}/", "").split("/")[0] end unnecessary_deps -= missing [indirect_deps, undeclared_deps, unnecessary_deps]
false
Other
Homebrew
brew
b23f66982f823037254e5c4822f1ed2f00c6a2f8.json
Improve external command documentation Extract `brew bundle` and `brew services` docs from their help. Add a little for `brew cask` until we can think about e.g. merging the manpages.
Library/Homebrew/cmd/help.rb
@@ -74,14 +74,13 @@ def help(cmd = nil, flags = {}) end def command_help(path) - help_lines = path.read.lines.grep(/^#:/) + help_lines = command_help_lines(path) if help_lines.empty? opoo "No help text in: #{path}" if ARGV.homebrew_developer? HOMEBREW_HELP else help_lines.map do |line| - line.slice(2..-1) - .sub(/^ \* /, "#{Tty.bold}brew#{Tty.reset} ") + line.sub(/^ \* /, "#{Tty.bold}brew#{Tty.reset} ") .gsub(/`(.*?)`/, "#{Tty.bold}\\1#{Tty.reset}") .gsub(%r{<([^\s]+?://[^\s]+?)>}) { |url| Formatter.url(url) } .gsub(/<(.*?)>/, "#{Tty.underline}\\1#{Tty.reset}")
true
Other
Homebrew
brew
b23f66982f823037254e5c4822f1ed2f00c6a2f8.json
Improve external command documentation Extract `brew bundle` and `brew services` docs from their help. Add a little for `brew cask` until we can think about e.g. merging the manpages.
Library/Homebrew/dev-cmd/man.rb
@@ -71,6 +71,9 @@ def build_man_page variables[:former_maintainers] = readme.read[/(Former maintainers .*\.)/, 1] .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') + variables[:homebrew_bundle] = help_output(:bundle) + variables[:homebrew_services] = help_output(:services) + ERB.new(template, nil, ">").result(variables.instance_eval { binding }) end @@ -113,6 +116,12 @@ def convert_man_page(markup, target) end end + def help_output(command) + tap = Tap.fetch("Homebrew/homebrew-#{command}") + tap.install unless tap.installed? + command_help_lines(which("brew-#{command}.rb", Tap.cmd_directories)) + end + def target_path_to_format(target) case target.basename when /\.md$/ then ["--markdown", "markdown"]
true
Other
Homebrew
brew
b23f66982f823037254e5c4822f1ed2f00c6a2f8.json
Improve external command documentation Extract `brew bundle` and `brew services` docs from their help. Add a little for `brew cask` until we can think about e.g. merging the manpages.
Library/Homebrew/manpages/brew.1.md.erb
@@ -56,17 +56,21 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note ## OFFICIAL EXTERNAL COMMANDS - * `bundle`: - Bundler for non-Ruby dependencies from Homebrew: - <https://github.com/Homebrew/homebrew-bundle> + <%= homebrew_bundle.join("\n ").strip %> - * `cask`: - Install macOS applications distributed as binaries: - <https://github.com/caskroom/homebrew-cask> - * `services`: - Integrates Homebrew formulae with macOS's `launchctl`(1) manager: - <https://github.com/Homebrew/homebrew-services> + Homebrew/homebrew-bundle <https://github.com/Homebrew/homebrew-bundle> + + * `cask` [`--version` | `audit` | `cat` | `cleanup` | `create` | `doctor` | `edit` | `fetch` | `home` | `info`]: + Install macOS applications distributed as binaries. + + + Caskroom/homebrew-cask <https://github.com/caskroom/homebrew-cask> + + <%= homebrew_services.join("\n ").strip %> + + + Homebrew/homebrew-services <https://github.com/Homebrew/homebrew-services> ## CUSTOM EXTERNAL COMMANDS
true