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.
This commit is contained in:
Jack Nagel 2015-02-18 20:05:50 -05:00
parent 1ab384a313
commit 4b1028c9e5
2 changed files with 40 additions and 21 deletions

View File

@ -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

View File

@ -17,6 +17,7 @@ class TabTests < Homebrew::TestCase
:HEAD => TEST_SHA1,
:compiler => "clang",
:stdlib => "libcxx",
:source => { :path => nil },
})
end