mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Rename bottle's revision to rebuild.
This commit is contained in:
parent
5c7c9de669
commit
27ecf588c7
@ -20,8 +20,8 @@ BOTTLE_ERB = <<-EOS
|
|||||||
<% elsif cellar != BottleSpecification::DEFAULT_CELLAR %>
|
<% elsif cellar != BottleSpecification::DEFAULT_CELLAR %>
|
||||||
cellar "<%= cellar %>"
|
cellar "<%= cellar %>"
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if revision > 0 %>
|
<% if rebuild > 0 %>
|
||||||
revision <%= revision %>
|
rebuild <%= rebuild %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% checksums.each do |checksum_type, checksum_values| %>
|
<% checksums.each do |checksum_type, checksum_values| %>
|
||||||
<% checksum_values.each do |checksum_value| %>
|
<% checksum_values.each do |checksum_value| %>
|
||||||
@ -148,19 +148,19 @@ module Homebrew
|
|||||||
return ofail "Formula has no stable version: #{f.full_name}"
|
return ofail "Formula has no stable version: #{f.full_name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
if ARGV.include? "--no-revision"
|
if ARGV.include? "--no-rebuild"
|
||||||
bottle_revision = 0
|
rebuild = 0
|
||||||
elsif ARGV.include? "--keep-old"
|
elsif ARGV.include? "--keep-old"
|
||||||
bottle_revision = f.bottle_specification.revision
|
rebuild = f.bottle_specification.rebuild
|
||||||
else
|
else
|
||||||
ohai "Determining #{f.full_name} bottle revision..."
|
ohai "Determining #{f.full_name} bottle rebuild..."
|
||||||
versions = FormulaVersions.new(f)
|
versions = FormulaVersions.new(f)
|
||||||
bottle_revisions = versions.bottle_version_map("origin/master")[f.pkg_version]
|
rebuilds = versions.bottle_version_map("origin/master")[f.pkg_version]
|
||||||
bottle_revisions.pop if bottle_revisions.last.to_i > 0
|
rebuilds.pop if rebuilds.last.to_i > 0
|
||||||
bottle_revision = bottle_revisions.empty? ? 0 : bottle_revisions.max.to_i + 1
|
rebuild = rebuilds.empty? ? 0 : rebuilds.max.to_i + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
filename = Bottle::Filename.create(f, Utils::Bottles.tag, bottle_revision)
|
filename = Bottle::Filename.create(f, Utils::Bottles.tag, rebuild)
|
||||||
bottle_path = Pathname.pwd/filename
|
bottle_path = Pathname.pwd/filename
|
||||||
|
|
||||||
tar_filename = filename.to_s.sub(/.gz$/, "")
|
tar_filename = filename.to_s.sub(/.gz$/, "")
|
||||||
@ -277,13 +277,13 @@ module Homebrew
|
|||||||
bottle.cellar cellar
|
bottle.cellar cellar
|
||||||
bottle.prefix prefix
|
bottle.prefix prefix
|
||||||
end
|
end
|
||||||
bottle.revision bottle_revision
|
bottle.rebuild rebuild
|
||||||
sha256 = bottle_path.sha256
|
sha256 = bottle_path.sha256
|
||||||
bottle.sha256 sha256 => Utils::Bottles.tag
|
bottle.sha256 sha256 => Utils::Bottles.tag
|
||||||
|
|
||||||
old_spec = f.bottle_specification
|
old_spec = f.bottle_specification
|
||||||
if ARGV.include?("--keep-old") && !old_spec.checksums.empty?
|
if ARGV.include?("--keep-old") && !old_spec.checksums.empty?
|
||||||
bad_fields = [:root_url, :prefix, :cellar, :revision].select do |field|
|
bad_fields = [:root_url, :prefix, :cellar, :rebuild].select do |field|
|
||||||
old_spec.send(field) != bottle.send(field)
|
old_spec.send(field) != bottle.send(field)
|
||||||
end
|
end
|
||||||
bad_fields.delete(:cellar) if old_spec.cellar == :any && bottle.cellar == :any_skip_relocation
|
bad_fields.delete(:cellar) if old_spec.cellar == :any && bottle.cellar == :any_skip_relocation
|
||||||
@ -309,7 +309,7 @@ module Homebrew
|
|||||||
"root_url" => bottle.root_url,
|
"root_url" => bottle.root_url,
|
||||||
"prefix" => bottle.prefix,
|
"prefix" => bottle.prefix,
|
||||||
"cellar" => bottle.cellar.to_s,
|
"cellar" => bottle.cellar.to_s,
|
||||||
"revision" => bottle.revision,
|
"rebuild" => bottle.rebuild,
|
||||||
"tags" => {
|
"tags" => {
|
||||||
Utils::Bottles.tag.to_s => {
|
Utils::Bottles.tag.to_s => {
|
||||||
"filename" => filename.to_s,
|
"filename" => filename.to_s,
|
||||||
@ -347,7 +347,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
bottle.cellar cellar
|
bottle.cellar cellar
|
||||||
bottle.prefix bottle_hash["bottle"]["prefix"]
|
bottle.prefix bottle_hash["bottle"]["prefix"]
|
||||||
bottle.revision bottle_hash["bottle"]["revision"]
|
bottle.rebuild bottle_hash["bottle"]["rebuild"]
|
||||||
bottle_hash["bottle"]["tags"].each do |tag, tag_hash|
|
bottle_hash["bottle"]["tags"].each do |tag, tag_hash|
|
||||||
bottle.sha256 tag_hash["sha256"] => tag.to_sym
|
bottle.sha256 tag_hash["sha256"] => tag.to_sym
|
||||||
end
|
end
|
||||||
@ -368,7 +368,7 @@ module Homebrew
|
|||||||
line = line.strip
|
line = line.strip
|
||||||
next if line.empty?
|
next if line.empty?
|
||||||
key, value, _, tag = line.split " ", 4
|
key, value, _, tag = line.split " ", 4
|
||||||
valid_key = %w[root_url prefix cellar revision sha1 sha256].include? key
|
valid_key = %w[root_url prefix cellar rebuild sha1 sha256].include? key
|
||||||
next unless valid_key
|
next unless valid_key
|
||||||
|
|
||||||
value = value.to_s.delete ":'\""
|
value = value.to_s.delete ":'\""
|
||||||
@ -414,7 +414,7 @@ module Homebrew
|
|||||||
(\n^\ {3}[\S\ ]+$)* # options can be in multiple lines
|
(\n^\ {3}[\S\ ]+$)* # options can be in multiple lines
|
||||||
)?|
|
)?|
|
||||||
(homepage|desc|sha1|sha256|version|mirror)\ ['"][\S\ ]+['"]| # specs with a string
|
(homepage|desc|sha1|sha256|version|mirror)\ ['"][\S\ ]+['"]| # specs with a string
|
||||||
revision\ \d+ # revision with a number
|
rebuild\ \d+ # rebuild with a number
|
||||||
)\n+ # multiple empty lines
|
)\n+ # multiple empty lines
|
||||||
)+
|
)+
|
||||||
/mx, '\0' + output + "\n")
|
/mx, '\0' + output + "\n")
|
||||||
|
@ -14,3 +14,4 @@ require "compat/pathname"
|
|||||||
require "compat/dependency_collector"
|
require "compat/dependency_collector"
|
||||||
require "compat/language/haskell"
|
require "compat/language/haskell"
|
||||||
require "compat/xcode"
|
require "compat/xcode"
|
||||||
|
require "compat/software_spec"
|
||||||
|
8
Library/Homebrew/compat/software_spec.rb
Normal file
8
Library/Homebrew/compat/software_spec.rb
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
class BottleSpecification
|
||||||
|
def revision(*args)
|
||||||
|
# Don't announce deprecation yet as this is quite a big change
|
||||||
|
# to a public interface.
|
||||||
|
# odeprecated "BottleSpecification.revision", "BottleSpecification.rebuild"
|
||||||
|
rebuild(*args)
|
||||||
|
end
|
||||||
|
end
|
@ -952,7 +952,7 @@ module Homebrew
|
|||||||
# Tap repository if required, this is done before everything else
|
# Tap repository if required, this is done before everything else
|
||||||
# because Formula parsing and/or git commit hash lookup depends on it.
|
# because Formula parsing and/or git commit hash lookup depends on it.
|
||||||
# At the same time, make sure Tap is not a shallow clone.
|
# At the same time, make sure Tap is not a shallow clone.
|
||||||
# bottle revision and bottle upload rely on full clone.
|
# bottle rebuild and bottle upload rely on full clone.
|
||||||
safe_system "brew", "tap", tap.name, "--full" if tap
|
safe_system "brew", "tap", tap.name, "--full" if tap
|
||||||
|
|
||||||
if ARGV.include? "--ci-upload"
|
if ARGV.include? "--ci-upload"
|
||||||
|
@ -1330,7 +1330,7 @@ class Formula
|
|||||||
next unless spec.bottle_defined?
|
next unless spec.bottle_defined?
|
||||||
bottle_spec = spec.bottle_specification
|
bottle_spec = spec.bottle_specification
|
||||||
bottle_info = {
|
bottle_info = {
|
||||||
"revision" => bottle_spec.revision,
|
"rebuild" => bottle_spec.rebuild,
|
||||||
"cellar" => (cellar = bottle_spec.cellar).is_a?(Symbol) ? \
|
"cellar" => (cellar = bottle_spec.cellar).is_a?(Symbol) ? \
|
||||||
cellar.inspect : cellar,
|
cellar.inspect : cellar,
|
||||||
"prefix" => bottle_spec.prefix,
|
"prefix" => bottle_spec.prefix,
|
||||||
@ -1340,7 +1340,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.revision)}",
|
"url" => "#{bottle_spec.root_url}/#{Bottle::Filename.create(self, os, bottle_spec.rebuild)}",
|
||||||
checksum.hash_type.to_s => checksum.hexdigest,
|
checksum.hash_type.to_s => checksum.hexdigest,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@ -1789,7 +1789,7 @@ class Formula
|
|||||||
# root_url "https://example.com" # Optional root to calculate bottle URLs
|
# root_url "https://example.com" # Optional root to calculate bottle URLs
|
||||||
# prefix "/opt/homebrew" # Optional HOMEBREW_PREFIX in which the bottles were built.
|
# prefix "/opt/homebrew" # Optional HOMEBREW_PREFIX in which the bottles were built.
|
||||||
# cellar "/opt/homebrew/Cellar" # Optional HOMEBREW_CELLAR in which the bottles were built.
|
# cellar "/opt/homebrew/Cellar" # Optional HOMEBREW_CELLAR in which the bottles were built.
|
||||||
# revision 1 # Making the old bottle outdated without bumping the version/revision of the formula.
|
# rebuild 1 # Making the old bottle outdated without bumping the version/revision of the formula.
|
||||||
# sha256 "4355a46b19d348dc2f57c046f8ef63d4538ebb936000f3c9ee954a27460dd865" => :el_capitan
|
# sha256 "4355a46b19d348dc2f57c046f8ef63d4538ebb936000f3c9ee954a27460dd865" => :el_capitan
|
||||||
# sha256 "53c234e5e8472b6ac51c1ae1cab3fe06fad053beb8ebfd8977b010655bfdd3c3" => :yosemite
|
# sha256 "53c234e5e8472b6ac51c1ae1cab3fe06fad053beb8ebfd8977b010655bfdd3c3" => :yosemite
|
||||||
# sha256 "1121cfccd5913f0a63fec40a6ffd44ea64f9dc135c66634ba001d10bcf4302a2" => :mavericks
|
# sha256 "1121cfccd5913f0a63fec40a6ffd44ea64f9dc135c66634ba001d10bcf4302a2" => :mavericks
|
||||||
|
@ -53,7 +53,7 @@ class FormulaVersions
|
|||||||
formula_at_revision(rev) do |f|
|
formula_at_revision(rev) do |f|
|
||||||
bottle = f.bottle_specification
|
bottle = f.bottle_specification
|
||||||
unless bottle.checksums.empty?
|
unless bottle.checksums.empty?
|
||||||
map[f.pkg_version] << bottle.revision
|
map[f.pkg_version] << bottle.rebuild
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -214,17 +214,17 @@ end
|
|||||||
|
|
||||||
class Bottle
|
class Bottle
|
||||||
class Filename
|
class Filename
|
||||||
attr_reader :name, :version, :tag, :revision
|
attr_reader :name, :version, :tag, :rebuild
|
||||||
|
|
||||||
def self.create(formula, tag, revision)
|
def self.create(formula, tag, rebuild)
|
||||||
new(formula.name, formula.pkg_version, tag, revision)
|
new(formula.name, formula.pkg_version, tag, rebuild)
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(name, version, tag, revision)
|
def initialize(name, version, tag, rebuild)
|
||||||
@name = name
|
@name = name
|
||||||
@version = version
|
@version = version
|
||||||
@tag = tag
|
@tag = tag
|
||||||
@revision = revision
|
@rebuild = rebuild
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
@ -237,14 +237,14 @@ class Bottle
|
|||||||
end
|
end
|
||||||
|
|
||||||
def suffix
|
def suffix
|
||||||
s = revision > 0 ? ".#{revision}" : ""
|
s = rebuild > 0 ? ".#{rebuild}" : ""
|
||||||
".bottle#{s}.tar.gz"
|
".bottle#{s}.tar.gz"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
extend Forwardable
|
extend Forwardable
|
||||||
|
|
||||||
attr_reader :name, :resource, :prefix, :cellar, :revision
|
attr_reader :name, :resource, :prefix, :cellar, :rebuild
|
||||||
|
|
||||||
def_delegators :resource, :url, :fetch, :verify_download_integrity
|
def_delegators :resource, :url, :fetch, :verify_download_integrity
|
||||||
def_delegators :resource, :cached_download, :clear_cache
|
def_delegators :resource, :cached_download, :clear_cache
|
||||||
@ -257,14 +257,14 @@ class Bottle
|
|||||||
|
|
||||||
checksum, tag = spec.checksum_for(Utils::Bottles.tag)
|
checksum, tag = spec.checksum_for(Utils::Bottles.tag)
|
||||||
|
|
||||||
filename = Filename.create(formula, tag, spec.revision)
|
filename = Filename.create(formula, tag, spec.rebuild)
|
||||||
@resource.url(build_url(spec.root_url, filename))
|
@resource.url(build_url(spec.root_url, filename))
|
||||||
@resource.download_strategy = CurlBottleDownloadStrategy
|
@resource.download_strategy = CurlBottleDownloadStrategy
|
||||||
@resource.version = formula.pkg_version
|
@resource.version = formula.pkg_version
|
||||||
@resource.checksum = checksum
|
@resource.checksum = checksum
|
||||||
@prefix = spec.prefix
|
@prefix = spec.prefix
|
||||||
@cellar = spec.cellar
|
@cellar = spec.cellar
|
||||||
@revision = spec.revision
|
@rebuild = spec.rebuild
|
||||||
end
|
end
|
||||||
|
|
||||||
def compatible_cellar?
|
def compatible_cellar?
|
||||||
@ -292,12 +292,12 @@ class BottleSpecification
|
|||||||
DEFAULT_CELLAR = "/usr/local/Cellar".freeze
|
DEFAULT_CELLAR = "/usr/local/Cellar".freeze
|
||||||
DEFAULT_DOMAIN = (ENV["HOMEBREW_BOTTLE_DOMAIN"] || "https://homebrew.bintray.com").freeze
|
DEFAULT_DOMAIN = (ENV["HOMEBREW_BOTTLE_DOMAIN"] || "https://homebrew.bintray.com").freeze
|
||||||
|
|
||||||
attr_rw :prefix, :cellar, :revision
|
attr_rw :prefix, :cellar, :rebuild
|
||||||
attr_accessor :tap
|
attr_accessor :tap
|
||||||
attr_reader :checksum, :collector
|
attr_reader :checksum, :collector
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@revision = 0
|
@rebuild = 0
|
||||||
@prefix = DEFAULT_PREFIX
|
@prefix = DEFAULT_PREFIX
|
||||||
@cellar = DEFAULT_CELLAR
|
@cellar = DEFAULT_CELLAR
|
||||||
@collector = Utils::Bottles::Collector.new
|
@collector = Utils::Bottles::Collector.new
|
||||||
|
@ -3,8 +3,8 @@ require "formula"
|
|||||||
require "software_spec"
|
require "software_spec"
|
||||||
|
|
||||||
class BottleFilenameTests < Homebrew::TestCase
|
class BottleFilenameTests < Homebrew::TestCase
|
||||||
def fn(revision)
|
def fn(rebuild)
|
||||||
Bottle::Filename.new("foo", "1.0", :tag, revision)
|
Bottle::Filename.new("foo", "1.0", :tag, rebuild)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_prefix_suffix
|
def test_prefix_suffix
|
||||||
|
@ -288,7 +288,7 @@ class IntegrationCommandTests < Homebrew::TestCase
|
|||||||
def test_bottle
|
def test_bottle
|
||||||
cmd("install", "--build-bottle", testball)
|
cmd("install", "--build-bottle", testball)
|
||||||
assert_match "Formula not from core or any taps",
|
assert_match "Formula not from core or any taps",
|
||||||
cmd_fail("bottle", "--no-revision", testball)
|
cmd_fail("bottle", "--no-rebuild", testball)
|
||||||
|
|
||||||
setup_test_formula "testball"
|
setup_test_formula "testball"
|
||||||
|
|
||||||
@ -298,7 +298,7 @@ class IntegrationCommandTests < Homebrew::TestCase
|
|||||||
FileUtils.ln_s "not-exist", "symlink"
|
FileUtils.ln_s "not-exist", "symlink"
|
||||||
end
|
end
|
||||||
assert_match(/testball-0\.1.*\.bottle\.tar\.gz/,
|
assert_match(/testball-0\.1.*\.bottle\.tar\.gz/,
|
||||||
cmd_output("bottle", "--no-revision", "testball"))
|
cmd_output("bottle", "--no-rebuild", "testball"))
|
||||||
ensure
|
ensure
|
||||||
FileUtils.rm_f Dir["testball-0.1*.bottle.tar.gz"]
|
FileUtils.rm_f Dir["testball-0.1*.bottle.tar.gz"]
|
||||||
end
|
end
|
||||||
|
@ -173,7 +173,7 @@ class BottleSpecificationTests < Homebrew::TestCase
|
|||||||
|
|
||||||
def test_other_setters
|
def test_other_setters
|
||||||
double = Object.new
|
double = Object.new
|
||||||
%w[root_url prefix cellar revision].each do |method|
|
%w[root_url prefix cellar rebuild].each do |method|
|
||||||
@spec.send(method, double)
|
@spec.send(method, double)
|
||||||
assert_equal double, @spec.send(method)
|
assert_equal double, @spec.send(method)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user