diff options
Diffstat (limited to 'Library/Homebrew/dev-cmd')
| -rw-r--r-- | Library/Homebrew/dev-cmd/audit.rb | 40 | ||||
| -rw-r--r-- | Library/Homebrew/dev-cmd/bump-formula-pr.rb | 5 | ||||
| -rw-r--r-- | Library/Homebrew/dev-cmd/mirror.rb | 10 | ||||
| -rw-r--r-- | Library/Homebrew/dev-cmd/pull.rb | 16 | ||||
| -rw-r--r-- | Library/Homebrew/dev-cmd/test.rb | 2 | 
5 files changed, 21 insertions, 52 deletions
diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 7b5befaa0..170fb6d5f 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -242,12 +242,10 @@ class FormulaAuditor    def self.http_content_headers_and_checksum(url, hash_needed: false, user_agent: :default)      max_time = hash_needed ? "600" : "25" -    args = curl_args( -      extra_args: ["--connect-timeout", "15", "--include", "--max-time", max_time, url], -      show_output: true, -      user_agent: user_agent, +    output, = curl_output( +      "--connect-timeout", "15", "--include", "--max-time", max_time, "--location", url, +      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") @@ -330,6 +328,7 @@ class FormulaAuditor        valid_alias_names = [alias_name_major, alias_name_major_minor]        if formula.tap && !formula.tap.core_tap? +        versioned_aliases.map! { |a| "#{formula.tap}/#{a}" }          valid_alias_names.map! { |a| "#{formula.tap}/#{a}" }        end @@ -630,7 +629,6 @@ class FormulaAuditor        end        next if spec.patches.empty? -      spec.patches.each { |p| patch_problems(p) if p.external? }        next unless @new_formula        problem "New formulae should not require patches to build. Patches should be submitted and accepted upstream first."      end @@ -786,36 +784,6 @@ class FormulaAuditor      end    end -  def patch_problems(patch) -    case patch.url -    when %r{https?://github\.com/.+/.+/(?:commit|pull)/[a-fA-F0-9]*.(?:patch|diff)} -      unless patch.url =~ /\?full_index=\w+$/ -        problem <<-EOS.undent -          GitHub patches should use the full_index parameter: -            #{patch.url}?full_index=1 -        EOS -      end -    when /raw\.github\.com/, %r{gist\.github\.com/raw}, %r{gist\.github\.com/.+/raw}, -      %r{gist\.githubusercontent\.com/.+/raw} -      unless patch.url =~ /[a-fA-F0-9]{40}/ -        problem "GitHub/Gist patches should specify a revision:\n#{patch.url}" -      end -    when %r{https?://patch-diff\.githubusercontent\.com/raw/(.+)/(.+)/pull/(.+)\.(?:diff|patch)} -      problem <<-EOS.undent -        use GitHub pull request URLs: -          https://github.com/#{Regexp.last_match(1)}/#{Regexp.last_match(2)}/pull/#{Regexp.last_match(3)}.patch?full_index=1 -        Rather than patch-diff: -          #{patch.url} -      EOS -    when %r{macports/trunk} -      problem "MacPorts patches should specify a revision instead of trunk:\n#{patch.url}" -    when %r{^http://trac\.macports\.org} -      problem "Patches from MacPorts Trac should be https://, not http:\n#{patch.url}" -    when %r{^http://bugs\.debian\.org} -      problem "Patches from Debian should be https://, not http:\n#{patch.url}" -    end -  end -    def audit_text      bin_names = Set.new      bin_names << formula.name diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index 1c56749a3..e9e98d450 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -176,7 +176,10 @@ module Homebrew        rsrc.version = forced_version if forced_version        odie "No version specified!" unless rsrc.version        rsrc_path = rsrc.fetch -      if Utils.popen_read("/usr/bin/tar", "-tf", rsrc_path) =~ %r{/.*\.} +      gnu_tar_gtar_path = HOMEBREW_PREFIX/"opt/gnu-tar/bin/gtar" +      gnu_tar_gtar = gnu_tar_gtar_path if gnu_tar_gtar_path.executable? +      tar = which("gtar") || gnu_tar_gtar || which("tar") +      if Utils.popen_read(tar, "-tf", rsrc_path) =~ %r{/.*\.}          new_hash = rsrc_path.sha256        elsif new_url.include? ".tar"          odie "#{formula}: no url/#{hash_type} specified!" diff --git a/Library/Homebrew/dev-cmd/mirror.rb b/Library/Homebrew/dev-cmd/mirror.rb index e2492203d..6445bc34c 100644 --- a/Library/Homebrew/dev-cmd/mirror.rb +++ b/Library/Homebrew/dev-cmd/mirror.rb @@ -25,9 +25,9 @@ module Homebrew             "public_download_numbers": true,             "public_stats": true}          EOS -        curl "--silent", "--fail", "-u#{bintray_user}:#{bintray_key}", -             "-H", "Content-Type: application/json", -             "-d", package_blob, bintray_repo_url +        curl "--silent", "--fail", "--user", "#{bintray_user}:#{bintray_key}", +             "--header", "Content-Type: application/json", +             "--data", package_blob, bintray_repo_url          puts        end @@ -40,8 +40,8 @@ module Homebrew        content_url = "https://api.bintray.com/content/homebrew/mirror"        content_url += "/#{bintray_package}/#{f.pkg_version}/#{filename}"        content_url += "?publish=1" -      curl "--silent", "--fail", "-u#{bintray_user}:#{bintray_key}", -           "-T", download, content_url +      curl "--silent", "--fail", "--user", "#{bintray_user}:#{bintray_key}", +           "--upload-file", download, content_url        puts        ohai "Mirrored #{filename}!"      end diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb index 9681bb2bc..dd2bc6270 100644 --- a/Library/Homebrew/dev-cmd/pull.rb +++ b/Library/Homebrew/dev-cmd/pull.rb @@ -228,7 +228,7 @@ module Homebrew            "https://github.com/BrewTestBot/homebrew-#{tap.repo}/compare/homebrew:master...pr-#{issue}"          end -        curl "--silent", "--fail", "-o", "/dev/null", "-I", bottle_commit_url +        curl "--silent", "--fail", "--output", "/dev/null", "--head", bottle_commit_url          safe_system "git", "checkout", "--quiet", "-B", bottle_branch, orig_revision          pull_patch bottle_commit_url, "bottle commit" @@ -303,7 +303,7 @@ module Homebrew        extra_msg = @description ? "(#{@description})" : nil        ohai "Fetching patch #{extra_msg}"        puts "Patch: #{patch_url}" -      curl patch_url, "-s", "-o", patchpath +      curl_download patch_url, to: patchpath      end      def apply_patch @@ -433,10 +433,10 @@ module Homebrew      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", -         "-d", '{"publish_wait_for_secs": 0}', +    curl "--write-out", '\n', "--silent", "--fail", +         "--user", "#{creds[:user]}:#{creds[:key]}", "--request", "POST", +         "--header", "Content-Type: application/json", +         "--data", '{"publish_wait_for_secs": 0}',           "https://api.bintray.com/content/homebrew/#{repo}/#{package}/#{version}/publish"      true    rescue => e @@ -587,7 +587,7 @@ module Homebrew          # We're in the cache; make sure to force re-download          loop do            begin -            curl url, "-o", filename +            curl_download url, to: filename              break            rescue              if retry_count >= max_curl_retries @@ -606,7 +606,7 @@ module Homebrew    end    def check_bintray_mirror(name, url) -    headers = curl_output("--connect-timeout", "15", "--head", url)[0] +    headers, = curl_output("--connect-timeout", "15", "--location", "--head", url)      status_code = headers.scan(%r{^HTTP\/.* (\d+)}).last.first      return if status_code.start_with?("2")      opoo "The Bintray mirror #{url} is not reachable (HTTP status code #{status_code})." diff --git a/Library/Homebrew/dev-cmd/test.rb b/Library/Homebrew/dev-cmd/test.rb index c678171ac..ab2b0edb0 100644 --- a/Library/Homebrew/dev-cmd/test.rb +++ b/Library/Homebrew/dev-cmd/test.rb @@ -65,8 +65,6 @@ module Homebrew            args << "--devel"          end -        Sandbox.print_sandbox_message if Sandbox.test? -          Utils.safe_fork do            if Sandbox.test?              sandbox = Sandbox.new  | 
