Be explicit about passing formulae names or instances to Tab

This commit is contained in:
Adam Vandenberg 2013-06-26 10:37:09 -07:00
parent 5627ed21ce
commit 1cd3149677
3 changed files with 6 additions and 3 deletions

View File

@ -974,7 +974,7 @@ def check_for_non_prefixed_coreutils
end
def check_for_non_prefixed_findutils
default_names = Tab.for_formula('findutils').used_options.include? 'default-names'
default_names = Tab.for_name('findutils').used_options.include? 'default-names'
if default_names then <<-EOS.undent
Putting non-prefixed findutils in your path can cause python builds to fail.
EOS

View File

@ -205,7 +205,7 @@ class FormulaInstaller
end
def install_dependency dep
dep_tab = Tab.for_formula(dep)
dep_tab = Tab.for_formula(dep.to_formula)
dep_options = dep.options
dep = dep.to_formula

View File

@ -42,8 +42,11 @@ class Tab < OpenStruct
end
end
def self.for_name name
for_formula(Formula.factory(name))
end
def self.for_formula f
f = Formula.factory(f)
path = [f.opt_prefix, f.linked_keg].map{ |pn| pn.join(FILENAME) }.find{ |pn| pn.exist? }
# Legacy kegs may lack a receipt. If it doesn't exist, fake one
if path.nil? then self.dummy_tab(f) else self.from_file(path) end