audit/test-bot/pull: fix for core/formula separation
All formulae are in taps now.
This commit is contained in:
parent
e9886cac6c
commit
5bb8e8985d
@ -904,8 +904,8 @@ class FormulaAuditor
|
|||||||
|
|
||||||
if formula.tap.tap_migrations.key?(formula.name)
|
if formula.tap.tap_migrations.key?(formula.name)
|
||||||
problem <<-EOS.undent
|
problem <<-EOS.undent
|
||||||
#{formula.name} seems to be listed in tap_migrations.rb!
|
#{formula.name} seems to be listed in tap_migrations.json!
|
||||||
Please remove #{formula.name} from present tap & tap_migrations.rb
|
Please remove #{formula.name} from present tap & tap_migrations.json
|
||||||
before submitting it to Homebrew/homebrew.
|
before submitting it to Homebrew/homebrew.
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|||||||
@ -35,24 +35,25 @@ module Homebrew
|
|||||||
do_bump = ARGV.include?("--bump") && !ARGV.include?("--clean")
|
do_bump = ARGV.include?("--bump") && !ARGV.include?("--clean")
|
||||||
|
|
||||||
bintray_fetch_formulae = []
|
bintray_fetch_formulae = []
|
||||||
|
tap = nil
|
||||||
|
|
||||||
ARGV.named.each do |arg|
|
ARGV.named.each do |arg|
|
||||||
if arg.to_i > 0
|
if arg.to_i > 0
|
||||||
issue = arg
|
issue = arg
|
||||||
url = "https://github.com/Homebrew/homebrew/pull/#{arg}"
|
url = "https://github.com/Homebrew/homebrew-core/pull/#{arg}"
|
||||||
tap = CoreTap.instance
|
tap = CoreTap.instance
|
||||||
elsif (testing_match = arg.match %r{brew.sh/job/Homebrew.*Testing/(\d+)/})
|
elsif (testing_match = arg.match %r{brew.sh/job/Homebrew.*Testing/(\d+)/})
|
||||||
_, testing_job = *testing_match
|
_, testing_job = *testing_match
|
||||||
url = "https://github.com/Homebrew/homebrew/compare/master...BrewTestBot:testing-#{testing_job}"
|
url = "https://github.com/Homebrew/homebrew-core/compare/master...BrewTestBot:testing-#{testing_job}"
|
||||||
tap = CoreTap.instance
|
tap = CoreTap.instance
|
||||||
odie "Testing URLs require `--bottle`!" unless ARGV.include?("--bottle")
|
odie "Testing URLs require `--bottle`!" unless ARGV.include?("--bottle")
|
||||||
elsif (api_match = arg.match HOMEBREW_PULL_API_REGEX)
|
elsif (api_match = arg.match HOMEBREW_PULL_API_REGEX)
|
||||||
_, user, repo, issue = *api_match
|
_, user, repo, issue = *api_match
|
||||||
url = "https://github.com/#{user}/homebrew#{repo}/pull/#{issue}"
|
url = "https://github.com/#{user}/#{repo}/pull/#{issue}"
|
||||||
tap = Tap.fetch(user, "homebrew#{repo}")
|
tap = Tap.fetch(user, repo) if repo.start_with?("homebrew-")
|
||||||
elsif (url_match = arg.match HOMEBREW_PULL_OR_COMMIT_URL_REGEX)
|
elsif (url_match = arg.match HOMEBREW_PULL_OR_COMMIT_URL_REGEX)
|
||||||
url, user, repo, issue = *url_match
|
url, user, repo, issue = *url_match
|
||||||
tap = Tap.fetch(user, "homebrew#{repo}")
|
tap = Tap.fetch(user, repo) if repo.start_with?("homebrew-")
|
||||||
else
|
else
|
||||||
odie "Not a GitHub pull request or commit: #{arg}"
|
odie "Not a GitHub pull request or commit: #{arg}"
|
||||||
end
|
end
|
||||||
@ -61,8 +62,12 @@ module Homebrew
|
|||||||
raise "No pull request detected!"
|
raise "No pull request detected!"
|
||||||
end
|
end
|
||||||
|
|
||||||
tap.install unless tap.installed?
|
if tap
|
||||||
Dir.chdir tap.path
|
tap.install unless tap.installed?
|
||||||
|
Dir.chdir tap.path
|
||||||
|
else
|
||||||
|
Dir.chdir HOMEBREW_REPOSITORY
|
||||||
|
end
|
||||||
|
|
||||||
# The cache directory seems like a good place to put patches.
|
# The cache directory seems like a good place to put patches.
|
||||||
HOMEBREW_CACHE.mkpath
|
HOMEBREW_CACHE.mkpath
|
||||||
@ -93,16 +98,18 @@ module Homebrew
|
|||||||
|
|
||||||
changed_formulae = []
|
changed_formulae = []
|
||||||
|
|
||||||
Utils.popen_read(
|
if tap
|
||||||
"git", "diff-tree", "-r", "--name-only",
|
Utils.popen_read(
|
||||||
"--diff-filter=AM", revision, "HEAD", "--", tap.formula_dir.to_s
|
"git", "diff-tree", "-r", "--name-only",
|
||||||
).each_line do |line|
|
"--diff-filter=AM", revision, "HEAD", "--", tap.formula_dir.to_s
|
||||||
name = "#{tap.name}/#{File.basename(line.chomp, ".rb")}"
|
).each_line do |line|
|
||||||
begin
|
name = "#{tap.name}/#{File.basename(line.chomp, ".rb")}"
|
||||||
changed_formulae << Formula[name]
|
begin
|
||||||
# Make sure we catch syntax errors.
|
changed_formulae << Formula[name]
|
||||||
rescue Exception
|
# Make sure we catch syntax errors.
|
||||||
next
|
rescue Exception
|
||||||
|
next
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -166,11 +173,7 @@ module Homebrew
|
|||||||
url
|
url
|
||||||
else
|
else
|
||||||
bottle_branch = "pull-bottle-#{issue}"
|
bottle_branch = "pull-bottle-#{issue}"
|
||||||
if tap.core_tap?
|
"https://github.com/BrewTestBot/homebrew-#{tap.repo}/compare/homebrew:master...pr-#{issue}"
|
||||||
"https://github.com/BrewTestBot/homebrew/compare/homebrew:master...pr-#{issue}"
|
|
||||||
else
|
|
||||||
"https://github.com/BrewTestBot/homebrew-#{tap.repo}/compare/homebrew:master...pr-#{issue}"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
curl "--silent", "--fail", "-o", "/dev/null", "-I", bottle_commit_url
|
curl "--silent", "--fail", "-o", "/dev/null", "-I", bottle_commit_url
|
||||||
|
|
||||||
@ -305,7 +308,7 @@ module Homebrew
|
|||||||
files << $1 if line =~ %r{^\+\+\+ b/(.*)}
|
files << $1 if line =~ %r{^\+\+\+ b/(.*)}
|
||||||
end
|
end
|
||||||
files.each do |file|
|
files.each do |file|
|
||||||
if tap.formula_file?(file)
|
if tap && tap.formula_file?(file)
|
||||||
formula_name = File.basename(file, ".rb")
|
formula_name = File.basename(file, ".rb")
|
||||||
formulae << formula_name unless formulae.include?(formula_name)
|
formulae << formula_name unless formulae.include?(formula_name)
|
||||||
else
|
else
|
||||||
|
|||||||
@ -767,11 +767,7 @@ module Homebrew
|
|||||||
safe_system "brew", "update"
|
safe_system "brew", "update"
|
||||||
|
|
||||||
if pr
|
if pr
|
||||||
pull_pr = if tap.core_tap?
|
pull_pr = "https://github.com/#{tap.user}/homebrew-#{tap.repo}/pull/#{pr}"
|
||||||
pr
|
|
||||||
else
|
|
||||||
"https://github.com/#{tap.user}/homebrew-#{tap.repo}/pull/#{pr}"
|
|
||||||
end
|
|
||||||
safe_system "brew", "pull", "--clean", pull_pr
|
safe_system "brew", "pull", "--clean", pull_pr
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -40,8 +40,8 @@ module Homebrew
|
|||||||
alias_method :failed?, :failed
|
alias_method :failed?, :failed
|
||||||
end
|
end
|
||||||
|
|
||||||
HOMEBREW_PULL_API_REGEX = %r{https://api\.github\.com/repos/([\w-]+)/homebrew(-[\w-]+)?/pulls/(\d+)}
|
HOMEBREW_PULL_API_REGEX = %r{https://api\.github\.com/repos/([\w-]+)/([\w-]+)?/pulls/(\d+)}
|
||||||
HOMEBREW_PULL_OR_COMMIT_URL_REGEX = %r[https://github\.com/([\w-]+)/homebrew(-[\w-]+)?/(?:pull/(\d+)|commit/[0-9a-fA-F]{4,40})]
|
HOMEBREW_PULL_OR_COMMIT_URL_REGEX = %r[https://github\.com/([\w-]+)/([\w-]+)?/(?:pull/(\d+)|commit/[0-9a-fA-F]{4,40})]
|
||||||
|
|
||||||
require "compat" unless ARGV.include?("--no-compat") || ENV["HOMEBREW_NO_COMPAT"]
|
require "compat" unless ARGV.include?("--no-compat") || ENV["HOMEBREW_NO_COMPAT"]
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user