Merge pull request #10964 from MikeMcQuaid/github_packages_download_strategy_url
GitHub Packages tweaks
This commit is contained in:
		
						commit
						958b2ecb84
					
				@ -101,24 +101,27 @@ module Homebrew
 | 
			
		||||
    bottle_args += json_files
 | 
			
		||||
 | 
			
		||||
    if args.dry_run?
 | 
			
		||||
      service =
 | 
			
		||||
        if internet_archive?(bottles_hash)
 | 
			
		||||
          "Internet Archive"
 | 
			
		||||
        elsif bintray?(bottles_hash)
 | 
			
		||||
          "Bintray"
 | 
			
		||||
        elsif github_releases?(bottles_hash)
 | 
			
		||||
          "GitHub Releases"
 | 
			
		||||
        elsif github_packages?(bottles_hash)
 | 
			
		||||
          "GitHub Packages"
 | 
			
		||||
        else
 | 
			
		||||
          odie "Service specified by root_url is not recognized"
 | 
			
		||||
        end
 | 
			
		||||
      puts <<~EOS
 | 
			
		||||
        brew #{bottle_args.join " "}
 | 
			
		||||
        Upload bottles described by these JSON files to #{service}:
 | 
			
		||||
          #{json_files.join("\n  ")}
 | 
			
		||||
      EOS
 | 
			
		||||
      return unless github_packages?(bottles_hash)
 | 
			
		||||
      dry_run_service = if github_packages?(bottles_hash)
 | 
			
		||||
        # GitHub Packages has its own --dry-run handling.
 | 
			
		||||
        nil
 | 
			
		||||
      elsif internet_archive?(bottles_hash)
 | 
			
		||||
        "Internet Archive"
 | 
			
		||||
      elsif bintray?(bottles_hash)
 | 
			
		||||
        "Bintray"
 | 
			
		||||
      elsif github_releases?(bottles_hash)
 | 
			
		||||
        "GitHub Releases"
 | 
			
		||||
      else
 | 
			
		||||
        odie "Service specified by root_url is not recognized"
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      if dry_run_service
 | 
			
		||||
        puts <<~EOS
 | 
			
		||||
          brew #{bottle_args.join " "}
 | 
			
		||||
          Upload bottles described by these JSON files to #{dry_run_service}:
 | 
			
		||||
            #{json_files.join("\n  ")}
 | 
			
		||||
        EOS
 | 
			
		||||
        return
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    check_bottled_formulae(bottles_hash)
 | 
			
		||||
 | 
			
		||||
@ -543,6 +543,8 @@ class CurlGitHubPackagesDownloadStrategy < CurlDownloadStrategy
 | 
			
		||||
 | 
			
		||||
    _, org, repo, = *url.match(GitHubPackages::URL_REGEX)
 | 
			
		||||
 | 
			
		||||
    # remove redundant repo prefix for a shorter name
 | 
			
		||||
    repo = repo.delete_prefix("homebrew-")
 | 
			
		||||
    blob_url = "#{GitHubPackages::URL_PREFIX}#{org}/#{repo}/#{name}/blobs/sha256:#{checksum}"
 | 
			
		||||
    curl_download(blob_url, "--header", "Authorization: Bearer", to: temporary_path)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
@ -46,7 +46,6 @@ class GitHubPackages
 | 
			
		||||
      skopeo = Formula["skopeo"].opt_bin/"skopeo"
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    # TODO: these dependencies are installed but cannot be required automatically.
 | 
			
		||||
    Homebrew.install_gem!("json_schemer")
 | 
			
		||||
    require "json_schemer"
 | 
			
		||||
 | 
			
		||||
@ -147,8 +146,8 @@ class GitHubPackages
 | 
			
		||||
    source = "https://github.com/#{org}/#{repo}/blob/#{git_revision}/#{git_path}"
 | 
			
		||||
    documentation = if formula.tap.core_tap?
 | 
			
		||||
      "https://formulae.brew.sh/formula/#{formula_name}"
 | 
			
		||||
    else
 | 
			
		||||
      formula.tap.remote
 | 
			
		||||
    elsif (remote = formula.tap.remote) && remote.start_with?("https://github.com/")
 | 
			
		||||
      remote
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    formula_annotations_hash = {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user