diff options
| author | Charlie Sharpsteen | 2012-12-18 14:59:12 -0800 | 
|---|---|---|
| committer | Charlie Sharpsteen | 2012-12-18 15:12:10 -0800 | 
| commit | 78e7cc32e889fd1f83a1d811c75cb97795d8b5bd (patch) | |
| tree | 2c2a748085f4e77e1585854ff822f9eeaf9898de /Library/Homebrew/cmd/upgrade.rb | |
| parent | 05f0ea712c44054b136d5244c11c8bfa0c54bab8 (diff) | |
| download | homebrew-78e7cc32e889fd1f83a1d811c75cb97795d8b5bd.tar.bz2 | |
upgrade.rb: Generate Tab from Keg not Formula
Two issues were preventing `brew upgrade` from functioning properly:
  - `Tab.for_formula` was used to recover options from prior installs. The
    problem is that during an upgrade `for_formula` will be directed to a
    non-existant install of the newer version and thus returns a forged tab
    claiming no options were invoked.
  - The assignment to `installer.install_bottle` requires parenthesis in order
    to function properly.
Diffstat (limited to 'Library/Homebrew/cmd/upgrade.rb')
| -rw-r--r-- | Library/Homebrew/cmd/upgrade.rb | 7 | 
1 files changed, 5 insertions, 2 deletions
| diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index 7ec02a0b5..06dfb8732 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -53,12 +53,15 @@ module Homebrew extend self    end    def upgrade_formula f -    tab = Tab.for_formula(f) +    # Generate using `for_keg` since the formula object points to a newer version +    # that doesn't exist yet. Use `opt_prefix` to guard against keg-only installs. +    # Also, guard against old installs that may not have an `opt_prefix` symlink. +    tab = (f.opt_prefix.exist? ? Tab.for_keg(f.opt_prefix) : Tab.dummy_tab(f))      outdated_keg = Keg.new(f.linked_keg.realpath) rescue nil      installer = FormulaInstaller.new(f, tab)      installer.show_header = false -    installer.install_bottle = install_bottle?(f) and tab.used_options.empty? +    installer.install_bottle = (install_bottle?(f) and tab.used_options.empty?)      oh1 "Upgrading #{f.name}" | 
