aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/software_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/software_spec.rb')
-rw-r--r--Library/Homebrew/software_spec.rb33
1 files changed, 17 insertions, 16 deletions
diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb
index aff8060f4..0e6dddc89 100644
--- a/Library/Homebrew/software_spec.rb
+++ b/Library/Homebrew/software_spec.rb
@@ -47,7 +47,7 @@ class SoftwareSpec
end
def bottled?
- bottle_specification.fully_specified?
+ bottle_specification.tag?(bottle_tag)
end
def bottle &block
@@ -124,16 +124,19 @@ class Bottle
@name = f.name
@resource = Resource.new
@resource.owner = f
+
+ checksum, tag = spec.checksum_for(bottle_tag)
+
@resource.url = bottle_url(
spec.root_url,
:name => f.name,
:version => f.pkg_version,
:revision => spec.revision,
- :tag => spec.current_tag
+ :tag => tag
)
@resource.download_strategy = CurlBottleDownloadStrategy
@resource.version = f.pkg_version
- @resource.checksum = spec.checksum
+ @resource.checksum = checksum
@prefix = spec.prefix
@cellar = spec.cellar
@revision = spec.revision
@@ -146,7 +149,7 @@ end
class BottleSpecification
attr_rw :root_url, :prefix, :cellar, :revision
- attr_reader :current_tag, :checksum, :collector
+ attr_reader :checksum, :collector
def initialize
@revision = 0
@@ -156,23 +159,21 @@ class BottleSpecification
@collector = BottleCollector.new
end
- def fully_specified?
- checksum && !checksum.empty?
+ def tag?(tag)
+ !!collector.fetch_bottle_for(tag)
end
# Checksum methods in the DSL's bottle block optionally take
# a Hash, which indicates the platform the checksum applies on.
Checksum::TYPES.each do |cksum|
- class_eval <<-EOS, __FILE__, __LINE__ + 1
- def #{cksum}(val)
- digest, tag = val.shift
- collector.add(Checksum.new(:#{cksum}, digest), tag)
-
- cksum, current_tag = collector.fetch_bottle_for(bottle_tag)
- @checksum = cksum if cksum
- @current_tag = current_tag if cksum
- end
- EOS
+ define_method(cksum) do |val|
+ digest, tag = val.shift
+ collector.add(Checksum.new(cksum, digest), tag)
+ end
+ end
+
+ def checksum_for(tag)
+ collector.fetch_bottle_for(tag)
end
def checksums