Version bottles.
This commit is contained in:
parent
bb8fcc8901
commit
a947064994
@ -1,8 +1,12 @@
|
||||
require 'tab'
|
||||
require 'extend/ARGV'
|
||||
|
||||
def bottle_filename f
|
||||
"#{f.name}-#{f.version}#{bottle_native_suffix}"
|
||||
def bottle_filename f, bottle_version=nil
|
||||
name = f.name.downcase
|
||||
version = f.version || f.standard.detect_version
|
||||
bottle_version = bottle_version || f.bottle_version
|
||||
bottle_version_tag = bottle_version > 0 ? "-#{bottle_version}" : ""
|
||||
"#{name}-#{version}#{bottle_version_tag}#{bottle_native_suffix}"
|
||||
end
|
||||
|
||||
def bottles_supported?
|
||||
@ -21,6 +25,11 @@ def bottle_current? f
|
||||
f.bottle_url && f.bottle_sha1 && Pathname.new(f.bottle_url).version == f.version
|
||||
end
|
||||
|
||||
def bottle_new_version f
|
||||
return 0 unless f.bottle_version
|
||||
f.bottle_version + 1
|
||||
end
|
||||
|
||||
def bottle_native_suffix
|
||||
".#{MacOS.cat}#{bottle_suffix}"
|
||||
end
|
||||
@ -30,11 +39,11 @@ def bottle_suffix
|
||||
end
|
||||
|
||||
def bottle_native_regex
|
||||
/(\.#{MacOS.cat}\.bottle\.tar\.gz)$/
|
||||
/((-\d+)?\.#{MacOS.cat}\.bottle\.tar\.gz)$/
|
||||
end
|
||||
|
||||
def bottle_regex
|
||||
/(\.[a-z]+\.bottle\.tar\.gz)$/
|
||||
/((-\d+)?\.[a-z]+\.bottle\.tar\.gz)$/
|
||||
end
|
||||
|
||||
def old_bottle_regex
|
||||
|
||||
@ -16,7 +16,8 @@ module Homebrew extend self
|
||||
end
|
||||
|
||||
directory = Pathname.pwd
|
||||
filename = bottle_filename f
|
||||
bottle_version = bottle_new_version f
|
||||
filename = bottle_filename f, bottle_version
|
||||
|
||||
HOMEBREW_CELLAR.cd do
|
||||
ohai "Bottling #{f.name} #{f.version}..."
|
||||
@ -25,6 +26,7 @@ module Homebrew extend self
|
||||
safe_system 'tar', 'czf', directory/filename, "#{f.name}/#{f.version}"
|
||||
puts "./#{filename}"
|
||||
puts "bottle do"
|
||||
puts " version #{bottle_version}" if bottle_version > 0
|
||||
puts " sha1 '#{(directory/filename).sha1}' => :#{MacOS.cat}"
|
||||
puts "end"
|
||||
end
|
||||
|
||||
@ -194,8 +194,7 @@ class CurlBottleDownloadStrategy < CurlDownloadStrategy
|
||||
@tarball_path = HOMEBREW_CACHE/"#{name}-#{version}#{ext}"
|
||||
|
||||
unless @tarball_path.exist?
|
||||
old_bottle_path = HOMEBREW_CACHE/"#{name}-#{version}#{bottle_suffix}"
|
||||
old_bottle_path = HOMEBREW_CACHE/"#{name}-#{version}-bottle.tar.gz" unless old_bottle_path.exist?
|
||||
old_bottle_path = HOMEBREW_CACHE/"#{name}-#{version}-bottle.tar.gz"
|
||||
old_bottle_path = HOMEBREW_CACHE/"#{name}-#{version}.#{MacOS.cat}.bottle-bottle.tar.gz" unless old_bottle_path.exist?
|
||||
FileUtils.mv old_bottle_path, @tarball_path if old_bottle_path.exist?
|
||||
end
|
||||
|
||||
@ -12,8 +12,8 @@ class Formula
|
||||
include FileUtils
|
||||
|
||||
attr_reader :name, :path, :url, :version, :homepage, :specs, :downloader
|
||||
attr_reader :standard, :unstable
|
||||
attr_reader :bottle_url, :bottle_sha1, :head
|
||||
attr_reader :standard, :unstable, :head
|
||||
attr_reader :bottle_version, :bottle_url, :bottle_sha1
|
||||
|
||||
# The build folder, usually in /tmp.
|
||||
# Will only be non-nil during the stage method.
|
||||
@ -23,6 +23,7 @@ class Formula
|
||||
def initialize name='__UNKNOWN__', path=nil
|
||||
set_instance_variable 'homepage'
|
||||
set_instance_variable 'url'
|
||||
set_instance_variable 'bottle_version'
|
||||
set_instance_variable 'bottle_url'
|
||||
set_instance_variable 'bottle_sha1'
|
||||
set_instance_variable 'head'
|
||||
@ -568,8 +569,8 @@ private
|
||||
end
|
||||
|
||||
attr_rw :version, :homepage, :mirrors, :specs
|
||||
attr_rw :keg_only_reason, :skip_clean_all, :bottle_url, :bottle_sha1
|
||||
attr_rw :cc_failures
|
||||
attr_rw :keg_only_reason, :skip_clean_all, :cc_failures
|
||||
attr_rw :bottle_version, :bottle_url, :bottle_sha1
|
||||
attr_rw(*CHECKSUM_TYPES)
|
||||
|
||||
def head val=nil, specs=nil
|
||||
@ -603,6 +604,10 @@ private
|
||||
return unless block_given?
|
||||
|
||||
bottle_block = Class.new do
|
||||
def self.version version
|
||||
@version = version
|
||||
end
|
||||
|
||||
def self.url url
|
||||
@url = url
|
||||
end
|
||||
@ -617,18 +622,16 @@ private
|
||||
end
|
||||
end
|
||||
|
||||
def self.url_sha1
|
||||
if @sha1 && @url
|
||||
return @url, @sha1
|
||||
elsif @sha1
|
||||
return nil, @sha1
|
||||
end
|
||||
def self.data
|
||||
@version = 0 unless @version
|
||||
return @version, @url, @sha1 if @sha1 && @url
|
||||
return @version, nil, @sha1 if @sha1
|
||||
end
|
||||
end
|
||||
|
||||
bottle_block.instance_eval &block
|
||||
@bottle_url, @bottle_sha1 = bottle_block.url_sha1
|
||||
@bottle_url ||= "#{bottle_base_url}#{name.downcase}-#{@version||@standard.detect_version}#{bottle_native_suffix}" if @bottle_sha1
|
||||
@bottle_version, @bottle_url, @bottle_sha1 = bottle_block.data
|
||||
@bottle_url ||= bottle_base_url + bottle_filename(self) if @bottle_sha1
|
||||
end
|
||||
|
||||
def mirror val, specs=nil
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user