Skip to content
This repository has been archived by the owner on Jan 16, 2025. It is now read-only.

Commit

Permalink
Pass the tab to FormulaInstaller
Browse files Browse the repository at this point in the history
Callers of FormulaInstaller now usually unlink the existing keg prior to
running the installer. However, Tab.for_formula uses the LinkedKeg
record to obtain the tab.

Since we need the tab to persist install options across upgrades, we
must start creating the Tab object before unlinking the old keg and
passing it to the FormulaInstaller.

Fixes #11086.

Signed-off-by: Jack Nagel <[email protected]>
  • Loading branch information
jacknagel committed Mar 23, 2012
1 parent 672c5ab commit f8fefcc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Library/Homebrew/cmd/upgrade.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ def upgrade
end

def upgrade_formula f
tab = Tab.for_formula(f)
outdated_keg = Keg.new(f.linked_keg.realpath) rescue nil

installer = FormulaInstaller.new f
installer = FormulaInstaller.new(f, tab)
installer.show_header = false

oh1 "Upgrading #{f.name}"
Expand Down
10 changes: 6 additions & 4 deletions Library/Homebrew/formula_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@

class FormulaInstaller
attr :f
attr :tab
attr :show_summary_heading, true
attr :ignore_deps, true
attr :install_bottle, true
attr :show_header, true

def initialize ff
def initialize ff, tab=nil
@f = ff
@tab = tab
@show_header = true
@ignore_deps = ARGV.include? '--ignore-dependencies' || ARGV.interactive?
@install_bottle = install_bottle? ff
Expand Down Expand Up @@ -111,9 +113,10 @@ def install
end

def install_dependency dep
dep_tab = Tab.for_formula(dep)
outdated_keg = Keg.new(dep.linked_keg.realpath) rescue nil

fi = FormulaInstaller.new dep
fi = FormulaInstaller.new(dep, dep_tab)
fi.ignore_deps = true
fi.show_header = false
oh1 "Installing #{f} dependency: #{dep}"
Expand Down Expand Up @@ -179,8 +182,7 @@ def build

args = ARGV.clone
unless args.include? '--fresh'
previous_install = Tab.for_formula f
args.concat previous_install.used_options
args.concat tab.used_options unless tab.nil?
args.uniq! # Just in case some dupes were added
end

Expand Down

0 comments on commit f8fefcc

Please sign in to comment.