various: use Tap abstraction

formula_rename and tap_migrations are now handled inside Tap.

Closes Homebrew/homebrew#49549.

Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
Xu Cheng 2016-02-26 15:33:27 +08:00
parent 73b79de7bc
commit b52af53e71
5 changed files with 6 additions and 14 deletions

View File

@ -4,10 +4,8 @@ require "utils"
require "extend/ENV"
require "formula_cellar_checks"
require "official_taps"
require "tap_migrations"
require "cmd/search"
require "date"
require "formula_renames"
module Homebrew
def audit
@ -898,11 +896,11 @@ class FormulaAuditor
end
def audit_reverse_migration
# Only enforce for new formula being re-added to core
# Only enforce for new formula being re-added to core and official taps
return unless @strict
return unless formula.core_formula?
return unless formula.tap && formula.tap.official?
if TAP_MIGRATIONS.key?(formula.name)
if formula.tap.tap_migrations.key?(formula.name)
problem <<-EOS.undent
#{formula.name} seems to be listed in tap_migrations.rb!
Please remove #{formula.name} from present tap & tap_migrations.rb

View File

@ -1,5 +1,4 @@
require "migrator"
require "formula_renames"
module Homebrew
def migrate

View File

@ -11,7 +11,6 @@ require "install_renamed"
require "pkg_version"
require "tap"
require "core_formula_repository"
require "formula_renames"
require "keg"
require "migrator"

View File

@ -1,5 +1,4 @@
require "digest/md5"
require "formula_renames"
require "tap"
require "core_formula_repository"

View File

@ -2,7 +2,6 @@ require "formula"
require "formula_lock"
require "keg"
require "tab"
require "tap_migrations"
class Migrator
class MigrationNeededError < RuntimeError
@ -126,13 +125,11 @@ class Migrator
if formula.tap == old_tap
true
# Homebrew didn't use to update tabs while performing tap-migrations,
# so there can be INSTALL_RECEIPT's containing wrong information about
# tap (tap is Homebrew/homebrew if installed formula migrates to a tap), so
# we check if there is an entry about oldname migrated to tap and if
# so there can be INSTALL_RECEIPT's containing wrong information about tap,
# so we check if there is an entry about oldname migrated to tap and if
# newname's tap is the same as tap to which oldname migrated, then we
# can perform migrations and the taps for oldname and newname are the same.
elsif TAP_MIGRATIONS && (rec = TAP_MIGRATIONS[formula.oldname]) \
&& formula.tap == rec && old_tap == "Homebrew/homebrew"
elsif formula.tap && old_tap && formula.tap == old_tap.tap_migrations[formula.oldname]
fix_tabs
true
else