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