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