mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Use --
for bottles.
This commit is contained in:
parent
54a9f687df
commit
d33241bc11
@ -391,7 +391,7 @@ module Homebrew
|
|||||||
"rebuild" => bottle.rebuild,
|
"rebuild" => bottle.rebuild,
|
||||||
"tags" => {
|
"tags" => {
|
||||||
tag => {
|
tag => {
|
||||||
"filename" => filename.to_s,
|
"filename" => filename.bintray,
|
||||||
"sha256" => sha256,
|
"sha256" => sha256,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -402,7 +402,7 @@ module Homebrew
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
File.open("#{filename.prefix}.bottle.json", "w") do |file|
|
File.open(filename.json, "w") do |file|
|
||||||
file.write JSON.generate json
|
file.write JSON.generate json
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1617,7 +1617,7 @@ class Formula
|
|||||||
bottle_spec.collector.keys.each do |os|
|
bottle_spec.collector.keys.each do |os|
|
||||||
checksum = bottle_spec.collector[os]
|
checksum = bottle_spec.collector[os]
|
||||||
bottle_info["files"][os] = {
|
bottle_info["files"][os] = {
|
||||||
"url" => "#{bottle_spec.root_url}/#{Bottle::Filename.create(self, os, bottle_spec.rebuild)}",
|
"url" => "#{bottle_spec.root_url}/#{Bottle::Filename.create(self, os, bottle_spec.rebuild).bintray}",
|
||||||
checksum.hash_type.to_s => checksum.hexdigest,
|
checksum.hash_type.to_s => checksum.hexdigest,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -259,17 +259,21 @@ class Bottle
|
|||||||
end
|
end
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
prefix + suffix
|
"#{name}--#{version}#{extname}"
|
||||||
end
|
end
|
||||||
alias to_str to_s
|
alias to_str to_s
|
||||||
|
|
||||||
def prefix
|
def json
|
||||||
"#{name}-#{version}.#{tag}"
|
"#{name}--#{version}.#{tag}.bottle.json"
|
||||||
end
|
end
|
||||||
|
|
||||||
def suffix
|
def bintray
|
||||||
|
"#{name}-#{version}#{extname}"
|
||||||
|
end
|
||||||
|
|
||||||
|
def extname
|
||||||
s = rebuild.positive? ? ".#{rebuild}" : ""
|
s = rebuild.positive? ? ".#{rebuild}" : ""
|
||||||
".bottle#{s}.tar.gz"
|
".#{tag}.bottle#{s}.tar.gz"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -290,7 +294,7 @@ class Bottle
|
|||||||
checksum, tag = spec.checksum_for(Utils::Bottles.tag)
|
checksum, tag = spec.checksum_for(Utils::Bottles.tag)
|
||||||
|
|
||||||
filename = Filename.create(formula, tag, spec.rebuild)
|
filename = Filename.create(formula, tag, spec.rebuild)
|
||||||
@resource.url(build_url(spec.root_url, filename),
|
@resource.url(build_url(spec.root_url, filename.bintray),
|
||||||
select_download_strategy(spec.root_url_specs))
|
select_download_strategy(spec.root_url_specs))
|
||||||
@resource.version = formula.pkg_version
|
@resource.version = formula.pkg_version
|
||||||
@resource.checksum = checksum
|
@resource.checksum = checksum
|
||||||
|
@ -2,36 +2,53 @@ require "formula"
|
|||||||
require "software_spec"
|
require "software_spec"
|
||||||
|
|
||||||
describe Bottle::Filename do
|
describe Bottle::Filename do
|
||||||
specify "#prefix" do
|
subject { described_class.new(name, version, tag, rebuild) }
|
||||||
expect(described_class.new("foo", "1.0", :tag, 0).prefix)
|
|
||||||
.to eq("foo-1.0.tag")
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "#suffix" do
|
let(:name) { "foo" }
|
||||||
expect(described_class.new("foo", "1.0", :tag, 0).suffix)
|
let(:version) { "1.0" }
|
||||||
.to eq(".bottle.tar.gz")
|
let(:tag) { :tag }
|
||||||
|
let(:rebuild) { 0 }
|
||||||
|
|
||||||
expect(described_class.new("foo", "1.0", :tag, 1).suffix)
|
describe "#extname" do
|
||||||
.to eq(".bottle.1.tar.gz")
|
its(:extname) { is_expected.to eq ".tag.bottle.tar.gz" }
|
||||||
end
|
|
||||||
|
|
||||||
specify "#to_s and #to_str" do
|
context "when rebuild is 0" do
|
||||||
expected = "foo-1.0.tag.bottle.tar.gz"
|
its(:extname) { is_expected.to eq ".tag.bottle.tar.gz" }
|
||||||
|
|
||||||
expect(described_class.new("foo", "1.0", :tag, 0).to_s)
|
|
||||||
.to eq(expected)
|
|
||||||
|
|
||||||
expect(described_class.new("foo", "1.0", :tag, 0).to_str)
|
|
||||||
.to eq(expected)
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "::create" do
|
|
||||||
f = formula do
|
|
||||||
url "https://example.com/foo.tar.gz"
|
|
||||||
version "1.0"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
expect(described_class.create(f, :tag, 0).to_s)
|
context "when rebuild is 1" do
|
||||||
.to eq("formula_name-1.0.tag.bottle.tar.gz")
|
let(:rebuild) { 1 }
|
||||||
|
its(:extname) { is_expected.to eq ".tag.bottle.1.tar.gz" }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "#to_s and #to_str" do
|
||||||
|
its(:to_s) { is_expected.to eq "foo--1.0.tag.bottle.tar.gz" }
|
||||||
|
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" }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "#json" do
|
||||||
|
its(:json) { is_expected.to eq "foo--1.0.tag.bottle.json" }
|
||||||
|
|
||||||
|
context "when rebuild is 1" do
|
||||||
|
its(:json) { is_expected.to eq "foo--1.0.tag.bottle.json" }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "::create" do
|
||||||
|
subject { described_class.create(f, :tag, 0) }
|
||||||
|
|
||||||
|
let(:f) {
|
||||||
|
formula do
|
||||||
|
url "https://example.com/foo.tar.gz"
|
||||||
|
version "1.0"
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
its(:to_s) { is_expected.to eq "formula_name--1.0.tag.bottle.tar.gz" }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -21,11 +21,11 @@ describe "brew bottle", :integration_test do
|
|||||||
end
|
end
|
||||||
|
|
||||||
expect { brew "bottle", "--no-rebuild", "testball" }
|
expect { brew "bottle", "--no-rebuild", "testball" }
|
||||||
.to output(/testball-0\.1.*\.bottle\.tar\.gz/).to_stdout
|
.to output(/testball--0\.1.*\.bottle\.tar\.gz/).to_stdout
|
||||||
.and not_to_output.to_stderr
|
.and not_to_output.to_stderr
|
||||||
.and be_a_success
|
.and be_a_success
|
||||||
ensure
|
ensure
|
||||||
FileUtils.rm_f Dir.glob("testball-0.1*.bottle.tar.gz")
|
FileUtils.rm_f Dir.glob("testball--0.1*.bottle.tar.gz")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user