Skip to content
Snippets Groups Projects
Commit 1acdeb3b authored by Mike McQuaid's avatar Mike McQuaid
Browse files

test-bot: support taps and use Bintray class.

Also: use curl method where sensible.
parent e303a97a
No related branches found
No related tags found
No related merge requests found
...@@ -668,8 +668,7 @@ module Homebrew ...@@ -668,8 +668,7 @@ module Homebrew
bintray_user = ENV["BINTRAY_USER"] bintray_user = ENV["BINTRAY_USER"]
bintray_key = ENV["BINTRAY_KEY"] bintray_key = ENV["BINTRAY_KEY"]
# Skip taps for now until we're using Bintray for Homebrew/homebrew if !bintray_user || !bintray_key
if !tap && (!bintray_user || !bintray_key)
raise "Missing BINTRAY_USER or BINTRAY_KEY variables!" raise "Missing BINTRAY_USER or BINTRAY_KEY variables!"
end end
...@@ -703,10 +702,10 @@ module Homebrew ...@@ -703,10 +702,10 @@ module Homebrew
safe_system "brew", "pull", "--clean", pull_pr safe_system "brew", "pull", "--clean", pull_pr
end end
# Check for existing bottles as we don't want them to be autopublished
# on Bintray until manually `brew pull`ed.
existing_bottles = {} existing_bottles = {}
Dir.glob("*.bottle*.tar.gz") do |filename| Dir.glob("*.bottle*.tar.gz") do |filename|
# Skip taps for now until we're using Bintray for Homebrew/homebrew
next if tap
formula_name = bottle_filename_formula_name filename formula_name = bottle_filename_formula_name filename
formula = Formulary.factory formula_name formula = Formulary.factory formula_name
existing_bottles[formula_name] = !!formula.bottle existing_bottles[formula_name] = !!formula.bottle
...@@ -723,38 +722,30 @@ module Homebrew ...@@ -723,38 +722,30 @@ module Homebrew
safe_system "git", "push", "--force", remote, "master:master", ":refs/tags/#{tag}" safe_system "git", "push", "--force", remote, "master:master", ":refs/tags/#{tag}"
# Bintray upload (will take over soon) # Bintray upload (will take over soon)
repo = if tap bintray_repo = Bintray.repository(tap_name)
tap.sub("/", "-") + "-bottles" bintray_repo_url = "https://api.bintray.com/packages/homebrew/#{bintray_repo}"
else
"bottles"
end
formula_packaged = {} formula_packaged = {}
Dir.glob("*.bottle*.tar.gz") do |filename| Dir.glob("*.bottle*.tar.gz") do |filename|
# Skip taps for now until we're using Bintray for Homebrew/homebrew version = Bintray.version(f.bottle.url)
next if tap
version = BottleVersion.parse(filename).to_s
formula = bottle_filename_formula_name filename formula = bottle_filename_formula_name filename
existing_bottle = existing_bottles[formula] existing_bottle = existing_bottles[formula]
unless formula_packaged[formula] unless formula_packaged[formula]
repo_url = "https://api.bintray.com/packages/homebrew/#{repo}" package_url = "#{bintray_repo_url}/#{formula}"
package_url = "#{repo_url}/#{formula}"
unless system "curl", "--silent", "--fail", "--output", "/dev/null", package_url unless system "curl", "--silent", "--fail", "--output", "/dev/null", package_url
safe_system "curl", "--silent", "--fail", curl "--silent", "--fail", "-u#{bintray_user}:#{bintray_key}",
"-u#{bintray_user}:#{bintray_key}", "-H", "Content-Type: application/json",
"-H", "Content-Type: application/json", "-d", "{\"name\":\"#{formula}\"}", bintray_repo_url
"-d", "{\"name\":\"#{formula}\"}", repo_url
puts puts
end end
formula_packaged[formula] = true formula_packaged[formula] = true
end end
content_url = "https://api.bintray.com/content/homebrew/#{repo}/#{formula}/#{version}/#{filename}" content_url = "https://api.bintray.com/content/homebrew/#{bintray_repo}/#{formula}/#{version}/#{filename}"
content_url += "?publish=1&override=1" if existing_bottle content_url += "?publish=1&override=1" if existing_bottle
safe_system "curl", "--silent", "--fail", curl "--silent", "--fail", "-u#{bintray_user}:#{bintray_key}",
"-u#{bintray_user}:#{bintray_key}", "-T", filename, content_url "-T", filename, content_url
puts puts
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment