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

Add initial Bintray upload support.

parent 51956d34
No related branches found
No related tags found
No related merge requests found
...@@ -152,6 +152,10 @@ module Homebrew ...@@ -152,6 +152,10 @@ module Homebrew
safe_system "git", "checkout", branch safe_system "git", "checkout", branch
safe_system "git", "merge", "--ff-only", "--no-edit", bottle_branch safe_system "git", "merge", "--ff-only", "--no-edit", bottle_branch
safe_system "git", "branch", "-D", bottle_branch safe_system "git", "branch", "-D", bottle_branch
# TODO: publish on bintray
# safe_system "curl", "-u#{user}:#{key}", "-X", "POST",
# "https://api.bintray.com/content/homebrew/#{repo}/#{formula}/#{version}"
end end
ohai 'Patch changed:' ohai 'Patch changed:'
......
...@@ -666,6 +666,10 @@ module Homebrew ...@@ -666,6 +666,10 @@ module Homebrew
id = ENV['UPSTREAM_BUILD_ID'] id = ENV['UPSTREAM_BUILD_ID']
raise "Missing Jenkins variables!" unless jenkins and job and id raise "Missing Jenkins variables!" unless jenkins and job and id
user = ENV["BINTRAY_USER"]
key = ENV["BINTRAY_KEY"]
raise "Missing Bintray variables!" unless user && key
ARGV << '--verbose' ARGV << '--verbose'
bottles = Dir["#{jenkins}/jobs/#{job}/configurations/axis-version/*/builds/#{id}/archive/*.bottle*.*"] bottles = Dir["#{jenkins}/jobs/#{job}/configurations/axis-version/*/builds/#{id}/archive/*.bottle*.*"]
...@@ -706,6 +710,7 @@ module Homebrew ...@@ -706,6 +710,7 @@ module Homebrew
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}"
# SourceForge upload (will be removed soon)
path = "/home/frs/project/m/ma/machomebrew/Bottles/" path = "/home/frs/project/m/ma/machomebrew/Bottles/"
if tap if tap
tap_user, tap_repo = tap.split "/" tap_user, tap_repo = tap.split "/"
...@@ -717,6 +722,30 @@ module Homebrew ...@@ -717,6 +722,30 @@ module Homebrew
rsync_args += Dir["*.bottle*.tar.gz"] + [url] rsync_args += Dir["*.bottle*.tar.gz"] + [url]
safe_system "rsync", *rsync_args safe_system "rsync", *rsync_args
# Bintray upload (will take over soon)
repo = if tap
tap.sub("/", "-") + "-bottles"
else
"bottles"
end
Dir.glob("*.bottle*.tar.gz") do |filename|
# Skip taps for now until we're using Bintray for Homebrew/homebrew
next if tap
version = BottleVersion.parse(filename).to_s
formula = bottle_filename_formula_name filename
package_url = "https://api.bintray.com/packages/homebrew/#{repo}/#{formula}"
unless system "curl", "--silent", "--fail", "--output", "/dev/null", package_url
safe_system "curl", "-H", "Content-Type: application/json",
"-d", "{'name':'#{formula}','licenses':['MIT']}", package_url
end
safe_system "curl", "-u#{user}:#{key}", "-T", filename,
"#{package_url}/#{version}/#{filename}"
end
safe_system "git", "tag", "--force", tag safe_system "git", "tag", "--force", tag
safe_system "git", "push", "--force", remote, "refs/tags/#{tag}" safe_system "git", "push", "--force", remote, "refs/tags/#{tag}"
return return
......
...@@ -251,7 +251,11 @@ end ...@@ -251,7 +251,11 @@ end
class BottleSpecification class BottleSpecification
DEFAULT_PREFIX = "/usr/local".freeze DEFAULT_PREFIX = "/usr/local".freeze
DEFAULT_CELLAR = "/usr/local/Cellar".freeze DEFAULT_CELLAR = "/usr/local/Cellar".freeze
DEFAULT_ROOT_URL = "https://downloads.sf.net/project/machomebrew/Bottles".freeze if ENV["HOMEBREW_BINTRAY_TESTING"]
DEFAULT_ROOT_URL = "https://bintray.com/artifact/download/homebrew/bottles".freeze
else
DEFAULT_ROOT_URL = "https://downloads.sf.net/project/machomebrew/Bottles".freeze
end
attr_rw :root_url, :prefix, :cellar, :revision attr_rw :root_url, :prefix, :cellar, :revision
attr_reader :checksum, :collector attr_reader :checksum, :collector
......
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