aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2015-02-18 20:05:50 -0500
committerJack Nagel2015-02-18 21:29:17 -0500
commit4b1028c9e5ad04a129113d51087c0b11cc92d218 (patch)
tree0d1e50acf1f3353182fef2e2b67ccb36e5990b8b
parent1ab384a313168e6d7ae4c1c97132addb6499ffbf (diff)
downloadbrew-4b1028c9e5ad04a129113d51087c0b11cc92d218.tar.bz2
Start recording the formula path in the install receipt
Later we can use this information to try and load the formula from the correct source.
-rw-r--r--Library/Homebrew/tab.rb60
-rw-r--r--Library/Homebrew/test/test_tab.rb1
2 files changed, 40 insertions, 21 deletions
diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb
index 135a5dcfc..2415b843b 100644
--- a/Library/Homebrew/tab.rb
+++ b/Library/Homebrew/tab.rb
@@ -11,16 +11,23 @@ class Tab < OpenStruct
FILENAME = 'INSTALL_RECEIPT.json'
def self.create(formula, compiler, stdlib, build)
- Tab.new :used_options => build.used_options.as_flags,
- :unused_options => build.unused_options.as_flags,
- :tabfile => formula.prefix.join(FILENAME),
- :built_as_bottle => !!ARGV.build_bottle?,
- :poured_from_bottle => false,
- :tapped_from => formula.tap,
- :time => Time.now.to_i,
- :HEAD => Homebrew.git_head,
- :compiler => compiler,
- :stdlib => stdlib
+ attributes = {
+ :used_options => build.used_options.as_flags,
+ :unused_options => build.unused_options.as_flags,
+ :tabfile => formula.prefix.join(FILENAME),
+ :built_as_bottle => !!ARGV.build_bottle?,
+ :poured_from_bottle => false,
+ :tapped_from => formula.tap,
+ :time => Time.now.to_i,
+ :HEAD => Homebrew.git_head,
+ :compiler => compiler,
+ :stdlib => stdlib,
+ :source => {
+ :path => formula.path.to_s,
+ },
+ }
+
+ new(attributes)
end
def self.from_file path
@@ -83,15 +90,22 @@ class Tab < OpenStruct
end
def self.dummy_tab f=nil
- Tab.new :used_options => [],
- :unused_options => (f.options.as_flags rescue []),
- :built_as_bottle => false,
- :poured_from_bottle => false,
- :tapped_from => "",
- :time => nil,
- :HEAD => nil,
- :stdlib => nil,
- :compiler => :clang
+ attributes = {
+ :used_options => [],
+ :unused_options => (f.options.as_flags rescue []),
+ :built_as_bottle => false,
+ :poured_from_bottle => false,
+ :tapped_from => "",
+ :time => nil,
+ :HEAD => nil,
+ :stdlib => nil,
+ :compiler => :clang,
+ :source => {
+ :path => nil,
+ },
+ }
+
+ new(attributes)
end
def with? val
@@ -139,7 +153,7 @@ class Tab < OpenStruct
end
def to_json
- Utils::JSON.dump({
+ attributes = {
:used_options => used_options.as_flags,
:unused_options => unused_options.as_flags,
:built_as_bottle => built_as_bottle,
@@ -148,7 +162,11 @@ class Tab < OpenStruct
:time => time,
:HEAD => self.HEAD,
:stdlib => (stdlib.to_s if stdlib),
- :compiler => (compiler.to_s if compiler)})
+ :compiler => (compiler.to_s if compiler),
+ :source => source || {},
+ }
+
+ Utils::JSON.dump(attributes)
end
def write
diff --git a/Library/Homebrew/test/test_tab.rb b/Library/Homebrew/test/test_tab.rb
index bb4ea9198..ea38be87b 100644
--- a/Library/Homebrew/test/test_tab.rb
+++ b/Library/Homebrew/test/test_tab.rb
@@ -17,6 +17,7 @@ class TabTests < Homebrew::TestCase
:HEAD => TEST_SHA1,
:compiler => "clang",
:stdlib => "libcxx",
+ :source => { :path => nil },
})
end