test-bot: use tap object
This commit is contained in:
parent
658bdc2565
commit
70d31838c6
@ -37,10 +37,30 @@ module Homebrew
|
|||||||
EMAIL_SUBJECT_FILE = "brew-test-bot.#{MacOS.cat}.email.txt"
|
EMAIL_SUBJECT_FILE = "brew-test-bot.#{MacOS.cat}.email.txt"
|
||||||
BYTES_IN_1_MEGABYTE = 1024*1024
|
BYTES_IN_1_MEGABYTE = 1024*1024
|
||||||
|
|
||||||
|
def resolve_test_tap
|
||||||
|
tap = ARGV.value("tap")
|
||||||
|
return Tap.new(*tap_args(tap)) if tap
|
||||||
|
|
||||||
|
if ENV["UPSTREAM_BOT_PARAMS"]
|
||||||
|
bot_argv = ENV["UPSTREAM_BOT_PARAMS"].split " "
|
||||||
|
bot_argv.extend HomebrewArgvExtension
|
||||||
|
tap = bot_argv.value("tap")
|
||||||
|
return Tap.new(*tap_args(tap)) if tap
|
||||||
|
end
|
||||||
|
|
||||||
|
if git_url = ENV["UPSTREAM_GIT_URL"] || ENV["GIT_URL"]
|
||||||
|
# Also can get tap from Jenkins GIT_URL.
|
||||||
|
url_path = git_url.sub(%r{^https?://github\.com/}, "").chomp("/")
|
||||||
|
HOMEBREW_TAP_ARGS_REGEX =~ url_path
|
||||||
|
return Tap.new($1, $3) if $1 && $3 && $3 != "homebrew"
|
||||||
|
end
|
||||||
|
|
||||||
|
# return nil means we are testing core repo.
|
||||||
|
end
|
||||||
|
|
||||||
def homebrew_git_repo(tap = nil)
|
def homebrew_git_repo(tap = nil)
|
||||||
if tap
|
if tap
|
||||||
user, repo = tap.split "/"
|
tap.path
|
||||||
HOMEBREW_LIBRARY/"Taps/#{user}/homebrew-#{repo}"
|
|
||||||
else
|
else
|
||||||
HOMEBREW_REPOSITORY
|
HOMEBREW_REPOSITORY
|
||||||
end
|
end
|
||||||
@ -586,7 +606,7 @@ module Homebrew
|
|||||||
return if @skip_homebrew
|
return if @skip_homebrew
|
||||||
test "brew", "tests"
|
test "brew", "tests"
|
||||||
if @tap
|
if @tap
|
||||||
test "brew", "readall", @tap
|
test "brew", "readall", @tap.name
|
||||||
else
|
else
|
||||||
test "brew", "tests", "--no-compat"
|
test "brew", "tests", "--no-compat"
|
||||||
readall_args = ["--aliases"]
|
readall_args = ["--aliases"]
|
||||||
@ -681,11 +701,11 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def head_only_tap?(formula)
|
def head_only_tap?(formula)
|
||||||
formula.head && formula.devel.nil? && formula.stable.nil? && formula.tap == "homebrew/homebrew-head-only"
|
formula.head && formula.devel.nil? && formula.stable.nil? && formula.tap.name == "homebrew/head-only"
|
||||||
end
|
end
|
||||||
|
|
||||||
def devel_only_tap?(formula)
|
def devel_only_tap?(formula)
|
||||||
formula.devel && formula.stable.nil? && formula.tap == "homebrew/homebrew-devel-only"
|
formula.devel && formula.stable.nil? && formula.tap.name == "homebrew/devel-only"
|
||||||
end
|
end
|
||||||
|
|
||||||
def run
|
def run
|
||||||
@ -716,23 +736,8 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_bot
|
def test_bot
|
||||||
tap = ARGV.value("tap")
|
tap = resolve_test_tap
|
||||||
|
repository = Homebrew.homebrew_git_repo tap
|
||||||
if !tap && ENV["UPSTREAM_BOT_PARAMS"]
|
|
||||||
bot_argv = ENV["UPSTREAM_BOT_PARAMS"].split " "
|
|
||||||
bot_argv.extend HomebrewArgvExtension
|
|
||||||
tap ||= bot_argv.value("tap")
|
|
||||||
end
|
|
||||||
|
|
||||||
tap.gsub!(/homebrew\/homebrew-/i, "Homebrew/") if tap
|
|
||||||
|
|
||||||
git_url = ENV["UPSTREAM_GIT_URL"] || ENV["GIT_URL"]
|
|
||||||
if !tap && git_url
|
|
||||||
# Also can get tap from Jenkins GIT_URL.
|
|
||||||
url_path = git_url.gsub(%r{^https?://github\.com/}, "").gsub(%r{/$}, "")
|
|
||||||
HOMEBREW_TAP_ARGS_REGEX =~ url_path
|
|
||||||
tap = "#{$1}/#{$3}" if $1 && $3
|
|
||||||
end
|
|
||||||
|
|
||||||
if Pathname.pwd == HOMEBREW_PREFIX && ARGV.include?("--cleanup")
|
if Pathname.pwd == HOMEBREW_PREFIX && ARGV.include?("--cleanup")
|
||||||
odie "cannot use --cleanup from HOMEBREW_PREFIX as it will delete all output."
|
odie "cannot use --cleanup from HOMEBREW_PREFIX as it will delete all output."
|
||||||
@ -768,12 +773,10 @@ module Homebrew
|
|||||||
|
|
||||||
test_bot_ci_reset_and_update if ARGV.include? "--ci-reset-and-update"
|
test_bot_ci_reset_and_update if ARGV.include? "--ci-reset-and-update"
|
||||||
|
|
||||||
repository = Homebrew.homebrew_git_repo tap
|
|
||||||
|
|
||||||
# Tap repository if required, this is done before everything else
|
# Tap repository if required, this is done before everything else
|
||||||
# because Formula parsing and/or git commit hash lookup depends on it.
|
# because Formula parsing and/or git commit hash lookup depends on it.
|
||||||
if tap && !repository.directory?
|
if tap && !tap.installed?
|
||||||
safe_system "brew", "tap", tap
|
safe_system "brew", "tap", tap.name
|
||||||
end
|
end
|
||||||
|
|
||||||
if ARGV.include? "--ci-upload"
|
if ARGV.include? "--ci-upload"
|
||||||
@ -817,8 +820,7 @@ module Homebrew
|
|||||||
|
|
||||||
if pr
|
if pr
|
||||||
pull_pr = if tap
|
pull_pr = if tap
|
||||||
user, repo = tap.split "/"
|
"https://github.com/#{tap.user}/homebrew-#{tap.repo}/pull/#{pr}"
|
||||||
"https://github.com/#{user}/homebrew-#{repo}/pull/#{pr}"
|
|
||||||
else
|
else
|
||||||
pr
|
pr
|
||||||
end
|
end
|
||||||
@ -832,13 +834,12 @@ module Homebrew
|
|||||||
bottle_args << "--keep-old" if ARGV.include? "--keep-old"
|
bottle_args << "--keep-old" if ARGV.include? "--keep-old"
|
||||||
safe_system "brew", "bottle", *bottle_args
|
safe_system "brew", "bottle", *bottle_args
|
||||||
|
|
||||||
remote_repo = tap ? tap.tr("/", "-") : "homebrew"
|
remote_repo = tap ? "homebrew-#{tap.repo}" : "homebrew"
|
||||||
|
|
||||||
remote = "git@github.com:BrewTestBot/#{remote_repo}.git"
|
remote = "git@github.com:BrewTestBot/#{remote_repo}.git"
|
||||||
tag = pr ? "pr-#{pr}" : "testing-#{number}"
|
tag = pr ? "pr-#{pr}" : "testing-#{number}"
|
||||||
safe_system "git", "push", "--force", remote, "master:master", ":refs/tags/#{tag}"
|
safe_system "git", "push", "--force", remote, "master:master", ":refs/tags/#{tag}"
|
||||||
|
|
||||||
bintray_repo = Bintray.repository(tap)
|
bintray_repo = Bintray.repository(tap.name)
|
||||||
bintray_repo_url = "https://api.bintray.com/packages/homebrew/#{bintray_repo}"
|
bintray_repo_url = "https://api.bintray.com/packages/homebrew/#{bintray_repo}"
|
||||||
formula_packaged = {}
|
formula_packaged = {}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user