More Bintray cleanup

Cleanup more files and names related to Bintray to ease their future
deletion (when Bintray is shutdown).
This commit is contained in:
Mike McQuaid 2021-04-12 14:48:58 +01:00
parent ccb05e5e0b
commit 1bdb8c7a33
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
7 changed files with 27 additions and 50 deletions

View File

@ -9,6 +9,8 @@ require "formula_versions"
require "cli/parser"
require "utils/inreplace"
require "erb"
require "archive"
require "bintray"
BOTTLE_ERB = <<-EOS
bottle do
@ -510,7 +512,7 @@ module Homebrew
bottle_filename = if bottle.root_url.match?(GitHubPackages::URL_REGEX)
filename.github_packages
else
filename.bintray
filename.url_encode
end
json = {
@ -546,12 +548,18 @@ module Homebrew
},
},
},
"bintray" => {
"package" => Utils::Bottles::Bintray.package(f.name),
"repository" => Utils::Bottles::Bintray.repository(tap),
},
},
}
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
File.open(filename.json, "w") do |file|
file.write JSON.pretty_generate json
end

View File

@ -31,7 +31,7 @@ module Homebrew
def mirror
args = mirror_args.parse
odeprecated "brew mirror"
odeprecated "brew mirror (Bintray will be shut down on 1st May 2021)"
bintray_org = args.bintray_org || "homebrew"
bintray_repo = args.bintray_repo || "mirror"

View File

@ -152,6 +152,8 @@ module Homebrew
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,

View File

@ -277,7 +277,7 @@ class Bottle
"#{name}--#{version}.#{tag}.bottle.json"
end
def bintray
def url_encode
ERB::Util.url_encode("#{name}-#{version}#{extname}")
end
@ -437,8 +437,10 @@ class BottleSpecification
if var.nil?
@root_url ||= if (github_packages_url = GitHubPackages.root_url_if_match(Homebrew::EnvConfig.bottle_domain))
github_packages_url
else
elsif Homebrew::EnvConfig.bottle_domain.match?(Bintray::URL_REGEX)
"#{Homebrew::EnvConfig.bottle_domain}/#{Utils::Bottles::Bintray.repository(tap)}"
else
Homebrew::EnvConfig.bottle_domain
end
else
@root_url = if (github_packages_url = GitHubPackages.root_url_if_match(var))
@ -455,8 +457,7 @@ class BottleSpecification
image_name = GitHubPackages.image_formula_name(name)
["#{image_name}/blobs/sha256:#{checksum}", filename&.github_packages]
else
# TODO: this can be removed when we no longer use Bintray
filename&.bintray
filename&.url_encode
end
end

View File

@ -1,32 +0,0 @@
# typed: false
# frozen_string_literal: true
require "bintray"
describe Bintray, :needs_network do
subject(:bintray) { described_class.new(org: "homebrew") }
before do
ENV["HOMEBREW_BINTRAY_USER"] = "BrewTestBot"
ENV["HOMEBREW_BINTRAY_KEY"] = "deadbeef"
end
describe "::remote_checksum" do
it "detects a published file" do
hash = bintray.remote_checksum(repo: "bottles", remote_file: "hello-2.10.catalina.bottle.tar.gz")
expect(hash).to eq("449de5ea35d0e9431f367f1bb34392e450f6853cdccdc6bd04e6ad6471904ddb")
end
it "fails on a non-existent file" do
hash = bintray.remote_checksum(repo: "bottles", remote_file: "my-fake-bottle-1.0.snow_hyena.tar.gz")
expect(hash).to be nil
end
end
describe "::package_exists?" do
it "detects a package" do
results = bintray.package_exists?(repo: "bottles", package: "hello")
expect(results).to be true
end
end
end

View File

@ -31,8 +31,12 @@ describe Bottle::Filename do
its(:to_str) { is_expected.to eq "foo--1.0.tag.bottle.tar.gz" }
end
describe "#bintray" do
its(:bintray) { is_expected.to eq "foo-1.0.tag.bottle.tar.gz" }
describe "#url_encode" do
its(:url_encode) { is_expected.to eq "foo-1.0.tag.bottle.tar.gz" }
end
describe "#github_packages" do
its(:github_packages) { is_expected.to eq "foo--1.0.tag.bottle.tar.gz" }
end
describe "#json" do

View File

@ -94,9 +94,3 @@ eval $(~/.linuxbrew/bin/brew shellenv)
- [@HomebrewOnLinux on Twitter](https://twitter.com/HomebrewOnLinux)
- [Homebrew/linuxbrew-core on GitHub](https://github.com/Homebrew/linuxbrew-core)
- [Homebrew/discussions (forum)](https://github.com/homebrew/discussions/discussions)
## Sponsors
Our binary packages (bottles) are built on [GitHub Actions](https://github.com/features/actions) and hosted by [Bintray](https://bintray.com/linuxbrew).
[![Downloads by Bintray](https://bintray.com/docs/images/downloads_by_bintray_96.png)](https://bintray.com/linuxbrew)