aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/Homebrew/formula.rb25
-rw-r--r--Library/Homebrew/formula_support.rb20
-rw-r--r--Library/Homebrew/software_spec.rb20
3 files changed, 61 insertions, 4 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 280213265..237042662 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -217,6 +217,21 @@ class Formula
end
# @private
+ def bottle_unneeded?
+ active_spec.bottle_unneeded?
+ end
+
+ # @private
+ def bottle_disabled?
+ active_spec.bottle_disabled?
+ end
+
+ # @private
+ def bottle_disable_reason
+ active_spec.bottle_disable_reason
+ end
+
+ # @private
def bottled?
active_spec.bottled?
end
@@ -1592,8 +1607,14 @@ class Formula
# sha256 "53c234e5e8472b6ac51c1ae1cab3fe06fad053beb8ebfd8977b010655bfdd3c3" => :mavericks
# sha256 "1121cfccd5913f0a63fec40a6ffd44ea64f9dc135c66634ba001d10bcf4302a2" => :mountain_lion
# end</pre>
- def bottle(*, &block)
- stable.bottle(&block)
+ #
+ # For formulae which don't require compiling, you can tag them with:
+ # <pre>bottle :unneeded</pre>
+ #
+ # To disable bottle for other reasons.
+ # <pre>bottle :disable, "reasons"</pre>
+ def bottle(*args, &block)
+ stable.bottle(*args, &block)
end
# @private
diff --git a/Library/Homebrew/formula_support.rb b/Library/Homebrew/formula_support.rb
index 2430c31b0..c76ed39f3 100644
--- a/Library/Homebrew/formula_support.rb
+++ b/Library/Homebrew/formula_support.rb
@@ -55,3 +55,23 @@ EOS
end.strip
end
end
+
+# Used to annotate formulae that don't require compiling or cannot build bottle.
+class BottleDisableReason
+ def initialize(type, reason)
+ @type = type
+ @reason = reason
+ end
+
+ def unneeded?
+ @type == :unneeded
+ end
+
+ def to_s
+ if @type == :unneeded
+ "This formula doesn't require compiling."
+ else
+ @reason
+ end
+ end
+end
diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb
index e8148322e..d2c811b69 100644
--- a/Library/Homebrew/software_spec.rb
+++ b/Library/Homebrew/software_spec.rb
@@ -63,13 +63,29 @@ class SoftwareSpec
dependency_collector.add(@resource)
end
+ def bottle_unneeded?
+ !!@bottle_disable_reason && @bottle_disable_reason.unneeded?
+ end
+
+ def bottle_disabled?
+ !!@bottle_disable_reason
+ end
+
+ def bottle_disable_reason
+ @bottle_disable_reason
+ end
+
def bottled?
bottle_specification.tag?(bottle_tag) && \
(bottle_specification.compatible_cellar? || ARGV.force_bottle?)
end
- def bottle(&block)
- bottle_specification.instance_eval(&block)
+ def bottle(disable_type = nil, disable_reason = nil, &block)
+ if disable_type
+ @bottle_disable_reason = BottleDisableReason.new(disable_type, disable_reason)
+ else
+ bottle_specification.instance_eval(&block)
+ end
end
def resource_defined?(name)