From 3c566399cf8dab3aff8c54381e7b83b0e6ef3995 Mon Sep 17 00:00:00 2001 From: David Broder-Rodgers Date: Fri, 23 Dec 2016 11:29:31 +0000 Subject: Added check for insecure mirror URLs --- Library/Homebrew/dev-cmd/audit.rb | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index e83fb2bd0..fffe14b47 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -623,11 +623,11 @@ class FormulaAuditor %w[Stable Devel HEAD].each do |name| next unless spec = formula.send(name.downcase) - ra = ResourceAuditor.new(spec).audit + ra = ResourceAuditor.new(spec, online: @online).audit problems.concat ra.problems.map { |problem| "#{name}: #{problem}" } spec.resources.each_value do |resource| - ra = ResourceAuditor.new(resource).audit + ra = ResourceAuditor.new(resource, online: @online).audit problems.concat ra.problems.map { |problem| "#{name} resource #{resource.name.inspect}: #{problem}" } @@ -1127,7 +1127,7 @@ class ResourceAuditor attr_reader :problems attr_reader :version, :checksum, :using, :specs, :url, :mirrors, :name - def initialize(resource) + def initialize(resource, options = {}) @name = resource.name @version = resource.version @checksum = resource.checksum @@ -1135,6 +1135,7 @@ class ResourceAuditor @mirrors = resource.mirrors @using = resource.using @specs = resource.specs + @online = options[:online] @problems = [] end @@ -1390,6 +1391,20 @@ class ResourceAuditor next unless u =~ %r{https?://(?:central|repo\d+)\.maven\.org/maven2/(.+)$} problem "#{u} should be `https://search.maven.org/remotecontent?filepath=#{$1}`" end + + return unless @online + urls.each do |url| + next unless url.start_with? "http:" + # Check for insecure mirrors + status_code, = curl_output "--connect-timeout", "15", "--output", "/dev/null", "--range", "0-0", \ + "--write-out", "%{http_code}", url + secure_url = url.sub "http", "https" + secure_status_code, = curl_output "--connect-timeout", "15", "--output", "/dev/null", "--range", "0-0", \ + "--write-out", "%{http_code}", secure_url + if status_code.start_with?("20") && secure_status_code.start_with?("20") + problem "The URL #{url} could use HTTPS rather than HTTP" + end + end end def problem(text) -- cgit v1.2.3 From f4496e85e515180f96e0863af3047bf3f4a94e81 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sun, 15 Jan 2017 02:31:11 -0800 Subject: audit: don't allow universal for new formulae. We're frowning on these now so may as well turn that into code. --- Library/Homebrew/dev-cmd/audit.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 744aa6fbe..f2306debf 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -481,6 +481,10 @@ class FormulaAuditor next unless @strict + if o.name == "universal" + problem "macOS has been 64-bit only since 10.6 so universal options are deprecated." + end + if o.name !~ /with(out)?-/ && o.name != "c++11" && o.name != "universal" problem "Options should begin with with/without. Migrate '--#{o.name}' with `deprecated_option`." end -- cgit v1.2.3 From feea90c0ddee280193182d8cce2ce56bc8e4aa6f Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 16 Jan 2017 20:15:20 +0000 Subject: create: handle null versions. Fixes #1821 --- Library/Homebrew/dev-cmd/create.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/create.rb b/Library/Homebrew/dev-cmd/create.rb index 07dd1b322..b4cda0fad 100644 --- a/Library/Homebrew/dev-cmd/create.rb +++ b/Library/Homebrew/dev-cmd/create.rb @@ -142,12 +142,10 @@ class FormulaCreator def generate! raise "#{path} already exists" if path.exist? - if version.nil? + if version.nil? || version.null? opoo "Version cannot be determined from URL." puts "You'll need to add an explicit 'version' to the formula." - end - - if fetch? && version + elsif fetch? r = Resource.new r.url(url) r.version(version) -- cgit v1.2.3 From dac66c4ada178c09b3b9b77feb2eaa7442b7443e Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 17 Jan 2017 10:43:43 +0000 Subject: Add `keg_only :versioned_formula`. This is used to indicate a formula is a version of another formula. This will be used to provide a consistent interface for older formulae versions and replaces the use of `conflicts_with`. --- Library/Homebrew/dev-cmd/audit.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 394e0e763..281839621 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -459,6 +459,14 @@ class FormulaAuditor end def audit_conflicts + if formula.versioned_formula? + problem <<-EOS + Versioned formulae should not use `conflicts_with`. + Use `keg_only :versioned_formula` instead. + EOS + return + end + formula.conflicts.each do |c| begin Formulary.factory(c.name) @@ -497,7 +505,7 @@ class FormulaAuditor return unless @new_formula return if formula.deprecated_options.empty? - return if formula.name.include?("@") + return if formula.versioned_formula? problem "New formulae should not use `deprecated_option`." end -- cgit v1.2.3 From 42486c1181bdf4ed85f334ccb1edbb6632cfc4b2 Mon Sep 17 00:00:00 2001 From: Zhiming Wang Date: Tue, 17 Jan 2017 10:16:35 -0500 Subject: bottle: add: improve regexp to recognize comments This would have eliminated the need for Homebrew/homebrew-core#9000, for instance. --- Library/Homebrew/dev-cmd/bottle.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index 9618cf412..75078cffd 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -435,6 +435,7 @@ module Homebrew else string = s.sub!( /( + (\ {2}\#[^\n]*\n)* # comments \ {2}( # two spaces at the beginning (url|head)\ ['"][\S\ ]+['"] # url or head with a string ( -- cgit v1.2.3 From 4f0505f759d355d6a514485733c0ea3349711655 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 17 Jan 2017 19:09:41 +0000 Subject: audit: only warn on versioned conflicts_with. Rather than all versioned formulae regardless. Oops. --- Library/Homebrew/dev-cmd/audit.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 281839621..594555695 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -459,7 +459,7 @@ class FormulaAuditor end def audit_conflicts - if formula.versioned_formula? + if formula.conflicts.any? && formula.versioned_formula? problem <<-EOS Versioned formulae should not use `conflicts_with`. Use `keg_only :versioned_formula` instead. -- cgit v1.2.3 From 0b3d9031e26b47d0ebf48276616c1c4da01ce336 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Wed, 18 Jan 2017 15:55:32 +0530 Subject: Add --fix option to brew audit command --- Library/Homebrew/dev-cmd/audit.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 88d9a535c..c2d6aeaed 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -1,11 +1,14 @@ -#: * `audit` [`--strict`] [`--online`] [`--new-formula`] [`--display-cop-names`] [`--display-filename`] []: +#: * `audit` [`--strict`] [`--fix`] [`--online`] [`--new-formula`] [`--display-cop-names`] [`--display-filename`] []: #: Check for Homebrew coding style violations. This should be #: run before submitting a new formula. #: #: If no are provided, all of them are checked. #: #: If `--strict` is passed, additional checks are run, including RuboCop -#: style checks. +#: style checks and custom cop checks. +#: +#: If `--fix` is passed, style violations and custom cop violations will be +#: automatically fixed using RuboCop's `--auto-correct` feature. #: #: If `--online` is passed, additional slower checks that require a network #: connection are run. @@ -62,8 +65,9 @@ module Homebrew end if strict + options = { fix: ARGV.flag?("--fix"), realpath: true } # Check style in a single batch run up front for performance - style_results = check_style_json(files, realpath: true) + style_results = check_style_json(files, options) end ff.each do |f| -- cgit v1.2.3 From cebe137499cc5e74dd0b34e54226a1ade7a4bf60 Mon Sep 17 00:00:00 2001 From: ilovezfs Date: Wed, 18 Jan 2017 11:03:36 -0800 Subject: audit: exempt wine's deps from the universal deprecation This can be reverted when wine's dependencies are all vendored. --- Library/Homebrew/dev-cmd/audit.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 594555695..5b0102130 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -489,7 +489,7 @@ class FormulaAuditor next unless @strict - if o.name == "universal" + if o.name == "universal" && !Formula["wine"].recursive_dependencies.map(&:name).include?(formula.name) problem "macOS has been 64-bit only since 10.6 so universal options are deprecated." end -- cgit v1.2.3 From 22f294af90ed08e2da9d0652fdc9c560c7797bed Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Sun, 22 Jan 2017 19:50:14 +0800 Subject: bottle: fix regex Noted that this is intended for the revision of this formula instead of rebuild of a bottle. --- Library/Homebrew/dev-cmd/bottle.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index 75078cffd..7367e5c37 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -443,7 +443,7 @@ module Homebrew (\n^\ {3}[\S\ ]+$)* # options can be in multiple lines )?| (homepage|desc|sha1|sha256|version|mirror)\ ['"][\S\ ]+['"]| # specs with a string - rebuild\ \d+ # rebuild with a number + revision\ \d+ # revision with a number )\n+ # multiple empty lines )+ /mx, '\0' + output + "\n" -- cgit v1.2.3 From 19e61355b38b8ba96db0ca71849bb536af0490bf Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sun, 22 Jan 2017 20:54:37 +0000 Subject: tests: remove with_git_env method A common git environment is now used in all tests, so this is no longer required. --- Library/Homebrew/dev-cmd/tests.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index b4f3c2d40..05bdda8d2 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -34,6 +34,7 @@ module Homebrew %w[AUTHOR COMMITTER].each do |role| ENV["GIT_#{role}_NAME"] = "brew tests" ENV["GIT_#{role}_EMAIL"] = "brew-tests@localhost" + ENV["GIT_#{role}_DATE"] = "Sun Jan 22 19:59:13 2017 +0000" end Homebrew.install_gem_setup_path! "bundler" -- cgit v1.2.3 From 4291476fa3042e76b3acfde7836affaea4557a02 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Mon, 23 Jan 2017 18:48:51 +0000 Subject: man: remove an unnecessary `else` `odie` causes the process to exit immediately, so there's no need for the `regenerate_man_pages` call to be conditional. --- Library/Homebrew/dev-cmd/man.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb index 64c970453..581db38ca 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -23,10 +23,10 @@ module Homebrew if ARGV.flag? "--link" odie "`brew man --link` is now done automatically by `brew update`." - else - regenerate_man_pages end + regenerate_man_pages + if system "git", "-C", HOMEBREW_REPOSITORY, "diff", "--quiet", "docs/brew.1.html", "manpages" puts "No changes to manpage output detected." elsif ARGV.include?("--fail-if-changed") -- cgit v1.2.3 From 34e03532a02318b5e9b43fba7e73890c6e403062 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 26 Jan 2017 16:19:38 +0000 Subject: audit: improve homepage audit reliability. Try first with an (exact, actual) browser user agent from Safari and then try again with the default Homebrew `curl` user agent. --- Library/Homebrew/dev-cmd/audit.rb | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 5b0102130..b5dc4ecb1 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -169,7 +169,7 @@ class FormulaAuditor @specs = %w[stable devel head].map { |s| formula.send(s) }.compact end - def url_status_code(url, range: false, user_agent: :default) + def url_status_code(url, range: false) # The system Curl is too old and unreliable with HTTPS homepages on # Yosemite and below. return "200" unless DevelopmentTools.curl_handles_most_https_homepages? @@ -182,14 +182,13 @@ class FormulaAuditor extra_args << "--range" << "0-0" if range extra_args << url - args = curl_args( - extra_args: extra_args, - show_output: true, - user_agent: user_agent - ) - retries = 3 status_code = nil - retries.times do + [:browser, :default].each do |user_agent| + args = curl_args( + extra_args: extra_args, + show_output: true, + user_agent: user_agent + ) status_code = Open3.popen3(*args) { |_, stdout, _, _| stdout.read } break if status_code.start_with? "20" end @@ -609,7 +608,7 @@ class FormulaAuditor return unless @online - status_code = url_status_code(homepage, user_agent: :browser) + status_code = url_status_code(homepage) return if status_code.start_with? "20" problem "The homepage #{homepage} is not reachable (HTTP status code #{status_code})" end -- cgit v1.2.3 From eff70115b5eb20542c7d66725e1812cb0e149ff3 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 27 Jan 2017 09:36:47 +0000 Subject: pull: better handle missing bottles. If we make a PR in which we're building many formulae (e.g. https://github.com/Homebrew/homebrew-core/pull/9249) then we may want to pull those that built and publish their bottles and discard those that did not. Instead of saying bottles will be published when they won't and then blowing up just avoid publishing them and print a warning instead. --- Library/Homebrew/dev-cmd/pull.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb index f7006baaa..8771788e4 100644 --- a/Library/Homebrew/dev-cmd/pull.rb +++ b/Library/Homebrew/dev-cmd/pull.rb @@ -248,7 +248,6 @@ module Homebrew changed_formulae_names.each do |name| f = Formula[name] next if f.bottle_unneeded? || f.bottle_disabled? - ohai "Publishing on Bintray: #{f.name} #{f.pkg_version}" publish_bottle_file_on_bintray(f, bintray_creds) published << f.full_name end @@ -408,7 +407,12 @@ module Homebrew if info.nil? raise "Failed publishing bottle: failed reading formula info for #{f.full_name}" end + unless info.bottle_info_any + opoo "No bottle defined in formula #{package}" + return + end version = info.pkg_version + ohai "Publishing on Bintray: #{package} #{version}" curl "-w", '\n', "--silent", "--fail", "-u#{creds[:user]}:#{creds[:key]}", "-X", "POST", "-H", "Content-Type: application/json", -- cgit v1.2.3 From d4aa98d2300c0b81dd0d1608cf7fc67dbe5a6c04 Mon Sep 17 00:00:00 2001 From: David Broder-Rodgers Date: Mon, 30 Jan 2017 20:46:41 +0000 Subject: Updated mirror checks to compare ETags, Content-Lengths and binary files --- Library/Homebrew/dev-cmd/audit.rb | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index af1e4a71b..75e81db90 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -1481,18 +1481,42 @@ class ResourceAuditor urls.each do |url| next unless url.start_with? "http:" # Check for insecure mirrors - status_code, = curl_output "--connect-timeout", "15", "--output", "/dev/null", "--range", "0-0", \ - "--write-out", "%{http_code}", url + details = get_content_details(url, 1) secure_url = url.sub "http", "https" - secure_status_code, = curl_output "--connect-timeout", "15", "--output", "/dev/null", "--range", "0-0", \ - "--write-out", "%{http_code}", secure_url - if status_code.start_with?("20") && secure_status_code.start_with?("20") + secure_details = get_content_details(secure_url, 2) + + next unless details[:status].start_with?("2") && secure_details[:status].start_with?("2") + + if (details[:etag] && details[:etag] == secure_details[:etag]) \ + || (details[:content_length] && details[:content_length] == secure_details[:content_length]) \ + || are_same_file(details[:filename], secure_details[:filename]) problem "The URL #{url} could use HTTPS rather than HTTP" end + + remove_files details[:filename], secure_details[:filename] end end def problem(text) @problems << text end + + def get_content_details(url, id) + out = {} + out_file = "/tmp/_c#{id}" + headers, = curl_output "--connect-timeout", "15", "--output", out_file, "--dump-header", "/dev/stdout", url + out[:status] = headers[%r{HTTP\/.* (\d+)}, 1] + out[:etag] = headers[%r{ETag: ([wW]\/)?"(([^"]|\\")*)"}, 2] + out[:content_length] = headers[/Content-Length: (\d+)/, 1] + out[:filename] = out_file + out + end + + def are_same_file(one, two) + quiet_system "diff", "--report-identical-files", "--binary", "--speed-large-files", one, two + end + + def remove_files(*files) + quiet_system "rm", "-f", *files + end end -- cgit v1.2.3 From 64c83f3286a40cbe8871124f208fb3eaaaffd97a Mon Sep 17 00:00:00 2001 From: David Broder-Rodgers Date: Thu, 2 Feb 2017 21:25:29 +0000 Subject: Use file checksum rather than file diffing --- Library/Homebrew/dev-cmd/audit.rb | 48 ++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 26 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 75e81db90..b4906cb80 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -36,6 +36,7 @@ require "cmd/search" require "cmd/style" require "date" require "blacklist" +require "digest" module Homebrew module_function @@ -1479,21 +1480,23 @@ class ResourceAuditor return unless @online urls.each do |url| - next unless url.start_with? "http:" - # Check for insecure mirrors - details = get_content_details(url, 1) - secure_url = url.sub "http", "https" - secure_details = get_content_details(secure_url, 2) - - next unless details[:status].start_with?("2") && secure_details[:status].start_with?("2") - - if (details[:etag] && details[:etag] == secure_details[:etag]) \ - || (details[:content_length] && details[:content_length] == secure_details[:content_length]) \ - || are_same_file(details[:filename], secure_details[:filename]) - problem "The URL #{url} could use HTTPS rather than HTTP" - end + check_insecure_mirror(url) if url.start_with? "http:" + end + end + + def check_insecure_mirror(url) + details = get_content_details(url) + secure_url = url.sub "http", "https" + secure_details = get_content_details(secure_url) + + return if !details[:status].start_with?("2") || !secure_details[:status].start_with?("2") - remove_files details[:filename], secure_details[:filename] + etag_match = details[:etag] && details[:etag] == secure_details[:etag] + content_length_match = details[:content_length] && details[:content_length] == secure_details[:content_length] + file_match = details[:file_hash] == secure_details[:file_hash] + + if etag_match || content_length_match || file_match + problem "The URL #{url} could use HTTPS rather than HTTP" end end @@ -1501,22 +1504,15 @@ class ResourceAuditor @problems << text end - def get_content_details(url, id) + def get_content_details(url) out = {} - out_file = "/tmp/_c#{id}" - headers, = curl_output "--connect-timeout", "15", "--output", out_file, "--dump-header", "/dev/stdout", url + output, = curl_output "--connect-timeout", "15", "--include", url + split = output.partition("\r\n\r\n") + headers = split.first out[:status] = headers[%r{HTTP\/.* (\d+)}, 1] out[:etag] = headers[%r{ETag: ([wW]\/)?"(([^"]|\\")*)"}, 2] out[:content_length] = headers[/Content-Length: (\d+)/, 1] - out[:filename] = out_file + out[:file_hash] = Digest::SHA256.digest split.last out end - - def are_same_file(one, two) - quiet_system "diff", "--report-identical-files", "--binary", "--speed-large-files", one, two - end - - def remove_files(*files) - quiet_system "rm", "-f", *files - end end -- cgit v1.2.3 From 1f5cf4fd40fc3528e700a421afc9a128c159cac9 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Wed, 18 Jan 2017 22:37:11 +0530 Subject: Update docs and manpages to include --fix option --- Library/Homebrew/dev-cmd/audit.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index c2d6aeaed..5ad12d4b6 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -5,9 +5,9 @@ #: If no are provided, all of them are checked. #: #: If `--strict` is passed, additional checks are run, including RuboCop -#: style checks and custom cop checks. +#: style checks. #: -#: If `--fix` is passed, style violations and custom cop violations will be +#: If `--fix` is passed, style violations will be #: automatically fixed using RuboCop's `--auto-correct` feature. #: #: If `--online` is passed, additional slower checks that require a network -- cgit v1.2.3 From ba2ec8abcc0f4a33852da4bb58af975d604569d5 Mon Sep 17 00:00:00 2001 From: Fabian Mettler Date: Mon, 6 Feb 2017 14:22:17 +0100 Subject: Fix: Documentation of --only in tests cmd This pull request fixes the documentation for the —only flag of the tests cmd. --- Library/Homebrew/dev-cmd/tests.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index 05bdda8d2..9d93fc9e8 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -1,4 +1,4 @@ -#: * `tests` [`-v`] [`--coverage`] [`--generic`] [`--no-compat`] [`--only=`] [`--seed` ] [`--trace`] [`--online`] [`--official-cmd-taps`]: +#: * `tests` [`-v`] [`--coverage`] [`--generic`] [`--no-compat`] [`--only=`] [`--seed` ] [`--trace`] [`--online`] [`--official-cmd-taps`]: #: Run Homebrew's unit and integration tests. require "fileutils" -- cgit v1.2.3 From 11ebfdafb227ae36559f65c6bd098172301e82f0 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Tue, 7 Feb 2017 00:19:58 +0000 Subject: audit: enforce https for github.com urls --- Library/Homebrew/dev-cmd/audit.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index b5dc4ecb1..7a5d38afe 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -1343,6 +1343,7 @@ class ResourceAuditor %r{^http://(?:[^/]*\.)?bintray\.com/}, %r{^http://tools\.ietf\.org/}, %r{^http://launchpad\.net/}, + %r{^http://github\.com/}, %r{^http://bitbucket\.org/}, %r{^http://anonscm\.debian\.org/}, %r{^http://cpan\.metacpan\.org/}, -- cgit v1.2.3 From 79280826f5c8faa82c623a2fb3bb797a75a5d94a Mon Sep 17 00:00:00 2001 From: ilovezfs Date: Wed, 8 Feb 2017 00:58:20 -0800 Subject: pull: fix false positives for nonstandard bump subjects when untapped If the formula's tap isn't tapped yet when running `brew pull`, a false positive occurs for the nonstandard bump subject check, and a bogus warning is printed, which claims the bump subject should refer to the old version not the new version. --- Library/Homebrew/dev-cmd/pull.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb index 8771788e4..c2342d39c 100644 --- a/Library/Homebrew/dev-cmd/pull.rb +++ b/Library/Homebrew/dev-cmd/pull.rb @@ -376,7 +376,7 @@ module Homebrew subject_strs << "remove stable" formula_name_str += ":" # just for cosmetics else - subject_strs << formula.version.to_s + subject_strs << new[:stable] end end if old[:devel] != new[:devel] @@ -387,7 +387,7 @@ module Homebrew formula_name_str += ":" # just for cosmetics end else - subject_strs << "#{formula.devel.version} (devel)" + subject_strs << "#{new[:devel]} (devel)" end end subject = subject_strs.empty? ? nil : "#{formula_name_str} #{subject_strs.join(", ")}" -- cgit v1.2.3 From 03253a8d8b66b49eb6b6a7edd4ed353bcbf3a238 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sun, 5 Feb 2017 18:03:11 +0100 Subject: audit: enforce https://*.sourceforge.io/ homepages Ref: https://sourceforge.net/blog/introducing-https-for-project-websites/ --- Library/Homebrew/dev-cmd/audit.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index b5dc4ecb1..d10ff51f4 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -584,6 +584,10 @@ class FormulaAuditor problem "Please use https:// for #{homepage}" end + if homepage =~ %r{^http://([^/]*)\.(sf|sourceforge)\.net(/|$)} + problem "#{homepage} should be `https://#{$1}.sourceforge.io/`" + end + # There's an auto-redirect here, but this mistake is incredibly common too. # Only applies to the homepage and subdomains for now, not the FTP URLs. if homepage =~ %r{^http://((?:build|cloud|developer|download|extensions|git|glade|help|library|live|nagios|news|people|projects|rt|static|wiki|www)\.)?gnome\.org} -- cgit v1.2.3 From c4ac30830273c9a638b4a7c32d31b0ab22bb39f8 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 10 Feb 2017 21:21:57 +0100 Subject: Allow `brew tests` to run specs. --- Library/Homebrew/dev-cmd/tests.rb | 45 ++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 13 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index 9d93fc9e8..244fbe027 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -7,10 +7,21 @@ require "tap" module Homebrew module_function + def run_tests(executable, files, args = []) + opts = [] + opts << "--serialize-stdout" if ENV["CI"] + + system "bundle", "exec", executable, *opts, "--", *args, "--", *files + + return if $?.success? + Homebrew.failed = true + end + def tests HOMEBREW_LIBRARY_PATH.cd do ENV.delete "HOMEBREW_VERBOSE" ENV.delete "VERBOSE" + ENV.delete("HOMEBREW_CASK_OPTS") ENV["HOMEBREW_NO_ANALYTICS_THIS_RUN"] = "1" ENV["HOMEBREW_DEVELOPER"] = "1" ENV["TESTOPTS"] = "-v" if ARGV.verbose? @@ -45,27 +56,35 @@ module Homebrew # Make it easier to reproduce test runs. ENV["SEED"] = ARGV.next if ARGV.include? "--seed" - files = Dir.glob("test/**/*_test.rb") + files = Dir.glob("test/**/*_{spec,test}.rb") .reject { |p| !OS.mac? && p.start_with?("test/os/mac/") } + .reject { |p| !OS.mac? && p.start_with?("test/cask/") } .reject { |p| p.start_with?("test/vendor/bundle/") } - opts = [] - opts << "--serialize-stdout" if ENV["CI"] - - args = [] - args << "--trace" if ARGV.include? "--trace" + test_args = [] + test_args << "--trace" if ARGV.include? "--trace" if ARGV.value("only") test_name, test_method = ARGV.value("only").split(":", 2) - files = Dir.glob("test/{#{test_name},#{test_name}/**/*}_test.rb") - args << "--name=test_#{test_method}" if test_method + files = Dir.glob("test/{#{test_name},#{test_name}/**/*}_{spec,test}.rb") + test_args << "--name=test_#{test_method}" if test_method end - args += ARGV.named.select { |v| v[/^TEST(OPTS)?=/] } - - system "bundle", "exec", "parallel_test", *opts, "--", *args, "--", *files - - Homebrew.failed = !$?.success? + test_files = files.select { |p| p.end_with?("_test.rb") } + spec_files = files.select { |p| p.end_with?("_spec.rb") } + + test_args += ARGV.named.select { |v| v[/^TEST(OPTS)?=/] } + run_tests "parallel_test", test_files, test_args + + spec_args = [ + "--color", + "-I", HOMEBREW_LIBRARY_PATH/"test", + "--require", "spec_helper", + "--format", "progress", + "--format", "ParallelTests::RSpec::RuntimeLogger", + "--out", "tmp/parallel_runtime_rspec.log" + ] + run_tests "parallel_rspec", spec_files, spec_args if (fs_leak_log = HOMEBREW_LIBRARY_PATH/"tmp/fs_leak.log").file? fs_leak_log_content = fs_leak_log.read -- cgit v1.2.3 From ae829ed229395159adf6f1f17fb26518ec27fca6 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Tue, 7 Feb 2017 23:25:02 -0800 Subject: add brew where command --- Library/Homebrew/dev-cmd/where.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Library/Homebrew/dev-cmd/where.rb (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/where.rb b/Library/Homebrew/dev-cmd/where.rb new file mode 100644 index 000000000..63237301b --- /dev/null +++ b/Library/Homebrew/dev-cmd/where.rb @@ -0,0 +1,15 @@ +#: * `where` : +#: echo location of the specified to stdout + +require "formula" + +module Homebrew + module_function + + def where + raise FormulaUnspecifiedError if ARGV.named.empty? + ARGV.resolved_formulae.each do |f| + puts "#{f.path}\n" + end + end +end -- cgit v1.2.3 From ac091437e5b2ae8ca21058cf47184f1788c8d697 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Wed, 8 Feb 2017 00:12:50 -0800 Subject: renamed where to formula --- Library/Homebrew/dev-cmd/formula.rb | 15 +++++++++++++++ Library/Homebrew/dev-cmd/where.rb | 15 --------------- 2 files changed, 15 insertions(+), 15 deletions(-) create mode 100644 Library/Homebrew/dev-cmd/formula.rb delete mode 100644 Library/Homebrew/dev-cmd/where.rb (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/formula.rb b/Library/Homebrew/dev-cmd/formula.rb new file mode 100644 index 000000000..80008a354 --- /dev/null +++ b/Library/Homebrew/dev-cmd/formula.rb @@ -0,0 +1,15 @@ +#: * `formula` : +#: echo location of the specified to stdout + +require "formula" + +module Homebrew + module_function + + def formula + raise FormulaUnspecifiedError if ARGV.named.empty? + ARGV.resolved_formulae.each do |f| + puts "#{f.path}\n" + end + end +end diff --git a/Library/Homebrew/dev-cmd/where.rb b/Library/Homebrew/dev-cmd/where.rb deleted file mode 100644 index 63237301b..000000000 --- a/Library/Homebrew/dev-cmd/where.rb +++ /dev/null @@ -1,15 +0,0 @@ -#: * `where` : -#: echo location of the specified to stdout - -require "formula" - -module Homebrew - module_function - - def where - raise FormulaUnspecifiedError if ARGV.named.empty? - ARGV.resolved_formulae.each do |f| - puts "#{f.path}\n" - end - end -end -- cgit v1.2.3 From 0d715f90ea0e9b84231ce2221709f2134ee0ae31 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Sat, 11 Feb 2017 16:37:41 -0800 Subject: applied changes suggested in PR --- Library/Homebrew/dev-cmd/formula.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/formula.rb b/Library/Homebrew/dev-cmd/formula.rb index 80008a354..71687dfa7 100644 --- a/Library/Homebrew/dev-cmd/formula.rb +++ b/Library/Homebrew/dev-cmd/formula.rb @@ -1,5 +1,5 @@ -#: * `formula` : -#: echo location of the specified to stdout +#: * `formula` : +#: Display the path where is require "formula" @@ -8,8 +8,6 @@ module Homebrew def formula raise FormulaUnspecifiedError if ARGV.named.empty? - ARGV.resolved_formulae.each do |f| - puts "#{f.path}\n" - end + ARGV.resolved_formulae.each { |f| puts f.path } end end -- cgit v1.2.3 From 9e97eadccbd99df1c6ffe489ab316d7ebde7fe86 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sun, 12 Feb 2017 15:06:54 +0000 Subject: rubocop: trailing comma in multiline method calls Discussed in https://github.com/Homebrew/brew/pull/1987/files#r100693581. This was originally ommitted because it wasn't compatible with Ruby 1.8. (See https://github.com/Homebrew/legacy-homebrew/pull/48144#r49928971). --- Library/Homebrew/dev-cmd/audit.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 0e7c11005..0522c7878 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -191,7 +191,7 @@ class FormulaAuditor args = curl_args( extra_args: extra_args, show_output: true, - user_agent: user_agent + user_agent: user_agent, ) status_code = Open3.popen3(*args) { |_, stdout, _, _| stdout.read } break if status_code.start_with? "20" -- cgit v1.2.3 From 539120143bad6ffb9a8a7c3e2ab76c6bc951036e Mon Sep 17 00:00:00 2001 From: ilovezfs Date: Sun, 12 Feb 2017 09:22:26 -0800 Subject: bump-formula-pr: block duplicate pull-requests --- Library/Homebrew/dev-cmd/bump-formula-pr.rb | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index 68bf32d0b..ea2daf1c4 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -78,8 +78,43 @@ module Homebrew end end + def fetch_pull_requests(formula) + GitHub.issues_for_formula(formula.name, tap: formula.tap).select do |pr| + pr["html_url"].include?("/pull/") + 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 && !pull_requests.empty? + duplicates_message = <<-EOS.undent + 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.undent + #{duplicates_message.chomp} + #{error_message} + EOS + end + end + def bump_formula_pr formula = ARGV.formulae.first + + if formula + check_for_duplicate_pull_requests(formula) + checked_for_duplicates = true + end + new_url = ARGV.value("url") if new_url && !formula is_devel = ARGV.include?("--devel") @@ -101,6 +136,8 @@ module Homebrew end odie "No formula found!" unless formula + check_for_duplicate_pull_requests(formula) unless checked_for_duplicates + requested_spec, formula_spec = if ARGV.include?("--devel") devel_message = " (devel)" [:devel, formula.devel] -- cgit v1.2.3 From a09169f248de707bf8121acfb6c5d5c2b92c58de Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 13 Feb 2017 15:49:33 +0100 Subject: audit: enforce https for *.sourceforge.io urls --- Library/Homebrew/dev-cmd/audit.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 0522c7878..3447633eb 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -584,7 +584,9 @@ class FormulaAuditor # People will run into mixed content sometimes, but we should enforce and then add # exemptions as they are discovered. Treat mixed content on homepages as a bug. # Justify each exemptions with a code comment so we can keep track here. - if homepage =~ %r{^http://[^/]*github\.io/} + case homepage + when %r{^http://[^/]*github\.io/}, + %r{^http://[^/]*\.sourceforge\.io/} problem "Please use https:// for #{homepage}" end -- cgit v1.2.3 From 64448834a68ee1e183e5c2bf9504dadfa9431dc1 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 13 Feb 2017 16:20:34 +0000 Subject: fix existing rule for github.io homepages --- Library/Homebrew/dev-cmd/audit.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 3447633eb..6aeb18749 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -585,7 +585,7 @@ class FormulaAuditor # exemptions as they are discovered. Treat mixed content on homepages as a bug. # Justify each exemptions with a code comment so we can keep track here. case homepage - when %r{^http://[^/]*github\.io/}, + when %r{^http://[^/]*\.github\.io/}, %r{^http://[^/]*\.sourceforge\.io/} problem "Please use https:// for #{homepage}" end -- cgit v1.2.3 From b2dd6bc9b0c765104898d128c455b2f107498399 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 15 Feb 2017 14:41:06 +0000 Subject: audit: fix brew style warning. --- Library/Homebrew/dev-cmd/audit.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index b4906cb80..5e674cf12 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -1495,9 +1495,8 @@ class ResourceAuditor content_length_match = details[:content_length] && details[:content_length] == secure_details[:content_length] file_match = details[:file_hash] == secure_details[:file_hash] - if etag_match || content_length_match || file_match - problem "The URL #{url} could use HTTPS rather than HTTP" - end + return if !etag_match && !content_length_match && !file_match + problem "The URL #{url} could use HTTPS rather than HTTP" end def problem(text) -- cgit v1.2.3 From 81a760921320b6508458d6cdbe4c73b3e01b14b3 Mon Sep 17 00:00:00 2001 From: Zhiming Wang Date: Sat, 18 Feb 2017 10:16:59 -0500 Subject: bump-formula-pr: improve duplicate detection Reduce the chance of false flagging by making sure that the existing pr surfaced by GitHub.issues_for_formula actually contains the exact formula name in its title. --- Library/Homebrew/dev-cmd/bump-formula-pr.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index ea2daf1c4..bfe9c7776 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -80,7 +80,8 @@ module Homebrew def fetch_pull_requests(formula) GitHub.issues_for_formula(formula.name, tap: formula.tap).select do |pr| - pr["html_url"].include?("/pull/") + pr["html_url"].include?("/pull/") && + /(^|\s)#{Regexp.quote(formula.name)}(:|\s|$)/i =~ pr["title"] end rescue GitHub::RateLimitExceededError => e opoo e.message -- cgit v1.2.3 From c667a43b9790be9887bf3f175d9e6ab3dad80e1a Mon Sep 17 00:00:00 2001 From: ilovezfs Date: Mon, 20 Feb 2017 07:51:04 -0800 Subject: audit: fix insecure mirror check when stdout is empty --- Library/Homebrew/dev-cmd/audit.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 5ed363f7c..9ffef0f99 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -1499,7 +1499,7 @@ class ResourceAuditor secure_url = url.sub "http", "https" secure_details = get_content_details(secure_url) - return if !details[:status].start_with?("2") || !secure_details[:status].start_with?("2") + return if details[:status].nil? || secure_details[:status].nil? || !details[:status].start_with?("2") || !secure_details[:status].start_with?("2") etag_match = details[:etag] && details[:etag] == secure_details[:etag] content_length_match = details[:content_length] && details[:content_length] == secure_details[:content_length] -- cgit v1.2.3 From 7eec6a3a255d7d7ca0c29814345ee9358f6fd300 Mon Sep 17 00:00:00 2001 From: David Broder-Rodgers Date: Thu, 8 Dec 2016 21:41:24 +0000 Subject: Updated resource auditing to detect invalid mirrors when using --online --- Library/Homebrew/dev-cmd/audit.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 5ed363f7c..3a4429c86 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -1490,6 +1490,11 @@ class ResourceAuditor return unless @online urls.each do |url| + begin + nostdout { curl "--connect-timeout", "15", "-o", "/dev/null", "-r", "0-0", url } + rescue ErrorDuringExecution + problem "The mirror #{u} is not reachable (curl exit code #{$?.exitstatus})" + end check_insecure_mirror(url) if url.start_with? "http:" end end -- cgit v1.2.3 From ea440ca3284138ebe3be26d5763f8c6af93749b1 Mon Sep 17 00:00:00 2001 From: David Broder-Rodgers Date: Sat, 10 Dec 2016 11:10:29 +0000 Subject: Markups to online mirror auditing --- Library/Homebrew/dev-cmd/audit.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 3a4429c86..db7973eb3 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -1491,9 +1491,9 @@ class ResourceAuditor return unless @online urls.each do |url| begin - nostdout { curl "--connect-timeout", "15", "-o", "/dev/null", "-r", "0-0", url } + nostdout { curl "--connect-timeout", "15", "--output", "/dev/null", "--range", "0-0", url } rescue ErrorDuringExecution - problem "The mirror #{u} is not reachable (curl exit code #{$?.exitstatus})" + problem "The mirror #{url} is not reachable (curl exit code #{$?.exitstatus})" end check_insecure_mirror(url) if url.start_with? "http:" end -- cgit v1.2.3 From ed9f775b778bad961a9e2fb178fce3a7af201e75 Mon Sep 17 00:00:00 2001 From: David Broder-Rodgers Date: Sat, 10 Dec 2016 14:20:47 +0000 Subject: Added support for returning HTTP status codes and for git and svn URLs --- Library/Homebrew/dev-cmd/audit.rb | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index db7973eb3..839d1c429 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -1490,10 +1490,20 @@ class ResourceAuditor return unless @online urls.each do |url| - begin - nostdout { curl "--connect-timeout", "15", "--output", "/dev/null", "--range", "0-0", url } - rescue ErrorDuringExecution - problem "The mirror #{url} is not reachable (curl exit code #{$?.exitstatus})" + if url.start_with? "http", "ftp" + status_code, _, _ = curl_output "--connect-timeout", "15", "--output", "/dev/null", "--range", "0-0", \ + "--write-out", "%{http_code}", url + unless status_code.start_with? "20" + problem "The mirror #{url} is not reachable (HTTP status code #{status_code})" + end + elsif url.start_with? "git" + unless Utils.git_remote_exists url + problem "The mirror #{url} is not a valid git URL" + end + elsif url.start_with? "svn" + unless Utils.svn_remote_exists url + problem "The mirror #{url} is not a valid svn URL" + end end check_insecure_mirror(url) if url.start_with? "http:" end -- cgit v1.2.3 From 3e7dfe4aaba2aa41d01f6fd06a9dd40298d118d3 Mon Sep 17 00:00:00 2001 From: David Broder-Rodgers Date: Sun, 11 Dec 2016 21:36:58 +0000 Subject: Updated mirror audit problem message --- Library/Homebrew/dev-cmd/audit.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 839d1c429..460302fb7 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -1494,15 +1494,15 @@ class ResourceAuditor status_code, _, _ = curl_output "--connect-timeout", "15", "--output", "/dev/null", "--range", "0-0", \ "--write-out", "%{http_code}", url unless status_code.start_with? "20" - problem "The mirror #{url} is not reachable (HTTP status code #{status_code})" + problem "The URL #{url} is not reachable (HTTP status code #{status_code})" end elsif url.start_with? "git" unless Utils.git_remote_exists url - problem "The mirror #{url} is not a valid git URL" + problem "The URL #{url} is not a valid git URL" end elsif url.start_with? "svn" unless Utils.svn_remote_exists url - problem "The mirror #{url} is not a valid svn URL" + problem "The URL #{url} is not a valid svn URL" end end check_insecure_mirror(url) if url.start_with? "http:" -- cgit v1.2.3 From d3ac333197de4d2fcb560bf95e5cd4df81871bbd Mon Sep 17 00:00:00 2001 From: David Broder-Rodgers Date: Mon, 12 Dec 2016 21:18:22 +0000 Subject: Rubocop styling fixes --- Library/Homebrew/dev-cmd/audit.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 460302fb7..b323297e4 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -1491,8 +1491,8 @@ class ResourceAuditor return unless @online urls.each do |url| if url.start_with? "http", "ftp" - status_code, _, _ = curl_output "--connect-timeout", "15", "--output", "/dev/null", "--range", "0-0", \ - "--write-out", "%{http_code}", url + status_code, = curl_output "--connect-timeout", "15", "--output", "/dev/null", "--range", "0-0", \ + "--write-out", "%{http_code}", url unless status_code.start_with? "20" problem "The URL #{url} is not reachable (HTTP status code #{status_code})" end -- cgit v1.2.3 From a731f4e17cc45bed5ed0f1121326551c558ce583 Mon Sep 17 00:00:00 2001 From: David Broder-Rodgers Date: Tue, 10 Jan 2017 20:13:14 +0000 Subject: Updated HTTP mirror check to use new url_status_code method --- Library/Homebrew/dev-cmd/audit.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index b323297e4..f187f17f5 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -174,7 +174,7 @@ class FormulaAuditor @specs = %w[stable devel head].map { |s| formula.send(s) }.compact end - def url_status_code(url, range: false) + def self.url_status_code(url, range: false) # The system Curl is too old and unreliable with HTTPS homepages on # Yosemite and below. return "200" unless DevelopmentTools.curl_handles_most_https_homepages? @@ -195,7 +195,7 @@ class FormulaAuditor user_agent: user_agent, ) status_code = Open3.popen3(*args) { |_, stdout, _, _| stdout.read } - break if status_code.start_with? "20" + break if status_code.start_with? "2" end status_code end @@ -619,7 +619,7 @@ class FormulaAuditor return unless @online - status_code = url_status_code(homepage) + status_code = FormulaAuditor.url_status_code(homepage, user_agent: :browser) return if status_code.start_with? "20" problem "The homepage #{homepage} is not reachable (HTTP status code #{status_code})" end @@ -1491,9 +1491,8 @@ class ResourceAuditor return unless @online urls.each do |url| if url.start_with? "http", "ftp" - status_code, = curl_output "--connect-timeout", "15", "--output", "/dev/null", "--range", "0-0", \ - "--write-out", "%{http_code}", url - unless status_code.start_with? "20" + status_code = FormulaAuditor.url_status_code url + unless status_code.start_with? "2" problem "The URL #{url} is not reachable (HTTP status code #{status_code})" end elsif url.start_with? "git" -- cgit v1.2.3 From 81b3368c9cba0f9db93af5732d8f10e75d00cdf9 Mon Sep 17 00:00:00 2001 From: David Broder-Rodgers Date: Tue, 24 Jan 2017 20:35:07 +0000 Subject: Added better check for HTTP git URLs --- Library/Homebrew/dev-cmd/audit.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index f187f17f5..c685dacae 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -1490,15 +1490,15 @@ class ResourceAuditor return unless @online urls.each do |url| - if url.start_with? "http", "ftp" + if url.start_with?("git") || url.end_with?(".git") + unless Utils.git_remote_exists url + problem "The URL #{url} is not a valid git URL" + end + elsif url.start_with? "http", "ftp" status_code = FormulaAuditor.url_status_code url unless status_code.start_with? "2" problem "The URL #{url} is not reachable (HTTP status code #{status_code})" end - elsif url.start_with? "git" - unless Utils.git_remote_exists url - problem "The URL #{url} is not a valid git URL" - end elsif url.start_with? "svn" unless Utils.svn_remote_exists url problem "The URL #{url} is not a valid svn URL" -- cgit v1.2.3 From a699d284d038907f884bb48f928f2e75ebadfc11 Mon Sep 17 00:00:00 2001 From: David Broder-Rodgers Date: Tue, 24 Jan 2017 23:11:50 +0000 Subject: Use DownloadStrategyDetector to classify mirror URLs --- Library/Homebrew/dev-cmd/audit.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index c685dacae..a7c9de576 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -1490,16 +1490,18 @@ class ResourceAuditor return unless @online urls.each do |url| - if url.start_with?("git") || url.end_with?(".git") - unless Utils.git_remote_exists url - problem "The URL #{url} is not a valid git URL" - end - elsif url.start_with? "http", "ftp" + strategy = DownloadStrategyDetector.detect(url) + if strategy <= CurlDownloadStrategy + problem url status_code = FormulaAuditor.url_status_code url unless status_code.start_with? "2" problem "The URL #{url} is not reachable (HTTP status code #{status_code})" end - elsif url.start_with? "svn" + elsif strategy <= GitDownloadStrategy + unless Utils.git_remote_exists url + problem "The URL #{url} is not a valid git URL" + end + elsif strategy <= SubversionDownloadStrategy unless Utils.svn_remote_exists url problem "The URL #{url} is not a valid svn URL" end -- cgit v1.2.3 From 12501b4046339b6becd42e37730873babeaa9dc2 Mon Sep 17 00:00:00 2001 From: David Broder-Rodgers Date: Mon, 30 Jan 2017 18:30:57 +0000 Subject: Prevent mirror curl for file:/// URL --- Library/Homebrew/dev-cmd/audit.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index a7c9de576..180783f79 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -1491,7 +1491,7 @@ class ResourceAuditor return unless @online urls.each do |url| strategy = DownloadStrategyDetector.detect(url) - if strategy <= CurlDownloadStrategy + if strategy <= CurlDownloadStrategy && !url.start_with?("file") problem url status_code = FormulaAuditor.url_status_code url unless status_code.start_with? "2" -- cgit v1.2.3 From 55bc2a30195db915a60c862bf1c3d4ba6cd3cd4a Mon Sep 17 00:00:00 2001 From: David Broder-Rodgers Date: Mon, 20 Feb 2017 19:00:27 +0000 Subject: Merged 404 and security mirror auditing logic --- Library/Homebrew/dev-cmd/audit.rb | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 180783f79..6e454f4d2 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -174,7 +174,7 @@ class FormulaAuditor @specs = %w[stable devel head].map { |s| formula.send(s) }.compact end - def self.url_status_code(url, range: false) + def url_status_code(url, range: false) # The system Curl is too old and unreliable with HTTPS homepages on # Yosemite and below. return "200" unless DevelopmentTools.curl_handles_most_https_homepages? @@ -619,8 +619,8 @@ class FormulaAuditor return unless @online - status_code = FormulaAuditor.url_status_code(homepage, user_agent: :browser) - return if status_code.start_with? "20" + status_code = url_status_code(homepage) + return if status_code.start_with? "2" problem "The homepage #{homepage} is not reachable (HTTP status code #{status_code})" end @@ -1492,11 +1492,7 @@ class ResourceAuditor urls.each do |url| strategy = DownloadStrategyDetector.detect(url) if strategy <= CurlDownloadStrategy && !url.start_with?("file") - problem url - status_code = FormulaAuditor.url_status_code url - unless status_code.start_with? "2" - problem "The URL #{url} is not reachable (HTTP status code #{status_code})" - end + check_http_mirror url elsif strategy <= GitDownloadStrategy unless Utils.git_remote_exists url problem "The URL #{url} is not a valid git URL" @@ -1506,12 +1502,20 @@ class ResourceAuditor problem "The URL #{url} is not a valid svn URL" end end - check_insecure_mirror(url) if url.start_with? "http:" end end - def check_insecure_mirror(url) + def check_http_mirror(url) details = get_content_details(url) + + if details[:status].nil? + problem "The URL #{url} is not reachable" + elsif !details[:status].start_with? "2" + problem "The URL #{url} is not reachable (HTTP status code #{details[:status]})" + end + + return unless url.start_with? "http:" + secure_url = url.sub "http", "https" secure_details = get_content_details(secure_url) -- cgit v1.2.3 From 125a6eee2165039d3b7329543d2e33e321c267d2 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 20 Feb 2017 22:48:03 +0000 Subject: audit: fix `brew style`. --- Library/Homebrew/dev-cmd/audit.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 6e454f4d2..b63d39905 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -1506,7 +1506,7 @@ class ResourceAuditor end def check_http_mirror(url) - details = get_content_details(url) + details = get_content_details(url) if details[:status].nil? problem "The URL #{url} is not reachable" -- cgit v1.2.3 From 606790d06284df4765128117269c06a4df7e197c Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 31 Jan 2017 11:42:13 +0000 Subject: audit: check for version aliases. Current version aliases should be provided for versioned formulae so people can `brew install foo@1.2` to provide pin-like behaviour. --- Library/Homebrew/dev-cmd/audit.rb | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 9ffef0f99..9da5d28b4 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -295,6 +295,27 @@ class FormulaAuditor problem "File should end with a newline" unless text.trailing_newline? + versioned_formulae = Dir[formula.path.to_s.gsub(/\.rb$/, "@*.rb")] + needs_versioned_alias = !versioned_formulae.empty? && + formula.tap && + formula.aliases.grep(/.@\d/).empty? + if needs_versioned_alias + _, last_alias_version = File.basename(versioned_formulae.sort.reverse.first) + .gsub(/\.rb$/, "") + .split("@") + major, minor, = formula.version.to_s.split(".") + alias_name = if last_alias_version.split(".").length == 1 + "#{formula.name}@#{major}" + else + "#{formula.name}@#{major}.#{minor}" + end + problem <<-EOS.undent + Formula has other versions so create an alias: + cd #{formula.tap.alias_dir} + ln -s #{formula.path.to_s.gsub(formula.tap.path, "..")} #{alias_name} + EOS + end + return unless @strict present = audit_components @@ -410,7 +431,8 @@ class FormulaAuditor problem "Dependency '#{dep.name}' was renamed; use new name '#{dep_f.name}'." end - if @@aliases.include?(dep.name) + if @@aliases.include?(dep.name) && + (core_formula? || !dep_f.versioned_formula?) problem "Dependency '#{dep.name}' is an alias; use the canonical name '#{dep.to_formula.full_name}'." end -- cgit v1.2.3 From 2f42dfc68a7c3cfdb2d364fc98dff67fea89e78e Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 21 Feb 2017 18:50:07 +0000 Subject: audit: fix revision should be removed. Regression introduced in #1754 which meant that (due to storing the current formula revision in `attributes_map`) `stable_revisions.empty?` would never be `true`. --- Library/Homebrew/dev-cmd/audit.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 9da5d28b4..d9c4bcddb 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -816,10 +816,12 @@ class FormulaAuditor return if formula.revision.zero? if formula.stable - revision_map = attributes_map[:revision][:stable] - stable_revisions = revision_map[formula.stable.version] if revision_map - if !stable_revisions || stable_revisions.empty? - problem "'revision #{formula.revision}' should be removed" + if revision_map = attributes_map[:revision][:stable] + stable_revisions = revision_map[formula.stable.version] + stable_revisions -= [formula.revision] + if stable_revisions.empty? + problem "'revision #{formula.revision}' should be removed" + end end else # head/devel-only formula problem "'revision #{formula.revision}' should be removed" -- cgit v1.2.3 From b59bf2ff6410dc3e226f0c6c42a37f16a86b472b Mon Sep 17 00:00:00 2001 From: ilovezfs Date: Tue, 21 Feb 2017 11:31:18 -0800 Subject: Revert "audit: check for version aliases." --- Library/Homebrew/dev-cmd/audit.rb | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 9da5d28b4..9ffef0f99 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -295,27 +295,6 @@ class FormulaAuditor problem "File should end with a newline" unless text.trailing_newline? - versioned_formulae = Dir[formula.path.to_s.gsub(/\.rb$/, "@*.rb")] - needs_versioned_alias = !versioned_formulae.empty? && - formula.tap && - formula.aliases.grep(/.@\d/).empty? - if needs_versioned_alias - _, last_alias_version = File.basename(versioned_formulae.sort.reverse.first) - .gsub(/\.rb$/, "") - .split("@") - major, minor, = formula.version.to_s.split(".") - alias_name = if last_alias_version.split(".").length == 1 - "#{formula.name}@#{major}" - else - "#{formula.name}@#{major}.#{minor}" - end - problem <<-EOS.undent - Formula has other versions so create an alias: - cd #{formula.tap.alias_dir} - ln -s #{formula.path.to_s.gsub(formula.tap.path, "..")} #{alias_name} - EOS - end - return unless @strict present = audit_components @@ -431,8 +410,7 @@ class FormulaAuditor problem "Dependency '#{dep.name}' was renamed; use new name '#{dep_f.name}'." end - if @@aliases.include?(dep.name) && - (core_formula? || !dep_f.versioned_formula?) + if @@aliases.include?(dep.name) problem "Dependency '#{dep.name}' is an alias; use the canonical name '#{dep.to_formula.full_name}'." end -- cgit v1.2.3 From 168a96d91912c9adc19d8729d0cb6ac54aef7590 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Tue, 21 Feb 2017 21:55:11 +0100 Subject: Exclude specs with `:needs_macos` tag when not on macOS. --- Library/Homebrew/dev-cmd/tests.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index 244fbe027..246b5fa46 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -84,6 +84,8 @@ module Homebrew "--format", "ParallelTests::RSpec::RuntimeLogger", "--out", "tmp/parallel_runtime_rspec.log" ] + spec_args << "--tag" << "~needs_macos" unless OS.mac? + run_tests "parallel_rspec", spec_files, spec_args if (fs_leak_log = HOMEBREW_LIBRARY_PATH/"tmp/fs_leak.log").file? -- cgit v1.2.3 From ac5b6b6eeaec7b6ee2fb79a28d69c6036ee49299 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 22 Feb 2017 08:49:24 +0000 Subject: Revert "audit: fix revision should be removed." --- Library/Homebrew/dev-cmd/audit.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index d4d6a6d72..9ffef0f99 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -794,12 +794,10 @@ class FormulaAuditor return if formula.revision.zero? if formula.stable - if revision_map = attributes_map[:revision][:stable] - stable_revisions = revision_map[formula.stable.version] - stable_revisions -= [formula.revision] - if stable_revisions.empty? - problem "'revision #{formula.revision}' should be removed" - end + revision_map = attributes_map[:revision][:stable] + stable_revisions = revision_map[formula.stable.version] if revision_map + if !stable_revisions || stable_revisions.empty? + problem "'revision #{formula.revision}' should be removed" end else # head/devel-only formula problem "'revision #{formula.revision}' should be removed" -- cgit v1.2.3 From 48a211fc90d3b53db3fb2f76d454ee64cab0cdf7 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Tue, 21 Feb 2017 06:17:06 +0100 Subject: Convert `os/mac/language` test to spec. --- Library/Homebrew/dev-cmd/tests.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index 244fbe027..9cabb3d61 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -57,9 +57,7 @@ module Homebrew ENV["SEED"] = ARGV.next if ARGV.include? "--seed" files = Dir.glob("test/**/*_{spec,test}.rb") - .reject { |p| !OS.mac? && p.start_with?("test/os/mac/") } - .reject { |p| !OS.mac? && p.start_with?("test/cask/") } - .reject { |p| p.start_with?("test/vendor/bundle/") } + .reject { |p| !OS.mac? && p =~ %r{^test/(os/mac|cask)(/.*|_(test|spec)\.rb)$} } test_args = [] test_args << "--trace" if ARGV.include? "--trace" -- cgit v1.2.3 From 5390897883f11fe2257e57bd5547cb1bbb144fb0 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 23 Feb 2017 09:09:33 +0000 Subject: audit: refactor http content checks. --- Library/Homebrew/dev-cmd/audit.rb | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index b63d39905..aa9dd775a 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -1492,7 +1492,7 @@ class ResourceAuditor urls.each do |url| strategy = DownloadStrategyDetector.detect(url) if strategy <= CurlDownloadStrategy && !url.start_with?("file") - check_http_mirror url + check_http_content url elsif strategy <= GitDownloadStrategy unless Utils.git_remote_exists url problem "The URL #{url} is not a valid git URL" @@ -1505,7 +1505,7 @@ class ResourceAuditor end end - def check_http_mirror(url) + def check_http_content(url) details = get_content_details(url) if details[:status].nil? @@ -1519,10 +1519,16 @@ class ResourceAuditor secure_url = url.sub "http", "https" secure_details = get_content_details(secure_url) - return if !details[:status].start_with?("2") || !secure_details[:status].start_with?("2") + if !details[:status].to_s.start_with?("2") || + !secure_details[:status].to_s.start_with?("2") + return + end - etag_match = details[:etag] && details[:etag] == secure_details[:etag] - content_length_match = details[:content_length] && details[:content_length] == secure_details[:content_length] + etag_match = details[:etag] && + details[:etag] == secure_details[:etag] + content_length_match = + details[:content_length] && + details[:content_length] == secure_details[:content_length] file_match = details[:file_hash] == secure_details[:file_hash] return if !etag_match && !content_length_match && !file_match -- cgit v1.2.3 From 5e9057500419d1a2b41efe784e9f12ae232e7f6e Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 23 Feb 2017 09:09:58 +0000 Subject: audit: handle redirects in get_content_details. --- Library/Homebrew/dev-cmd/audit.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index aa9dd775a..493f1eb09 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -1542,12 +1542,16 @@ class ResourceAuditor def get_content_details(url) out = {} output, = curl_output "--connect-timeout", "15", "--include", url - split = output.partition("\r\n\r\n") - headers = split.first - out[:status] = headers[%r{HTTP\/.* (\d+)}, 1] + status_code = :unknown + while status_code == :unknown || status_code.to_s.start_with?("3") + headers, _, output = output.partition("\r\n\r\n") + status_code = headers[%r{HTTP\/.* (\d+)}, 1] + end + + out[:status] = status_code out[:etag] = headers[%r{ETag: ([wW]\/)?"(([^"]|\\")*)"}, 2] out[:content_length] = headers[/Content-Length: (\d+)/, 1] - out[:file_hash] = Digest::SHA256.digest split.last + out[:file_hash] = Digest::SHA256.digest output out end end -- cgit v1.2.3 From 96a8f8f1727e3d6445d42570d287f4f7013d5ea1 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 23 Feb 2017 09:14:54 +0000 Subject: audit: check for version aliases. Current version aliases should be provided for versioned formulae so people can `brew install foo@1.2` to provide pin-like behaviour. --- Library/Homebrew/dev-cmd/audit.rb | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 9ffef0f99..9da5d28b4 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -295,6 +295,27 @@ class FormulaAuditor problem "File should end with a newline" unless text.trailing_newline? + versioned_formulae = Dir[formula.path.to_s.gsub(/\.rb$/, "@*.rb")] + needs_versioned_alias = !versioned_formulae.empty? && + formula.tap && + formula.aliases.grep(/.@\d/).empty? + if needs_versioned_alias + _, last_alias_version = File.basename(versioned_formulae.sort.reverse.first) + .gsub(/\.rb$/, "") + .split("@") + major, minor, = formula.version.to_s.split(".") + alias_name = if last_alias_version.split(".").length == 1 + "#{formula.name}@#{major}" + else + "#{formula.name}@#{major}.#{minor}" + end + problem <<-EOS.undent + Formula has other versions so create an alias: + cd #{formula.tap.alias_dir} + ln -s #{formula.path.to_s.gsub(formula.tap.path, "..")} #{alias_name} + EOS + end + return unless @strict present = audit_components @@ -410,7 +431,8 @@ class FormulaAuditor problem "Dependency '#{dep.name}' was renamed; use new name '#{dep_f.name}'." end - if @@aliases.include?(dep.name) + if @@aliases.include?(dep.name) && + (core_formula? || !dep_f.versioned_formula?) problem "Dependency '#{dep.name}' is an alias; use the canonical name '#{dep.to_formula.full_name}'." end -- cgit v1.2.3 From 9fa014710d22e30c0be05bddc78e073373def5bd Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 23 Feb 2017 10:15:06 +0000 Subject: audit: further refactor http content checks. Check homepages and don’t check mirrors unless `—strict`. --- Library/Homebrew/dev-cmd/audit.rb | 144 ++++++++++++++++++-------------------- 1 file changed, 69 insertions(+), 75 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 493f1eb09..65b109f3b 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -174,30 +174,62 @@ class FormulaAuditor @specs = %w[stable devel head].map { |s| formula.send(s) }.compact end - def url_status_code(url, range: false) - # The system Curl is too old and unreliable with HTTPS homepages on - # Yosemite and below. - return "200" unless DevelopmentTools.curl_handles_most_https_homepages? + def self.check_http_content(url, user_agents: [:default]) + details = nil + user_agent = nil + user_agents.each do |ua| + details = http_content_headers_and_checksum(url, user_agent: ua) + user_agent = ua + break if details[:status].to_s.start_with?("2") + end - extra_args = [ - "--connect-timeout", "15", - "--output", "/dev/null", - "--write-out", "%{http_code}" - ] - extra_args << "--range" << "0-0" if range - extra_args << url - - status_code = nil - [:browser, :default].each do |user_agent| - args = curl_args( - extra_args: extra_args, - show_output: true, - user_agent: user_agent, - ) - status_code = Open3.popen3(*args) { |_, stdout, _, _| stdout.read } - break if status_code.start_with? "2" - end - status_code + return "The URL #{url} is not reachable" unless details[:status] + unless details[:status].start_with? "2" + return "The URL #{url} is not reachable (HTTP status code #{details[:status]})" + end + + return unless url.start_with? "http:" + + secure_url = url.sub "http", "https" + secure_details = + http_content_headers_and_checksum(secure_url, user_agent: user_agent) + + if !details[:status].to_s.start_with?("2") || + !secure_details[:status].to_s.start_with?("2") + return + end + + etag_match = details[:etag] && + details[:etag] == secure_details[:etag] + content_length_match = + details[:content_length] && + details[:content_length] == secure_details[:content_length] + file_match = details[:file_hash] == secure_details[:file_hash] + + return if !etag_match && !content_length_match && !file_match + "The URL #{url} could use HTTPS rather than HTTP" + end + + def self.http_content_headers_and_checksum(url, user_agent: :default) + args = curl_args( + extra_args: ["--connect-timeout", "15", "--include", url], + show_output: true, + user_agent: user_agent, + ) + output = Open3.popen3(*args) { |_, stdout, _, _| stdout.read } + + status_code = :unknown + while status_code == :unknown || status_code.to_s.start_with?("3") + headers, _, output = output.partition("\r\n\r\n") + status_code = headers[%r{HTTP\/.* (\d+)}, 1] + end + + { + status: status_code, + etag: headers[%r{ETag: ([wW]\/)?"(([^"]|\\")*)"}, 2], + content_length: headers[/Content-Length: (\d+)/, 1], + file_hash: Digest::SHA256.digest(output), + } end def audit_style @@ -619,9 +651,13 @@ class FormulaAuditor return unless @online - status_code = url_status_code(homepage) - return if status_code.start_with? "2" - problem "The homepage #{homepage} is not reachable (HTTP status code #{status_code})" + # The system Curl is too old and unreliable with HTTPS homepages on + # Yosemite and below. + return unless DevelopmentTools.curl_handles_most_https_homepages? + if http_content_problem = FormulaAuditor.check_http_content(homepage, + user_agents: [:browser, :default]) + problem http_content_problem + end end def audit_bottle_spec @@ -671,11 +707,11 @@ class FormulaAuditor %w[Stable Devel HEAD].each do |name| next unless spec = formula.send(name.downcase) - ra = ResourceAuditor.new(spec, online: @online).audit + ra = ResourceAuditor.new(spec, online: @online, strict: @strict).audit problems.concat ra.problems.map { |problem| "#{name}: #{problem}" } spec.resources.each_value do |resource| - ra = ResourceAuditor.new(resource, online: @online).audit + ra = ResourceAuditor.new(resource, online: @online, strict: @strict).audit problems.concat ra.problems.map { |problem| "#{name} resource #{resource.name.inspect}: #{problem}" } @@ -1231,6 +1267,7 @@ class ResourceAuditor @using = resource.using @specs = resource.specs @online = options[:online] + @strict = options[:strict] @problems = [] end @@ -1492,7 +1529,10 @@ class ResourceAuditor urls.each do |url| strategy = DownloadStrategyDetector.detect(url) if strategy <= CurlDownloadStrategy && !url.start_with?("file") - check_http_content url + next if !@strict && mirrors.include?(url) + if http_content_problem = FormulaAuditor.check_http_content(url) + problem http_content_problem + end elsif strategy <= GitDownloadStrategy unless Utils.git_remote_exists url problem "The URL #{url} is not a valid git URL" @@ -1505,53 +1545,7 @@ class ResourceAuditor end end - def check_http_content(url) - details = get_content_details(url) - - if details[:status].nil? - problem "The URL #{url} is not reachable" - elsif !details[:status].start_with? "2" - problem "The URL #{url} is not reachable (HTTP status code #{details[:status]})" - end - - return unless url.start_with? "http:" - - secure_url = url.sub "http", "https" - secure_details = get_content_details(secure_url) - - if !details[:status].to_s.start_with?("2") || - !secure_details[:status].to_s.start_with?("2") - return - end - - etag_match = details[:etag] && - details[:etag] == secure_details[:etag] - content_length_match = - details[:content_length] && - details[:content_length] == secure_details[:content_length] - file_match = details[:file_hash] == secure_details[:file_hash] - - return if !etag_match && !content_length_match && !file_match - problem "The URL #{url} could use HTTPS rather than HTTP" - end - def problem(text) @problems << text end - - def get_content_details(url) - out = {} - output, = curl_output "--connect-timeout", "15", "--include", url - status_code = :unknown - while status_code == :unknown || status_code.to_s.start_with?("3") - headers, _, output = output.partition("\r\n\r\n") - status_code = headers[%r{HTTP\/.* (\d+)}, 1] - end - - out[:status] = status_code - out[:etag] = headers[%r{ETag: ([wW]\/)?"(([^"]|\\")*)"}, 2] - out[:content_length] = headers[/Content-Length: (\d+)/, 1] - out[:file_hash] = Digest::SHA256.digest output - out - end end -- cgit v1.2.3 From b984be675ddd07ccbf7151355a22096de47c5c50 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 24 Feb 2017 08:45:39 +0000 Subject: audit: use using for HTTPS detection. --- Library/Homebrew/dev-cmd/audit.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 65b109f3b..cf5bdcdc4 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -1527,9 +1527,10 @@ class ResourceAuditor return unless @online urls.each do |url| - strategy = DownloadStrategyDetector.detect(url) + next if !@strict && mirrors.include?(url) + + strategy = DownloadStrategyDetector.detect(url, using) if strategy <= CurlDownloadStrategy && !url.start_with?("file") - next if !@strict && mirrors.include?(url) if http_content_problem = FormulaAuditor.check_http_content(url) problem http_content_problem end -- cgit v1.2.3 From 1284f29561d944e069d201db9043489417b85ff4 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 24 Feb 2017 08:51:15 +0000 Subject: audit: don't try to HTTP check non-HTTP content. --- Library/Homebrew/dev-cmd/audit.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index cf5bdcdc4..e49f65dd2 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -175,6 +175,8 @@ class FormulaAuditor end def self.check_http_content(url, user_agents: [:default]) + return unless url.start_with? "http" + details = nil user_agent = nil user_agents.each do |ua| -- cgit v1.2.3 From 75724c5b5da769faa682803a55b29e2de9bad741 Mon Sep 17 00:00:00 2001 From: ilovezfs Date: Sat, 25 Feb 2017 03:03:37 -0800 Subject: audit: whitelist more unstable versions already in core These were imported from homebrew/games. --- Library/Homebrew/dev-cmd/audit.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index e49f65dd2..ab7abf1e6 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -740,6 +740,7 @@ class FormulaAuditor unstable_whitelist = %w[ aalib 1.4rc5 + angolmois 2.0.0alpha2 automysqlbackup 3.0-rc6 aview 1.3.0rc1 distcc 3.2rc1 @@ -747,6 +748,8 @@ class FormulaAuditor ftgl 2.1.3-rc5 hidapi 0.8.0-rc1 libcaca 0.99b19 + nethack4 4.3.0-beta2 + opensyobon 1.0rc2 premake 4.4-beta5 pwnat 0.3-beta pxz 4.999.9 -- cgit v1.2.3 From 6cb56297378cb57ade790c392dacf4a3bf02f7da Mon Sep 17 00:00:00 2001 From: EricFromCanada Date: Sat, 25 Feb 2017 17:27:08 -0500 Subject: Work around man page generator bug for pull.rb To work around ronn's [issue with nested lists](https://github.com/rtomayko/ronn/issues/35), treat each item as a separate paragraph with alternate list markers. --- Library/Homebrew/dev-cmd/pull.rb | 53 +++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 22 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb index c2342d39c..98a62e578 100644 --- a/Library/Homebrew/dev-cmd/pull.rb +++ b/Library/Homebrew/dev-cmd/pull.rb @@ -1,33 +1,42 @@ -#: `pull` [`--bottle`] [`--bump`] [`--clean`] [`--ignore-whitespace`] [`--resolve`] [`--branch-okay`] [`--no-pbcopy`] [`--no-publish`] [] -#: +#: * `pull` [`--bottle`] [`--bump`] [`--clean`] [`--ignore-whitespace`] [`--resolve`] [`--branch-okay`] [`--no-pbcopy`] [`--no-publish`] []: #: Gets a patch from a GitHub commit or pull request and applies it to Homebrew. #: Optionally, installs the formulae changed by the patch. #: #: Each may be one of: -#: * The ID number of a PR (Pull Request) in the homebrew/core GitHub +#: +#: ~ The ID number of a PR (pull request) in the homebrew/core GitHub #: repository -#: * The URL of a PR on GitHub, using either the web page or API URL +#: +#: ~ The URL of a PR on GitHub, using either the web page or API URL #: formats. In this form, the PR may be on Homebrew/brew, #: Homebrew/homebrew-core or any tap. -#: * The URL of a commit on GitHub -#: * A "http://bot.brew.sh/job/..." string specifying a testing job ID #: -#: If `--bottle` was passed, handle bottles, pulling the bottle-update -#: commit and publishing files on Bintray. -#: If `--bump` was passed, for one-formula PRs, automatically reword -#: commit message to our preferred format. -#: If `--clean` was passed, do not rewrite or otherwise modify the -#: commits found in the pulled PR. -#: If `--ignore-whitespace` was passed, silently ignore whitespace -#: discrepancies when applying diffs. -#: If `--resolve` was passed, when a patch fails to apply, leave in -#: progress and allow user to -#: resolve, instead of aborting. -#: If `--branch-okay` was passed, do not warn if pulling to a branch -#: besides master (useful for testing). -#: If `--no-pbcopy` was passed, do not copy anything to the system -# clipboard. -#: If `--no-publish` was passed, do not publish bottles to Bintray. +#: ~ The URL of a commit on GitHub +#: +#: ~ A "http://bot.brew.sh/job/..." string specifying a testing job ID +#: +#: If `--bottle` is passed, handle bottles, pulling the bottle-update +#: commit and publishing files on Bintray. +#: +#: If `--bump` is passed, for one-formula PRs, automatically reword +#: commit message to our preferred format. +#: +#: If `--clean` is passed, do not rewrite or otherwise modify the +#: commits found in the pulled PR. +#: +#: If `--ignore-whitespace` is passed, silently ignore whitespace +#: discrepancies when applying diffs. +#: +#: If `--resolve` is passed, when a patch fails to apply, leave in +#: progress and allow user to resolve, instead of aborting. +#: +#: If `--branch-okay` is passed, do not warn if pulling to a branch +#: besides master (useful for testing). +#: +#: If `--no-pbcopy` is passed, do not copy anything to the system +#: clipboard. +#: +#: If `--no-publish` is passed, do not publish bottles to Bintray. require "net/http" require "net/https" -- cgit v1.2.3 From afc539f86e2be27744838d0db6f85bcfe20fa857 Mon Sep 17 00:00:00 2001 From: EricFromCanada Date: Sat, 25 Feb 2017 17:37:57 -0500 Subject: Update brew's man page formatting and grammar Also update command specifications to match descriptions. --- Library/Homebrew/dev-cmd/boneyard-formula-pr.rb | 2 +- Library/Homebrew/dev-cmd/bottle.rb | 3 +-- Library/Homebrew/dev-cmd/bump-formula-pr.rb | 13 ++++++------- Library/Homebrew/dev-cmd/create.rb | 3 +-- Library/Homebrew/dev-cmd/formula.rb | 2 +- Library/Homebrew/dev-cmd/linkage.rb | 2 +- Library/Homebrew/dev-cmd/mirror.rb | 2 +- Library/Homebrew/dev-cmd/release-notes.rb | 6 +++--- Library/Homebrew/dev-cmd/tests.rb | 2 +- Library/Homebrew/dev-cmd/update-test.rb | 8 ++++---- 10 files changed, 20 insertions(+), 23 deletions(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/boneyard-formula-pr.rb b/Library/Homebrew/dev-cmd/boneyard-formula-pr.rb index 3066d2ee6..7531ef9cf 100644 --- a/Library/Homebrew/dev-cmd/boneyard-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/boneyard-formula-pr.rb @@ -1,5 +1,5 @@ #: @hide_from_man_page -#: * `boneyard-formula-pr` [`--dry-run`] [`--local`] [`--reason=`] : +#: * `boneyard-formula-pr` [`--dry-run`] [`--local`] [`--reason=`] : #: Creates a pull request to boneyard a formula. #: #: If `--dry-run` is passed, print what would be done rather than doing it. diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index 7367e5c37..91bdcba93 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -1,6 +1,5 @@ -#: * `bottle` [`--verbose`] [`--no-rebuild`] [`--keep-old`] [`--skip-relocation`] [`--root-url=`] [`--force-core-tap`]: +#: * `bottle` [`--verbose`] [`--no-rebuild`] [`--keep-old`] [`--skip-relocation`] [`--root-url=`] [`--force-core-tap`]: #: * `bottle` `--merge` [`--no-commit`] [`--keep-old`] [`--write`]: -#: #: Generate a bottle (binary package) from a formula installed with #: `--build-bottle`. diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index bfe9c7776..6c7b7d5b5 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -1,8 +1,7 @@ -#: * `bump-formula-pr` [`--devel`] [`--dry-run`] [`--audit`|`--strict`] [`--message=`] `--url=` `--sha256=` : -#: * `bump-formula-pr` [`--devel`] [`--dry-run`] [`--audit`|`--strict`] [`--message=`] `--tag=` `--revision=` : -#: Creates a pull request to update the formula with a new url or a new tag. +#: * `bump-formula-pr` [`--devel`] [`--dry-run` [`--write`]] [`--audit`|`--strict`] [`--mirror=`] [`--version=`] [`--message=`] (`--url=` `--sha256=`|`--tag=` `--revision=`) : +#: Creates a pull request to update the formula with a new URL or a new tag. #: -#: If a is specified, the checksum of the new download must +#: If a is specified, the checksum of the new download must #: also be specified. A best effort to determine the and #: name will be made if either or both values are not supplied by the user. #: @@ -21,17 +20,17 @@ #: #: If `--strict` is passed, run `brew audit --strict` before opening the PR. #: -#: If `--mirror=` is passed, use the value as a mirror url. +#: If `--mirror=` is passed, use the value as a mirror URL. #: #: If `--version=` is passed, use the value to override the value -#: parsed from the url or tag. Note that `--version=0` can be used to delete +#: parsed from the URL or tag. Note that `--version=0` can be used to delete #: an existing `version` override from a formula if it has become redundant. #: #: If `--message=` is passed, append to the default PR #: message. #: #: Note that this command cannot be used to transition a formula from a -#: url-and-sha256 style specification into a tag-and-revision style +#: URL-and-sha256 style specification into a tag-and-revision style #: specification, nor vice versa. It must use whichever style specification #: the preexisting formula already uses. diff --git a/Library/Homebrew/dev-cmd/create.rb b/Library/Homebrew/dev-cmd/create.rb index b4cda0fad..9c58dc71a 100644 --- a/Library/Homebrew/dev-cmd/create.rb +++ b/Library/Homebrew/dev-cmd/create.rb @@ -3,8 +3,7 @@ #: Homebrew will attempt to automatically derive the formula name #: and version, but if it fails, you'll have to make your own template. The `wget` #: formula serves as a simple example. For the complete API have a look at -#: -#: +#: . #: #: If `--autotools` is passed, create a basic template for an Autotools-style build. #: If `--cmake` is passed, create a basic template for a CMake-style build. diff --git a/Library/Homebrew/dev-cmd/formula.rb b/Library/Homebrew/dev-cmd/formula.rb index 71687dfa7..67d11edce 100644 --- a/Library/Homebrew/dev-cmd/formula.rb +++ b/Library/Homebrew/dev-cmd/formula.rb @@ -1,5 +1,5 @@ #: * `formula` : -#: Display the path where is +#: Display the path where is located. require "formula" diff --git a/Library/Homebrew/dev-cmd/linkage.rb b/Library/Homebrew/dev-cmd/linkage.rb index 44e0f224e..e4da827f2 100644 --- a/Library/Homebrew/dev-cmd/linkage.rb +++ b/Library/Homebrew/dev-cmd/linkage.rb @@ -1,4 +1,4 @@ -#: * `linkage` [`--test`] [`--reverse`] : +#: * `linkage` [`--test`] [`--reverse`] : #: Checks the library links of an installed formula. #: #: Only works on installed formulae. An error is raised if it is run on diff --git a/Library/Homebrew/dev-cmd/mirror.rb b/Library/Homebrew/dev-cmd/mirror.rb index bd5868726..10811493c 100644 --- a/Library/Homebrew/dev-cmd/mirror.rb +++ b/Library/Homebrew/dev-cmd/mirror.rb @@ -1,5 +1,5 @@ #: @hide_from_man_page -#: * `mirror` [`--test`] [ ...]: +#: * `mirror` [`--test`] : #: Reuploads the stable URL for a formula to Bintray to use it as a mirror. module Homebrew diff --git a/Library/Homebrew/dev-cmd/release-notes.rb b/Library/Homebrew/dev-cmd/release-notes.rb index 919243764..eb398fcfb 100644 --- a/Library/Homebrew/dev-cmd/release-notes.rb +++ b/Library/Homebrew/dev-cmd/release-notes.rb @@ -1,7 +1,7 @@ -#: * `release-notes` [] []: +#: * `release-notes` [`--markdown`] [] []: #: 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 `end_ref` is provided it defaults to `origin/master`. +#: If no is provided it defaults to the newest tag. +#: If no is provided it defaults to `origin/master`. #: #: If `--markdown` is passed, output as a Markdown list. diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index 6276d1c1b..0c8621a01 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -1,4 +1,4 @@ -#: * `tests` [`-v`] [`--coverage`] [`--generic`] [`--no-compat`] [`--only=`] [`--seed` ] [`--trace`] [`--online`] [`--official-cmd-taps`]: +#: * `tests` [`-v`] [`--coverage`] [`--generic`] [`--no-compat`] [`--only=``:`] [`--seed` ] [`--trace`] [`--online`] [`--official-cmd-taps`]: #: Run Homebrew's unit and integration tests. require "fileutils" diff --git a/Library/Homebrew/dev-cmd/update-test.rb b/Library/Homebrew/dev-cmd/update-test.rb index 3b8dc11f9..9704426dd 100644 --- a/Library/Homebrew/dev-cmd/update-test.rb +++ b/Library/Homebrew/dev-cmd/update-test.rb @@ -1,14 +1,14 @@ -#: * `update-test` [`--commit=`] [`--before=`] [`--keep-tmp`]: +#: * `update-test` [`--commit=`] [`--before=`] [`--keep-tmp`]: #: Runs a test of `brew update` with a new repository clone. #: #: If no arguments are passed, use `origin/master` as the start commit. #: -#: If `--commit=` is passed, use `` as the start commit. +#: If `--commit=` is passed, use as the start commit. #: -#: If `--before=` is passed, use the commit at `` as the +#: If `--before=` is passed, use the commit at as the #: start commit. #: -#: If `--to-tag` is passed, set HOMEBREW_UPDATE_TO_TAG to test updating +#: If `--to-tag` is passed, set `HOMEBREW_UPDATE_TO_TAG` to test updating #: between tags. #: #: If `--keep-tmp` is passed, retain the temporary directory containing -- cgit v1.2.3 From 177aefdf555488653572f1f98bf4d6d8c7a03671 Mon Sep 17 00:00:00 2001 From: Misty De Meo Date: Sun, 26 Feb 2017 14:53:00 +1100 Subject: xcodebuild audit: match xcodebuild with no args Closes #2199. Signed-off-by: Misty De Meo --- Library/Homebrew/dev-cmd/audit.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Library/Homebrew/dev-cmd') diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 134965355..35d590b69 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -924,7 +924,7 @@ class FormulaAuditor end end - if text =~ /xcodebuild[ (]["'*]/ && !text.include?("SYMROOT=") + if text =~ /xcodebuild[ (]*["'*]*/ && !text.include?("SYMROOT=") problem 'xcodebuild should be passed an explicit "SYMROOT"' end -- cgit v1.2.3