Merge pull request #11366 from MikeMcQuaid/delete-bintray
Delete Bintray code
This commit is contained in:
commit
2e1e08c596
@ -130,8 +130,14 @@ class Archive
|
||||
warn_on_error: T.nilable(T::Boolean)).void
|
||||
}
|
||||
def upload_bottles(bottles_hash, warn_on_error: false)
|
||||
bottles_hash.each do |_formula_name, bottle_hash|
|
||||
directory = bottle_hash["bintray"]["repository"]
|
||||
bottles_hash.each do |formula_full_name, bottle_hash|
|
||||
_, formula_tap_repo, = formula_full_name.split("/")
|
||||
directory = if formula_tap_repo
|
||||
"bottles-#{tap.repo}"
|
||||
else
|
||||
"bottles"
|
||||
end
|
||||
|
||||
bottle_count = bottle_hash["bottle"]["tags"].length
|
||||
|
||||
bottle_hash["bottle"]["tags"].each_value do |tag_hash|
|
||||
|
||||
@ -1,278 +0,0 @@
|
||||
# typed: false
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "utils/curl"
|
||||
require "json"
|
||||
|
||||
# Bintray API client.
|
||||
#
|
||||
# @api private
|
||||
class Bintray
|
||||
extend T::Sig
|
||||
|
||||
include Context
|
||||
include Utils::Curl
|
||||
|
||||
API_URL = "https://api.bintray.com"
|
||||
URL_REGEX = %r{^https://[\w-]+\.bintray\.com/}.freeze
|
||||
|
||||
class Error < RuntimeError
|
||||
end
|
||||
|
||||
sig { returns(String) }
|
||||
def inspect
|
||||
"#<Bintray: org=#{@bintray_org}>"
|
||||
end
|
||||
|
||||
sig { params(org: T.nilable(String)).void }
|
||||
def initialize(org: "homebrew")
|
||||
@bintray_org = org
|
||||
|
||||
raise UsageError, "Must set a Bintray organisation!" unless @bintray_org
|
||||
|
||||
ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"] = "1" if @bintray_org == "homebrew" && !OS.mac?
|
||||
end
|
||||
|
||||
def open_api(url, *args, auth: true)
|
||||
if auth
|
||||
raise UsageError, "HOMEBREW_BINTRAY_USER is unset." unless (user = Homebrew::EnvConfig.bintray_user)
|
||||
raise UsageError, "HOMEBREW_BINTRAY_KEY is unset." unless (key = Homebrew::EnvConfig.bintray_key)
|
||||
|
||||
args += ["--user", "#{user}:#{key}"]
|
||||
end
|
||||
|
||||
curl(*args, url, print_stdout: false, secrets: key)
|
||||
end
|
||||
|
||||
sig {
|
||||
params(local_file: String,
|
||||
repo: String,
|
||||
package: String,
|
||||
version: String,
|
||||
remote_file: String,
|
||||
sha256: T.nilable(String),
|
||||
warn_on_error: T.nilable(T::Boolean)).void
|
||||
}
|
||||
def upload(local_file, repo:, package:, version:, remote_file:, sha256: nil, warn_on_error: false)
|
||||
unless File.exist? local_file
|
||||
msg = "#{local_file} for upload doesn't exist!"
|
||||
raise Error, msg unless warn_on_error
|
||||
|
||||
# Warn and return early here since we know this upload is going to fail.
|
||||
opoo msg
|
||||
return
|
||||
end
|
||||
|
||||
url = "#{API_URL}/content/#{@bintray_org}/#{repo}/#{package}/#{version}/#{remote_file}"
|
||||
args = ["--upload-file", local_file]
|
||||
args += ["--header", "X-Checksum-Sha2: #{sha256}"] if sha256.present?
|
||||
args << "--fail" unless warn_on_error
|
||||
|
||||
result = T.unsafe(self).open_api(url, *args)
|
||||
|
||||
json = JSON.parse(result.stdout)
|
||||
return if json["message"] == "success"
|
||||
|
||||
msg = "Bottle upload failed: #{json["message"]}"
|
||||
raise msg unless warn_on_error
|
||||
|
||||
opoo msg
|
||||
end
|
||||
|
||||
sig {
|
||||
params(repo: String,
|
||||
package: String,
|
||||
version: String,
|
||||
file_count: T.nilable(Integer),
|
||||
warn_on_error: T.nilable(T::Boolean)).void
|
||||
}
|
||||
def publish(repo:, package:, version:, file_count:, warn_on_error: false)
|
||||
url = "#{API_URL}/content/#{@bintray_org}/#{repo}/#{package}/#{version}/publish"
|
||||
upload_args = %w[--request POST]
|
||||
upload_args += ["--fail"] unless warn_on_error
|
||||
result = T.unsafe(self).open_api(url, *upload_args)
|
||||
json = JSON.parse(result.stdout)
|
||||
if file_count.present? && json["files"] != file_count
|
||||
message = "Bottle publish failed: expected #{file_count} bottles, but published #{json["files"]} instead."
|
||||
raise message unless warn_on_error
|
||||
|
||||
opoo message
|
||||
end
|
||||
|
||||
odebug "Published #{json["files"]} bottles"
|
||||
end
|
||||
|
||||
sig { params(org: T.nilable(String)).returns(T::Boolean) }
|
||||
def official_org?(org: @bintray_org)
|
||||
%w[homebrew linuxbrew].include? org
|
||||
end
|
||||
|
||||
sig { params(url: String).returns(T::Boolean) }
|
||||
def stable_mirrored?(url)
|
||||
headers, = curl_output("--connect-timeout", "15", "--location", "--head", url)
|
||||
status_code = headers.scan(%r{^HTTP/.* (\d+)}).last.first
|
||||
status_code.start_with?("2")
|
||||
end
|
||||
|
||||
sig {
|
||||
params(formula: Formula,
|
||||
repo: String,
|
||||
publish_package: T::Boolean,
|
||||
warn_on_error: T::Boolean).returns(String)
|
||||
}
|
||||
def mirror_formula(formula, repo: "mirror", publish_package: false, warn_on_error: false)
|
||||
package = Utils::Bottles::Bintray.package formula.name
|
||||
|
||||
create_package(repo: repo, package: package) unless package_exists?(repo: repo, package: package)
|
||||
|
||||
formula.downloader.fetch
|
||||
|
||||
version = ERB::Util.url_encode(formula.pkg_version)
|
||||
filename = ERB::Util.url_encode(formula.downloader.basename)
|
||||
destination_url = "https://dl.bintray.com/#{@bintray_org}/#{repo}/#{filename}"
|
||||
|
||||
odebug "Uploading to #{destination_url}"
|
||||
|
||||
upload(
|
||||
formula.downloader.cached_location,
|
||||
repo: repo,
|
||||
package: package,
|
||||
version: version,
|
||||
sha256: formula.stable.checksum,
|
||||
remote_file: filename,
|
||||
warn_on_error: warn_on_error,
|
||||
)
|
||||
return destination_url unless publish_package
|
||||
|
||||
odebug "Publishing #{@bintray_org}/#{repo}/#{package}/#{version}"
|
||||
publish(repo: repo, package: package, version: version, file_count: 1, warn_on_error: warn_on_error)
|
||||
|
||||
destination_url
|
||||
end
|
||||
|
||||
sig { params(repo: String, package: String).void }
|
||||
def create_package(repo:, package:)
|
||||
url = "#{API_URL}/packages/#{@bintray_org}/#{repo}"
|
||||
data = { name: package, public_download_numbers: true }
|
||||
data[:public_stats] = official_org?
|
||||
open_api(url, "--header", "Content-Type: application/json", "--request", "POST", "--data", data.to_json)
|
||||
end
|
||||
|
||||
sig { params(repo: String, package: String).returns(T::Boolean) }
|
||||
def package_exists?(repo:, package:)
|
||||
url = "#{API_URL}/packages/#{@bintray_org}/#{repo}/#{package}"
|
||||
begin
|
||||
open_api(url, "--fail", "--silent", "--output", "/dev/null", auth: false)
|
||||
rescue ErrorDuringExecution => e
|
||||
stderr = e.output
|
||||
.select { |type,| type == :stderr }
|
||||
.map { |_, line| line }
|
||||
.join
|
||||
raise if e.status.exitstatus != 22 && stderr.exclude?("404 Not Found")
|
||||
|
||||
false
|
||||
else
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
# Gets the SHA-256 checksum of the specified remote file.
|
||||
#
|
||||
# @return the checksum, the empty string (if the file doesn't have a checksum), nil (if the file doesn't exist)
|
||||
sig { params(repo: String, remote_file: String).returns(T.nilable(String)) }
|
||||
def remote_checksum(repo:, remote_file:)
|
||||
url = "https://dl.bintray.com/#{@bintray_org}/#{repo}/#{remote_file}"
|
||||
result = curl_output "--fail", "--silent", "--head", url
|
||||
if result.success?
|
||||
result.stdout.match(/^X-Checksum-Sha2:\s+(\h{64})\b/i)&.values_at(1)&.first || ""
|
||||
else
|
||||
raise Error if result.status.exitstatus != 22 && result.stderr.exclude?("404 Not Found")
|
||||
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
sig { params(bintray_repo: String, bintray_package: String, filename: String).returns(String) }
|
||||
def file_delete_instructions(bintray_repo, bintray_package, filename)
|
||||
<<~EOS
|
||||
Remove this file manually in your web browser:
|
||||
https://bintray.com/#{@bintray_org}/#{bintray_repo}/#{bintray_package}/view#files
|
||||
Or run:
|
||||
curl -X DELETE -u $HOMEBREW_BINTRAY_USER:$HOMEBREW_BINTRAY_KEY \\
|
||||
https://api.bintray.com/content/#{@bintray_org}/#{bintray_repo}/#{filename}
|
||||
EOS
|
||||
end
|
||||
|
||||
sig {
|
||||
params(bottles_hash: T::Hash[String, T.untyped],
|
||||
publish_package: T::Boolean,
|
||||
warn_on_error: T.nilable(T::Boolean)).void
|
||||
}
|
||||
def upload_bottles(bottles_hash, publish_package: false, warn_on_error: false)
|
||||
formula_packaged = {}
|
||||
|
||||
bottles_hash.each do |formula_name, bottle_hash|
|
||||
version = ERB::Util.url_encode(bottle_hash["formula"]["pkg_version"])
|
||||
bintray_package = bottle_hash["bintray"]["package"]
|
||||
bintray_repo = bottle_hash["bintray"]["repository"]
|
||||
bottle_count = bottle_hash["bottle"]["tags"].length
|
||||
|
||||
bottle_hash["bottle"]["tags"].each do |tag, tag_hash|
|
||||
filename = Bottle::Filename.new(bottle_hash["formula"]["name"], bottle_hash["formula"]["pkg_version"],
|
||||
tag, bottle_hash["bottle"]["rebuild"]).bintray
|
||||
sha256 = tag_hash["sha256"]
|
||||
delete_instructions = file_delete_instructions(bintray_repo, bintray_package, filename)
|
||||
|
||||
odebug "Checking remote file #{@bintray_org}/#{bintray_repo}/#{filename}"
|
||||
result = remote_checksum(repo: bintray_repo, remote_file: filename)
|
||||
|
||||
case result
|
||||
when nil
|
||||
# File doesn't exist.
|
||||
if !formula_packaged[formula_name] && !package_exists?(repo: bintray_repo, package: bintray_package)
|
||||
odebug "Creating package #{@bintray_org}/#{bintray_repo}/#{bintray_package}"
|
||||
create_package repo: bintray_repo, package: bintray_package
|
||||
formula_packaged[formula_name] = true
|
||||
end
|
||||
|
||||
odebug "Uploading #{@bintray_org}/#{bintray_repo}/#{bintray_package}/#{version}/#{filename}"
|
||||
upload(tag_hash["local_filename"],
|
||||
repo: bintray_repo,
|
||||
package: bintray_package,
|
||||
version: version,
|
||||
remote_file: filename,
|
||||
sha256: sha256,
|
||||
warn_on_error: warn_on_error)
|
||||
when sha256
|
||||
# File exists, checksum matches.
|
||||
odebug "#{filename} is already published with matching hash."
|
||||
bottle_count -= 1
|
||||
when ""
|
||||
# File exists, but can't find checksum
|
||||
failed_message = "#{filename} is already published!"
|
||||
raise Error, "#{failed_message}\n#{delete_instructions}" unless warn_on_error
|
||||
|
||||
opoo failed_message
|
||||
else
|
||||
# File exists, but checksum either doesn't exist or is mismatched.
|
||||
failed_message = <<~EOS
|
||||
#{filename} is already published with a mismatched hash!
|
||||
Expected: #{sha256}
|
||||
Actual: #{result}
|
||||
EOS
|
||||
raise Error, "#{failed_message}#{delete_instructions}" unless warn_on_error
|
||||
|
||||
opoo failed_message
|
||||
end
|
||||
end
|
||||
next unless publish_package
|
||||
|
||||
odebug "Publishing #{@bintray_org}/#{bintray_repo}/#{bintray_package}/#{version}"
|
||||
publish(repo: bintray_repo,
|
||||
package: bintray_package,
|
||||
version: version,
|
||||
file_count: bottle_count,
|
||||
warn_on_error: warn_on_error)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -183,11 +183,6 @@ module Homebrew
|
||||
sig { returns(T.nilable(String)) }
|
||||
def workflow; end
|
||||
|
||||
sig { returns(T.nilable(String)) }
|
||||
def bintray_org; end
|
||||
|
||||
sig { returns(T.nilable(String)) }
|
||||
def bintray_repo; end
|
||||
sig { returns(T.nilable(String)) }
|
||||
def package_name; end
|
||||
|
||||
|
||||
@ -87,7 +87,7 @@ fetch() {
|
||||
curl_args[${#curl_args[*]}]="-q"
|
||||
fi
|
||||
|
||||
# Authorization is needed for GitHub Packages but harmless on Bintray/GitHub Releases
|
||||
# Authorization is needed for GitHub Packages but harmless on GitHub Releases
|
||||
curl_args+=(
|
||||
--fail
|
||||
--remote-time
|
||||
@ -145,8 +145,7 @@ Failed to download ${VENDOR_URL} and ${VENDOR_URL2}!
|
||||
|
||||
Do not file an issue on GitHub about this; you will need to figure out for
|
||||
yourself what issue with your internet connection restricts your access to
|
||||
both Bintray (used for Homebrew bottles/binary packages) and GitHub
|
||||
(used for Homebrew updates).
|
||||
GitHub (used for Homebrew updates and binary packages).
|
||||
EOS
|
||||
fi
|
||||
|
||||
|
||||
@ -10,7 +10,6 @@ require "cli/parser"
|
||||
require "utils/inreplace"
|
||||
require "erb"
|
||||
require "archive"
|
||||
require "bintray"
|
||||
|
||||
BOTTLE_ERB = <<-EOS
|
||||
bottle do
|
||||
@ -584,15 +583,6 @@ module Homebrew
|
||||
},
|
||||
}
|
||||
|
||||
if bottle.root_url.match?(::Bintray::URL_REGEX) ||
|
||||
# TODO: given the naming: ideally the Internet Archive uploader wouldn't use this.
|
||||
bottle.root_url.start_with?("#{::Archive::URL_PREFIX}/")
|
||||
json[f.full_name]["bintray"] = {
|
||||
"package" => Utils::Bottles::Bintray.package(f.name),
|
||||
"repository" => Utils::Bottles::Bintray.repository(tap),
|
||||
}
|
||||
end
|
||||
|
||||
puts "Writing #{filename.json}" if args.verbose?
|
||||
json_path = Pathname(filename.json)
|
||||
json_path.unlink if json_path.exist?
|
||||
|
||||
@ -24,7 +24,7 @@ module Homebrew
|
||||
flag "--workflow=",
|
||||
description: "Dispatch specified workflow (default: `dispatch-build-bottle.yml`)."
|
||||
switch "--upload",
|
||||
description: "Upload built bottles to Bintray."
|
||||
description: "Upload built bottles."
|
||||
switch "--linux",
|
||||
description: "Dispatch bottle for Linux (using GitHub runners)."
|
||||
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
# typed: true
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "bintray"
|
||||
require "cli/parser"
|
||||
|
||||
module Homebrew
|
||||
@ -13,34 +12,13 @@ module Homebrew
|
||||
def mirror_args
|
||||
Homebrew::CLI::Parser.new do
|
||||
description <<~EOS
|
||||
Reupload the stable URL of a formula to Bintray for use as a mirror.
|
||||
Reupload the stable URL of a formula for use as a mirror.
|
||||
EOS
|
||||
flag "--bintray-org=",
|
||||
description: "Upload to the specified Bintray organisation (default: `homebrew`)."
|
||||
flag "--bintray-repo=",
|
||||
description: "Upload to the specified Bintray repository (default: `mirror`)."
|
||||
switch "--no-publish",
|
||||
description: "Upload to Bintray, but don't publish."
|
||||
|
||||
named_args :formula, min: 1
|
||||
|
||||
hide_from_man_page!
|
||||
end
|
||||
end
|
||||
|
||||
def mirror
|
||||
args = mirror_args.parse
|
||||
|
||||
odeprecated "brew mirror (Bintray will be shut down on 1st May 2021)"
|
||||
|
||||
bintray_org = args.bintray_org || "homebrew"
|
||||
bintray_repo = args.bintray_repo || "mirror"
|
||||
|
||||
bintray = Bintray.new(org: bintray_org)
|
||||
|
||||
args.named.to_formulae.each do |formula|
|
||||
mirror_url = bintray.mirror_formula(formula, repo: bintray_repo, publish_package: !args.no_publish?)
|
||||
ohai "Mirrored #{formula.full_name} to #{mirror_url}!"
|
||||
end
|
||||
odisabled "`brew mirror` (Bintray was shut down on 1st May 2021)"
|
||||
end
|
||||
end
|
||||
|
||||
@ -55,8 +55,6 @@ module Homebrew
|
||||
description: "Download artifacts with the specified name (default: `bottles`)."
|
||||
flag "--archive-item=",
|
||||
description: "Upload to the specified Internet Archive item (default: `homebrew`)."
|
||||
flag "--bintray-org=",
|
||||
description: "Upload to the specified Bintray organisation (default: `homebrew`)."
|
||||
flag "--tap=",
|
||||
description: "Target tap repository (default: `homebrew/core`)."
|
||||
flag "--root-url=",
|
||||
@ -64,9 +62,6 @@ module Homebrew
|
||||
flag "--root-url-using=",
|
||||
description: "Use the specified download strategy class for downloading the bottle's URL instead of "\
|
||||
"Homebrew's default."
|
||||
flag "--bintray-mirror=",
|
||||
description: "Use the specified Bintray repository to automatically mirror stable URLs "\
|
||||
"defined in the formulae (default: `mirror`)."
|
||||
comma_array "--workflows=",
|
||||
description: "Retrieve artifacts from the specified workflow (default: `tests.yml`). "\
|
||||
"Can be a comma-separated list to include multiple workflows."
|
||||
@ -74,7 +69,6 @@ module Homebrew
|
||||
description: "Comma-separated list of workflows which can be ignored if they have not been run."
|
||||
|
||||
conflicts "--clean", "--autosquash"
|
||||
conflicts "--archive-item", "--bintray-org"
|
||||
|
||||
named_args :pull_request, min: 1
|
||||
end
|
||||
@ -308,26 +302,6 @@ module Homebrew
|
||||
end
|
||||
end
|
||||
|
||||
def mirror_formulae(tap, original_commit, org:, repo:, args:, publish: true)
|
||||
changed_formulae(tap, original_commit).select do |f|
|
||||
stable_urls = [f.stable.url] + f.stable.mirrors
|
||||
stable_urls.grep(%r{^https://dl.bintray.com/#{org}/#{repo}/}) do |mirror_url|
|
||||
if args.dry_run?
|
||||
puts "brew mirror #{f.full_name}"
|
||||
else
|
||||
odebug "Mirroring #{mirror_url}"
|
||||
mirror_args = ["mirror", f.full_name]
|
||||
mirror_args << "--debug" if args.debug?
|
||||
mirror_args << "--verbose" if args.verbose?
|
||||
mirror_args << "--bintray-org=#{org}" if org
|
||||
mirror_args << "--bintray-repo=#{repo}" if repo
|
||||
mirror_args << "--no-publish" unless publish
|
||||
system HOMEBREW_BREW_FILE, *mirror_args
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def changed_formulae(tap, original_commit)
|
||||
if Homebrew::EnvConfig.disable_load_formula?
|
||||
opoo "Can't check if updated bottles are necessary as formula loading is disabled!"
|
||||
@ -368,8 +342,6 @@ module Homebrew
|
||||
workflows = args.workflows.presence || ["tests.yml"]
|
||||
artifact = args.artifact || "bottles"
|
||||
archive_item = args.archive_item
|
||||
bintray_org = args.bintray_org || "homebrew"
|
||||
mirror_repo = args.bintray_mirror || "mirror"
|
||||
tap = Tap.fetch(args.tap || CoreTap.instance.name)
|
||||
|
||||
Utils::Git.set_name_email!(committer: args.committer.blank?)
|
||||
@ -403,12 +375,6 @@ module Homebrew
|
||||
verbose: args.verbose?, resolve: args.resolve?, reason: args.message)
|
||||
end
|
||||
signoff!(tap.path, pr: pr, dry_run: args.dry_run?) unless args.clean?
|
||||
|
||||
unless args.no_upload?
|
||||
mirror_formulae(tap, original_commit,
|
||||
org: bintray_org, repo: mirror_repo, publish: !args.no_publish?,
|
||||
args: args)
|
||||
end
|
||||
end
|
||||
|
||||
unless formulae_need_bottles?(tap, original_commit, user, repo, pr, args: args)
|
||||
@ -447,11 +413,7 @@ module Homebrew
|
||||
upload_args << "--committer=#{args.committer}" if args.committer
|
||||
upload_args << "--root-url=#{args.root_url}" if args.root_url
|
||||
upload_args << "--root-url-using=#{args.root_url_using}" if args.root_url_using
|
||||
upload_args << if archive_item.present?
|
||||
"--archive-item=#{archive_item}"
|
||||
else
|
||||
"--bintray-org=#{bintray_org}"
|
||||
end
|
||||
upload_args << "--archive-item=#{archive_item}" if archive_item.present?
|
||||
safe_system HOMEBREW_BREW_FILE, *upload_args
|
||||
end
|
||||
end
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
|
||||
require "cli/parser"
|
||||
require "archive"
|
||||
require "bintray"
|
||||
require "github_packages"
|
||||
require "github_releases"
|
||||
|
||||
@ -34,8 +33,6 @@ module Homebrew
|
||||
description: "Specify a committer name and email in `git`'s standard author format."
|
||||
flag "--archive-item=",
|
||||
description: "Upload to the specified Internet Archive item (default: `homebrew`)."
|
||||
flag "--bintray-org=",
|
||||
description: "Upload to the specified Bintray organisation (default: `homebrew`)."
|
||||
flag "--github-org=",
|
||||
description: "Upload to the specified GitHub organisation's GitHub Packages (default: `homebrew`)."
|
||||
flag "--root-url=",
|
||||
@ -65,12 +62,6 @@ module Homebrew
|
||||
end
|
||||
end
|
||||
|
||||
def bintray?(bottles_hash)
|
||||
@bintray ||= bottles_hash.values.all? do |bottle_hash|
|
||||
bottle_hash["bottle"]["root_url"].match? Bintray::URL_REGEX
|
||||
end
|
||||
end
|
||||
|
||||
def github_releases?(bottles_hash)
|
||||
@github_releases ||= bottles_hash.values.all? do |bottle_hash|
|
||||
root_url = bottle_hash["bottle"]["root_url"]
|
||||
@ -126,8 +117,6 @@ module Homebrew
|
||||
nil
|
||||
elsif internet_archive?(bottles_hash)
|
||||
"Internet Archive"
|
||||
elsif bintray?(bottles_hash)
|
||||
"Bintray"
|
||||
elsif github_releases?(bottles_hash)
|
||||
"GitHub Releases"
|
||||
else
|
||||
@ -176,14 +165,6 @@ module Homebrew
|
||||
archive = Archive.new(item: archive_item)
|
||||
archive.upload_bottles(bottles_hash,
|
||||
warn_on_error: args.warn_on_upload_failure?)
|
||||
elsif bintray?(bottles_hash)
|
||||
odeprecated "brew pr-upload for Bintray (Bintray will be shut down on 1st May 2021)"
|
||||
|
||||
bintray_org = args.bintray_org || "homebrew"
|
||||
bintray = Bintray.new(org: bintray_org)
|
||||
bintray.upload_bottles(bottles_hash,
|
||||
publish_package: !args.no_publish?,
|
||||
warn_on_error: args.warn_on_upload_failure?)
|
||||
elsif github_releases?(bottles_hash)
|
||||
github_releases = GitHubReleases.new
|
||||
github_releases.upload_bottles(bottles_hash)
|
||||
|
||||
@ -33,12 +33,6 @@ module Homebrew
|
||||
description: "Use this as the `bat` configuration file.",
|
||||
default_text: "`$HOME/.bat/config`.",
|
||||
},
|
||||
HOMEBREW_BINTRAY_KEY: {
|
||||
description: "Use this API key when accessing the Bintray API (where bottles are stored).",
|
||||
},
|
||||
HOMEBREW_BINTRAY_USER: {
|
||||
description: "Use this username when accessing the Bintray API (where bottles are stored).",
|
||||
},
|
||||
HOMEBREW_BOOTSNAP: {
|
||||
description: "If set, use Bootsnap to speed up repeated `brew` calls. "\
|
||||
"A no-op when using Homebrew's vendored, relocatable Ruby on macOS (as it doesn't work).",
|
||||
|
||||
@ -13,7 +13,6 @@ require "patch"
|
||||
require "compilers"
|
||||
require "os/mac/version"
|
||||
require "extend/on_os"
|
||||
require "bintray"
|
||||
|
||||
class SoftwareSpec
|
||||
extend T::Sig
|
||||
@ -461,8 +460,6 @@ class BottleSpecification
|
||||
if var.nil?
|
||||
@root_url ||= if (github_packages_url = GitHubPackages.root_url_if_match(Homebrew::EnvConfig.bottle_domain))
|
||||
github_packages_url
|
||||
elsif Homebrew::EnvConfig.bottle_domain.match?(::Bintray::URL_REGEX)
|
||||
"#{Homebrew::EnvConfig.bottle_domain}/#{Utils::Bottles::Bintray.repository(tap)}"
|
||||
else
|
||||
Homebrew::EnvConfig.bottle_domain
|
||||
end
|
||||
|
||||
@ -2893,11 +2893,6 @@ class Binding
|
||||
def irb(); end
|
||||
end
|
||||
|
||||
class Bintray
|
||||
extend ::T::Private::Methods::MethodHooks
|
||||
extend ::T::Private::Methods::SingletonMethodHooks
|
||||
end
|
||||
|
||||
module Bootsnap
|
||||
def bundler?(); end
|
||||
VERSION = ::T.let(nil, ::T.untyped)
|
||||
@ -8161,10 +8156,6 @@ module Homebrew::EnvConfig
|
||||
|
||||
def self.bat_config_path(); end
|
||||
|
||||
def self.bintray_key(); end
|
||||
|
||||
def self.bintray_user(); end
|
||||
|
||||
def self.bootsnap?(); end
|
||||
|
||||
def self.bottle_domain(); end
|
||||
|
||||
@ -680,10 +680,6 @@ def stub_hash(parameters)
|
||||
"sha256":"#{parameters[:sha256]}"
|
||||
}
|
||||
}
|
||||
},
|
||||
"bintray":{
|
||||
"package":"#{parameters[:name]}",
|
||||
"repository":"bottles"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,21 +0,0 @@
|
||||
# typed: false
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "utils/bottles"
|
||||
|
||||
describe Utils::Bottles::Bintray do
|
||||
describe "::package" do
|
||||
it "converts a Formula name to a package name" do
|
||||
expect(described_class.package("openssl@1.1")).to eq("openssl:1.1")
|
||||
expect(described_class.package("gtk+")).to eq("gtkx")
|
||||
expect(described_class.package("llvm")).to eq("llvm")
|
||||
end
|
||||
end
|
||||
|
||||
describe "::repository" do
|
||||
it "returns the repository for a given Tap" do
|
||||
expect(described_class.repository(Tap.new("homebrew", "bintray-test")))
|
||||
.to eq("bottles-bintray-test")
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -215,24 +215,6 @@ module Utils
|
||||
end
|
||||
end
|
||||
|
||||
# Helper functions for bottles hosted on Bintray.
|
||||
module Bintray
|
||||
def self.package(formula_name)
|
||||
package_name = formula_name.to_s.dup
|
||||
package_name.tr!("+", "x")
|
||||
package_name.sub!(/(.)@(\d)/, "\\1:\\2") # Handle foo@1.2 style formulae.
|
||||
package_name
|
||||
end
|
||||
|
||||
def self.repository(tap = nil)
|
||||
if tap.nil? || tap.core_tap?
|
||||
"bottles"
|
||||
else
|
||||
"bottles-#{tap.repo}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Collector for bottle specifications.
|
||||
class Collector
|
||||
extend T::Sig
|
||||
|
||||
@ -1383,11 +1383,8 @@ _brew_mirror() {
|
||||
case "${cur}" in
|
||||
-*)
|
||||
__brewcomp "
|
||||
--bintray-org
|
||||
--bintray-repo
|
||||
--debug
|
||||
--help
|
||||
--no-publish
|
||||
--quiet
|
||||
--verbose
|
||||
"
|
||||
@ -1395,7 +1392,6 @@ _brew_mirror() {
|
||||
;;
|
||||
*)
|
||||
esac
|
||||
__brew_complete_formulae
|
||||
}
|
||||
|
||||
_brew_missing() {
|
||||
@ -1545,8 +1541,6 @@ _brew_pr_pull() {
|
||||
--archive-item
|
||||
--artifact
|
||||
--autosquash
|
||||
--bintray-mirror
|
||||
--bintray-org
|
||||
--branch-okay
|
||||
--clean
|
||||
--committer
|
||||
@ -1580,7 +1574,6 @@ _brew_pr_upload() {
|
||||
-*)
|
||||
__brewcomp "
|
||||
--archive-item
|
||||
--bintray-org
|
||||
--committer
|
||||
--debug
|
||||
--dry-run
|
||||
|
||||
@ -585,7 +585,7 @@ __fish_brew_complete_arg 'dispatch-build-bottle' -l linux -d 'Dispatch bottle fo
|
||||
__fish_brew_complete_arg 'dispatch-build-bottle' -l macos -d 'Version of macOS the bottle should be built for'
|
||||
__fish_brew_complete_arg 'dispatch-build-bottle' -l quiet -d 'Make some output more quiet'
|
||||
__fish_brew_complete_arg 'dispatch-build-bottle' -l tap -d 'Target tap repository (default: `homebrew/core`)'
|
||||
__fish_brew_complete_arg 'dispatch-build-bottle' -l upload -d 'Upload built bottles to Bintray'
|
||||
__fish_brew_complete_arg 'dispatch-build-bottle' -l upload -d 'Upload built bottles'
|
||||
__fish_brew_complete_arg 'dispatch-build-bottle' -l verbose -d 'Make some output more verbose'
|
||||
__fish_brew_complete_arg 'dispatch-build-bottle' -l workflow -d 'Dispatch specified workflow (default: `dispatch-build-bottle.yml`)'
|
||||
__fish_brew_complete_arg 'dispatch-build-bottle' -a '(__fish_brew_suggest_formulae_all)'
|
||||
@ -967,15 +967,11 @@ __fish_brew_complete_arg 'migrate' -l verbose -d 'Make some output more verbose'
|
||||
__fish_brew_complete_arg 'migrate' -a '(__fish_brew_suggest_formulae_installed)'
|
||||
|
||||
|
||||
__fish_brew_complete_cmd 'mirror' 'Reupload the stable URL of a formula to Bintray for use as a mirror'
|
||||
__fish_brew_complete_arg 'mirror' -l bintray-org -d 'Upload to the specified Bintray organisation (default: `homebrew`)'
|
||||
__fish_brew_complete_arg 'mirror' -l bintray-repo -d 'Upload to the specified Bintray repository (default: `mirror`)'
|
||||
__fish_brew_complete_cmd 'mirror' 'Reupload the stable URL of a formula for use as a mirror'
|
||||
__fish_brew_complete_arg 'mirror' -l debug -d 'Display any debugging information'
|
||||
__fish_brew_complete_arg 'mirror' -l help -d 'Show this message'
|
||||
__fish_brew_complete_arg 'mirror' -l no-publish -d 'Upload to Bintray, but don\'t publish'
|
||||
__fish_brew_complete_arg 'mirror' -l quiet -d 'Make some output more quiet'
|
||||
__fish_brew_complete_arg 'mirror' -l verbose -d 'Make some output more verbose'
|
||||
__fish_brew_complete_arg 'mirror' -a '(__fish_brew_suggest_formulae_all)'
|
||||
|
||||
|
||||
__fish_brew_complete_cmd 'missing' 'Check the given formula kegs for missing dependencies'
|
||||
@ -1058,8 +1054,6 @@ __fish_brew_complete_cmd 'pr-pull' 'Download and publish bottles, and apply the
|
||||
__fish_brew_complete_arg 'pr-pull' -l archive-item -d 'Upload to the specified Internet Archive item (default: `homebrew`)'
|
||||
__fish_brew_complete_arg 'pr-pull' -l artifact -d 'Download artifacts with the specified name (default: `bottles`)'
|
||||
__fish_brew_complete_arg 'pr-pull' -l autosquash -d 'Automatically reformat and reword commits in the pull request to our preferred format'
|
||||
__fish_brew_complete_arg 'pr-pull' -l bintray-mirror -d 'Use the specified Bintray repository to automatically mirror stable URLs defined in the formulae (default: `mirror`)'
|
||||
__fish_brew_complete_arg 'pr-pull' -l bintray-org -d 'Upload to the specified Bintray organisation (default: `homebrew`)'
|
||||
__fish_brew_complete_arg 'pr-pull' -l branch-okay -d 'Do not warn if pulling to a branch besides the repository default (useful for testing)'
|
||||
__fish_brew_complete_arg 'pr-pull' -l clean -d 'Do not amend the commits from pull requests'
|
||||
__fish_brew_complete_arg 'pr-pull' -l committer -d 'Specify a committer name and email in `git`\'s standard author format'
|
||||
@ -1084,7 +1078,6 @@ __fish_brew_complete_arg 'pr-pull' -l workflows -d 'Retrieve artifacts from the
|
||||
|
||||
__fish_brew_complete_cmd 'pr-upload' 'Apply the bottle commit and publish bottles to a host'
|
||||
__fish_brew_complete_arg 'pr-upload' -l archive-item -d 'Upload to the specified Internet Archive item (default: `homebrew`)'
|
||||
__fish_brew_complete_arg 'pr-upload' -l bintray-org -d 'Upload to the specified Bintray organisation (default: `homebrew`)'
|
||||
__fish_brew_complete_arg 'pr-upload' -l committer -d 'Specify a committer name and email in `git`\'s standard author format'
|
||||
__fish_brew_complete_arg 'pr-upload' -l debug -d 'Display any debugging information'
|
||||
__fish_brew_complete_arg 'pr-upload' -l dry-run -d 'Print what would be done rather than doing it'
|
||||
|
||||
@ -177,7 +177,7 @@ __brew_internal_commands() {
|
||||
'log:Show the `git log` for formula, or show the log for the Homebrew repository if no formula is provided'
|
||||
'man:Generate Homebrew'\''s manpages'
|
||||
'migrate:Migrate renamed packages to new names, where formula are old names of packages'
|
||||
'mirror:Reupload the stable URL of a formula to Bintray for use as a mirror'
|
||||
'mirror:Reupload the stable URL of a formula for use as a mirror'
|
||||
'missing:Check the given formula kegs for missing dependencies'
|
||||
'options:Show install options specific to formula'
|
||||
'outdated:List installed casks and formulae that have an updated version available'
|
||||
@ -721,7 +721,7 @@ _brew_dispatch_build_bottle() {
|
||||
'(--linux)--macos[Version of macOS the bottle should be built for]' \
|
||||
'--quiet[Make some output more quiet]' \
|
||||
'--tap[Target tap repository (default: `homebrew/core`)]' \
|
||||
'--upload[Upload built bottles to Bintray]' \
|
||||
'--upload[Upload built bottles]' \
|
||||
'--verbose[Make some output more verbose]' \
|
||||
'--workflow[Dispatch specified workflow (default: `dispatch-build-bottle.yml`)]' \
|
||||
- formula \
|
||||
@ -1191,15 +1191,10 @@ _brew_migrate() {
|
||||
# brew mirror
|
||||
_brew_mirror() {
|
||||
_arguments \
|
||||
'--bintray-org[Upload to the specified Bintray organisation (default: `homebrew`)]' \
|
||||
'--bintray-repo[Upload to the specified Bintray repository (default: `mirror`)]' \
|
||||
'--debug[Display any debugging information]' \
|
||||
'--help[Show this message]' \
|
||||
'--no-publish[Upload to Bintray, but don'\''t publish]' \
|
||||
'--quiet[Make some output more quiet]' \
|
||||
'--verbose[Make some output more verbose]' \
|
||||
- formula \
|
||||
'*::formula:__brew_formulae'
|
||||
'--verbose[Make some output more verbose]'
|
||||
}
|
||||
|
||||
# brew missing
|
||||
@ -1301,11 +1296,9 @@ _brew_pr_publish() {
|
||||
# brew pr-pull
|
||||
_brew_pr_pull() {
|
||||
_arguments \
|
||||
'(--bintray-org)--archive-item[Upload to the specified Internet Archive item (default: `homebrew`)]' \
|
||||
'--archive-item[Upload to the specified Internet Archive item (default: `homebrew`)]' \
|
||||
'--artifact[Download artifacts with the specified name (default: `bottles`)]' \
|
||||
'(--clean)--autosquash[Automatically reformat and reword commits in the pull request to our preferred format]' \
|
||||
'--bintray-mirror[Use the specified Bintray repository to automatically mirror stable URLs defined in the formulae (default: `mirror`)]' \
|
||||
'(--archive-item)--bintray-org[Upload to the specified Bintray organisation (default: `homebrew`)]' \
|
||||
'--branch-okay[Do not warn if pulling to a branch besides the repository default (useful for testing)]' \
|
||||
'(--autosquash)--clean[Do not amend the commits from pull requests]' \
|
||||
'--committer[Specify a committer name and email in `git`'\''s standard author format]' \
|
||||
@ -1332,7 +1325,6 @@ _brew_pr_pull() {
|
||||
_brew_pr_upload() {
|
||||
_arguments \
|
||||
'--archive-item[Upload to the specified Internet Archive item (default: `homebrew`)]' \
|
||||
'--bintray-org[Upload to the specified Bintray organisation (default: `homebrew`)]' \
|
||||
'--committer[Specify a committer name and email in `git`'\''s standard author format]' \
|
||||
'--debug[Display any debugging information]' \
|
||||
'--dry-run[Print what would be done rather than doing it]' \
|
||||
|
||||
@ -1027,7 +1027,7 @@ Build bottles for these formulae with GitHub Actions.
|
||||
* `--workflow`:
|
||||
Dispatch specified workflow (default: `dispatch-build-bottle.yml`).
|
||||
* `--upload`:
|
||||
Upload built bottles to Bintray.
|
||||
Upload built bottles.
|
||||
* `--linux`:
|
||||
Dispatch bottle for Linux (using GitHub runners).
|
||||
|
||||
@ -1185,16 +1185,12 @@ Requires write access to the repository.
|
||||
Download artifacts with the specified name (default: `bottles`).
|
||||
* `--archive-item`:
|
||||
Upload to the specified Internet Archive item (default: `homebrew`).
|
||||
* `--bintray-org`:
|
||||
Upload to the specified Bintray organisation (default: `homebrew`).
|
||||
* `--tap`:
|
||||
Target tap repository (default: `homebrew/core`).
|
||||
* `--root-url`:
|
||||
Use the specified *`URL`* as the root of the bottle's URL instead of Homebrew's default.
|
||||
* `--root-url-using`:
|
||||
Use the specified download strategy class for downloading the bottle's URL instead of Homebrew's default.
|
||||
* `--bintray-mirror`:
|
||||
Use the specified Bintray repository to automatically mirror stable URLs defined in the formulae (default: `mirror`).
|
||||
* `--workflows`:
|
||||
Retrieve artifacts from the specified workflow (default: `tests.yml`). Can be a comma-separated list to include multiple workflows.
|
||||
* `--ignore-missing-artifacts`:
|
||||
@ -1218,8 +1214,6 @@ Apply the bottle commit and publish bottles to a host.
|
||||
Specify a committer name and email in `git`'s standard author format.
|
||||
* `--archive-item`:
|
||||
Upload to the specified Internet Archive item (default: `homebrew`).
|
||||
* `--bintray-org`:
|
||||
Upload to the specified Bintray organisation (default: `homebrew`).
|
||||
* `--github-org`:
|
||||
Upload to the specified GitHub organisation's GitHub Packages (default: `homebrew`).
|
||||
* `--root-url`:
|
||||
@ -1805,12 +1799,6 @@ example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just
|
||||
|
||||
*Default:* `$HOME/.bat/config`.
|
||||
|
||||
- `HOMEBREW_BINTRAY_KEY`
|
||||
<br>Use this API key when accessing the Bintray API (where bottles are stored).
|
||||
|
||||
- `HOMEBREW_BINTRAY_USER`
|
||||
<br>Use this username when accessing the Bintray API (where bottles are stored).
|
||||
|
||||
- `HOMEBREW_BOOTSNAP`
|
||||
<br>If set, use Bootsnap to speed up repeated `brew` calls. A no-op when using Homebrew's vendored, relocatable Ruby on macOS (as it doesn't work).
|
||||
|
||||
|
||||
@ -1449,7 +1449,7 @@ Dispatch specified workflow (default: \fBdispatch\-build\-bottle\.yml\fR)\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-upload\fR
|
||||
Upload built bottles to Bintray\.
|
||||
Upload built bottles\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-linux\fR
|
||||
@ -1668,10 +1668,6 @@ Download artifacts with the specified name (default: \fBbottles\fR)\.
|
||||
Upload to the specified Internet Archive item (default: \fBhomebrew\fR)\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-bintray\-org\fR
|
||||
Upload to the specified Bintray organisation (default: \fBhomebrew\fR)\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-tap\fR
|
||||
Target tap repository (default: \fBhomebrew/core\fR)\.
|
||||
.
|
||||
@ -1684,10 +1680,6 @@ Use the specified \fIURL\fR as the root of the bottle\'s URL instead of Homebrew
|
||||
Use the specified download strategy class for downloading the bottle\'s URL instead of Homebrew\'s default\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-bintray\-mirror\fR
|
||||
Use the specified Bintray repository to automatically mirror stable URLs defined in the formulae (default: \fBmirror\fR)\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-workflows\fR
|
||||
Retrieve artifacts from the specified workflow (default: \fBtests\.yml\fR)\. Can be a comma\-separated list to include multiple workflows\.
|
||||
.
|
||||
@ -1727,10 +1719,6 @@ Specify a committer name and email in \fBgit\fR\'s standard author format\.
|
||||
Upload to the specified Internet Archive item (default: \fBhomebrew\fR)\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-bintray\-org\fR
|
||||
Upload to the specified Bintray organisation (default: \fBhomebrew\fR)\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-github\-org\fR
|
||||
Upload to the specified GitHub organisation\'s GitHub Packages (default: \fBhomebrew\fR)\.
|
||||
.
|
||||
@ -2519,18 +2507,6 @@ Use this as the \fBbat\fR configuration file\.
|
||||
\fIDefault:\fR \fB$HOME/\.bat/config\fR\.
|
||||
.
|
||||
.TP
|
||||
\fBHOMEBREW_BINTRAY_KEY\fR
|
||||
.
|
||||
.br
|
||||
Use this API key when accessing the Bintray API (where bottles are stored)\.
|
||||
.
|
||||
.TP
|
||||
\fBHOMEBREW_BINTRAY_USER\fR
|
||||
.
|
||||
.br
|
||||
Use this username when accessing the Bintray API (where bottles are stored)\.
|
||||
.
|
||||
.TP
|
||||
\fBHOMEBREW_BOOTSNAP\fR
|
||||
.
|
||||
.br
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user