aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2013-03-15 00:28:18 +0000
committerMike McQuaid2013-03-20 23:06:38 +0000
commitb578a47bb9fda8043d7bcff730dc5bf951df41c7 (patch)
tree6b2fdedca7178637717953dd1c331062578b8349 /Library
parent81f9aef2458685e9416f1d8c4d0c86f340d69cfa (diff)
downloadbrew-b578a47bb9fda8043d7bcff730dc5bf951df41c7.tar.bz2
brew-info: specify whether poured or built.
- Store in the tab if a bottle was poured for the build. - Add an additional line of output to `brew info` outputting whether the formula was built from source or poured from a bottle. Closes Homebrew/homebrew#18430. Closes Homebrew/homebrew#18475.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/info.rb7
-rw-r--r--Library/Homebrew/formula.rb3
-rw-r--r--Library/Homebrew/formula_installer.rb4
-rw-r--r--Library/Homebrew/tab.rb3
4 files changed, 16 insertions, 1 deletions
diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb
index 655cbdeea..46857d1d7 100644
--- a/Library/Homebrew/cmd/info.rb
+++ b/Library/Homebrew/cmd/info.rb
@@ -103,6 +103,13 @@ module Homebrew extend self
print " *" if keg.linked?
puts
tab = Tab.for_keg keg
+
+ # Intentionally print no message if this is nil because it's unknown.
+ case tab.poured_from_bottle
+ when true then puts "Poured from bottle"
+ when false then puts "Built from source"
+ end
+
unless tab.used_options.empty?
puts " Installed with: #{tab.used_options*', '}"
end
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 490b517a6..54da64fea 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -503,7 +503,8 @@ class Formula
hsh["installed"] << {
"version" => keg.basename.to_s,
"used_options" => tab.used_options.map(&:flag),
- "built_as_bottle" => tab.built_bottle
+ "built_as_bottle" => tab.built_bottle,
+ "poured_from_bottle" => tab.poured_from_bottle
}
end
end
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index 2eadc8c63..f41eeffdb 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -97,6 +97,10 @@ class FormulaInstaller
if pour_bottle?
pour
@poured_bottle = true
+ tab = Tab.for_keg f.prefix
+ tab.poured_from_bottle = true
+ tab.tabfile.delete rescue nil
+ tab.write
end
rescue
opoo "Bottle installation failed: building from source."
diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb
index 15b0b59ea..b4a85b64e 100644
--- a/Library/Homebrew/tab.rb
+++ b/Library/Homebrew/tab.rb
@@ -21,6 +21,7 @@ class Tab < OpenStruct
:unused_options => f.build.unused_options,
:tabfile => f.prefix.join(FILENAME),
:built_as_bottle => !!ARGV.build_bottle?,
+ :poured_from_bottle => false,
:tapped_from => f.tap,
:time => Time.now.to_i, # to_s would be better but Ruby has no from_s function :P
:HEAD => sha
@@ -53,6 +54,7 @@ class Tab < OpenStruct
Tab.new :used_options => [],
:unused_options => (f.build.as_flags rescue []),
:built_as_bottle => false,
+ :poured_from_bottle => false,
:tapped_from => "",
:time => nil,
:HEAD => nil
@@ -93,6 +95,7 @@ class Tab < OpenStruct
:used_options => used_options.to_a,
:unused_options => unused_options.to_a,
:built_as_bottle => built_as_bottle,
+ :poured_from_bottle => poured_from_bottle,
:tapped_from => tapped_from,
:time => time,
:HEAD => send("HEAD")})