From 0129542ede90a526dd4e1a39e00cc07c9eb29938 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Mon, 10 Mar 2014 14:56:02 -0500 Subject: [PATCH] Update bottle command for generalized bottle implementation --- Library/Homebrew/cmd/bottle.rb | 31 +++++++++++++------------------ Library/Homebrew/cmd/versions.rb | 4 ++-- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/Library/Homebrew/cmd/bottle.rb b/Library/Homebrew/cmd/bottle.rb index 5d09164e2b..91cac596f3 100644 --- a/Library/Homebrew/cmd/bottle.rb +++ b/Library/Homebrew/cmd/bottle.rb @@ -7,14 +7,6 @@ require 'utils/inreplace' require 'erb' require 'extend/pathname' -class BottleMerger < Formula - # This provides a URL and Version which are the only needed properties of - # a Formula. This object is used to access the Formula bottle DSL to merge - # multiple outputs of `brew bottle`. - url '1' - def self.reset_bottle; @bottle = Bottle.new; end -end - BOTTLE_ERB = <<-EOS bottle do <% if prefix.to_s != "/usr/local" %> @@ -119,7 +111,12 @@ module Homebrew extend self bottle_revision = max ? max + 1 : 0 end - filename = bottle_filename(f, :tag => bottle_tag, :revision => bottle_revision) + filename = bottle_filename( + :name => f.name, + :version => f.pkg_version, + :revision => bottle_revision, + :tag => bottle_tag + ) if bottle_filename_formula_name(filename).empty? return ofail "Add a new regex to bottle_version.rb to parse #{f.version} from #{filename}" @@ -170,7 +167,7 @@ module Homebrew extend self end end - bottle = Bottle.new + bottle = BottleSpecification.new bottle.prefix HOMEBREW_PREFIX bottle.cellar relocatable ? :any : HOMEBREW_CELLAR bottle.revision bottle_revision @@ -197,15 +194,13 @@ module Homebrew extend self bottle_block = IO.read argument merge_hash[formula_name] << bottle_block end - merge_hash.keys.each do |formula_name| - BottleMerger.reset_bottle + + merge_hash.each do |formula_name, bottle_blocks| ohai formula_name - bottle_blocks = merge_hash[formula_name] - bottle_blocks.each do |bottle_block| - BottleMerger.class_eval bottle_block - end - bottle = BottleMerger.new.bottle - next unless bottle + + bottle = BottleSpecification.new + bottle_blocks.each { |block| bottle.instance_eval(block) } + output = bottle_output bottle puts output diff --git a/Library/Homebrew/cmd/versions.rb b/Library/Homebrew/cmd/versions.rb index 4112c8d39a..fa38cfca60 100644 --- a/Library/Homebrew/cmd/versions.rb +++ b/Library/Homebrew/cmd/versions.rb @@ -45,9 +45,9 @@ class Formula map = Hash.new { |h, k| h[k] = [] } rev_list(branch) do |rev| formula_for_sha(rev) do |f| - bottle = f.class.bottle + bottle = f.stable.bottle_specification unless bottle.checksums.empty? - map[bottle.version] << bottle.revision + map[f.pkg_version] << bottle.revision end end end