From 1c10a6260fb4f4036d68b4c34acc6135b26b93d6 Mon Sep 17 00:00:00 2001 From: Zhiming Wang Date: Sun, 25 Dec 2016 18:54:08 -0500 Subject: Hint at new location of migrated formulae Partial implementation of https://github.com/Homebrew/brew-evolution/pull/15, along with the ability to search for deleted formulae in git history (inspired by #1996) which is not described in the proposal. See also: #1371. --- Library/Homebrew/cmd/info.rb | 22 +++++++++++++++++++--- Library/Homebrew/cmd/install.rb | 13 +++++++++++++ 2 files changed, 32 insertions(+), 3 deletions(-) (limited to 'Library/Homebrew/cmd') diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb index b7de0005c..2d5e34ce2 100644 --- a/Library/Homebrew/cmd/info.rb +++ b/Library/Homebrew/cmd/info.rb @@ -23,6 +23,7 @@ require "formula" require "keg" require "tab" require "json" +require "historic" module Homebrew module_function @@ -54,10 +55,25 @@ module Homebrew else info_formula Formulary.find_with_priority(f) end - rescue FormulaUnavailableError + rescue FormulaUnavailableError => e # No formula with this name, try a blacklist lookup - raise unless (blacklist = blacklisted?(f)) - puts blacklist + if (blacklist = blacklisted?(f)) + ofail "#{e.message}\n#{blacklist}" + else + ofail e.message + + # No point in searching if the specified tap isn't tapped yet + next if e.instance_of?(TapFormulaUnavailableError) && !e.tap.installed? + + migrations = search_for_migrated_formula(f) + next unless migrations.empty? + ohai "Searching among deleted formulae..." + begin + search_for_deleted_formula(f) + rescue + nil + end + end end end end diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index c825e2796..8a99bd397 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -62,6 +62,7 @@ require "formula_installer" require "tap" require "hardware" require "development_tools" +require "historic" module Homebrew module_function @@ -212,6 +213,18 @@ module Homebrew ofail "What's updog?" else ofail e.message + + migrations = search_for_migrated_formula(e.name) + return unless migrations.empty? + + ohai "Searching among deleted formulae..." + begin + search_for_deleted_formula(e.name) + return + rescue + nil + end + query = query_regexp(e.name) ohai "Searching for similarly named formulae..." -- cgit v1.2.3