Add initial Bintray upload support.
This commit is contained in:
		
							parent
							
								
									51956d343a
								
							
						
					
					
						commit
						38f9a78c29
					
				@ -152,6 +152,10 @@ module Homebrew
 | 
			
		||||
        safe_system "git", "checkout", branch
 | 
			
		||||
        safe_system "git", "merge", "--ff-only", "--no-edit", 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
 | 
			
		||||
 | 
			
		||||
      ohai 'Patch changed:'
 | 
			
		||||
 | 
			
		||||
@ -666,6 +666,10 @@ module Homebrew
 | 
			
		||||
      id = ENV['UPSTREAM_BUILD_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'
 | 
			
		||||
 | 
			
		||||
      bottles = Dir["#{jenkins}/jobs/#{job}/configurations/axis-version/*/builds/#{id}/archive/*.bottle*.*"]
 | 
			
		||||
@ -706,6 +710,7 @@ module Homebrew
 | 
			
		||||
      tag = pr ? "pr-#{pr}" : "testing-#{number}"
 | 
			
		||||
      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/"
 | 
			
		||||
      if tap
 | 
			
		||||
        tap_user, tap_repo = tap.split "/"
 | 
			
		||||
@ -717,6 +722,30 @@ module Homebrew
 | 
			
		||||
      rsync_args += Dir["*.bottle*.tar.gz"] + [url]
 | 
			
		||||
 | 
			
		||||
      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", "push", "--force", remote, "refs/tags/#{tag}"
 | 
			
		||||
      return
 | 
			
		||||
 | 
			
		||||
@ -251,7 +251,11 @@ end
 | 
			
		||||
class BottleSpecification
 | 
			
		||||
  DEFAULT_PREFIX = "/usr/local".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_reader :checksum, :collector
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user