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:
parent
73b79de7bc
commit
b52af53e71
@ -4,10 +4,8 @@ require "utils"
|
|||||||
require "extend/ENV"
|
require "extend/ENV"
|
||||||
require "formula_cellar_checks"
|
require "formula_cellar_checks"
|
||||||
require "official_taps"
|
require "official_taps"
|
||||||
require "tap_migrations"
|
|
||||||
require "cmd/search"
|
require "cmd/search"
|
||||||
require "date"
|
require "date"
|
||||||
require "formula_renames"
|
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
def audit
|
def audit
|
||||||
@ -898,11 +896,11 @@ class FormulaAuditor
|
|||||||
end
|
end
|
||||||
|
|
||||||
def audit_reverse_migration
|
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 @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
|
problem <<-EOS.undent
|
||||||
#{formula.name} seems to be listed in tap_migrations.rb!
|
#{formula.name} seems to be listed in tap_migrations.rb!
|
||||||
Please remove #{formula.name} from present tap & tap_migrations.rb
|
Please remove #{formula.name} from present tap & tap_migrations.rb
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
require "migrator"
|
require "migrator"
|
||||||
require "formula_renames"
|
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
def migrate
|
def migrate
|
||||||
|
|||||||
@ -11,7 +11,6 @@ require "install_renamed"
|
|||||||
require "pkg_version"
|
require "pkg_version"
|
||||||
require "tap"
|
require "tap"
|
||||||
require "core_formula_repository"
|
require "core_formula_repository"
|
||||||
require "formula_renames"
|
|
||||||
require "keg"
|
require "keg"
|
||||||
require "migrator"
|
require "migrator"
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
require "digest/md5"
|
require "digest/md5"
|
||||||
require "formula_renames"
|
|
||||||
require "tap"
|
require "tap"
|
||||||
require "core_formula_repository"
|
require "core_formula_repository"
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,6 @@ require "formula"
|
|||||||
require "formula_lock"
|
require "formula_lock"
|
||||||
require "keg"
|
require "keg"
|
||||||
require "tab"
|
require "tab"
|
||||||
require "tap_migrations"
|
|
||||||
|
|
||||||
class Migrator
|
class Migrator
|
||||||
class MigrationNeededError < RuntimeError
|
class MigrationNeededError < RuntimeError
|
||||||
@ -126,13 +125,11 @@ class Migrator
|
|||||||
if formula.tap == old_tap
|
if formula.tap == old_tap
|
||||||
true
|
true
|
||||||
# Homebrew didn't use to update tabs while performing tap-migrations,
|
# Homebrew didn't use to update tabs while performing tap-migrations,
|
||||||
# so there can be INSTALL_RECEIPT's containing wrong information about
|
# so there can be INSTALL_RECEIPT's containing wrong information about tap,
|
||||||
# tap (tap is Homebrew/homebrew if installed formula migrates to a tap), so
|
# so we check if there is an entry about oldname migrated to tap and if
|
||||||
# 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
|
# 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.
|
# can perform migrations and the taps for oldname and newname are the same.
|
||||||
elsif TAP_MIGRATIONS && (rec = TAP_MIGRATIONS[formula.oldname]) \
|
elsif formula.tap && old_tap && formula.tap == old_tap.tap_migrations[formula.oldname]
|
||||||
&& formula.tap == rec && old_tap == "Homebrew/homebrew"
|
|
||||||
fix_tabs
|
fix_tabs
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user