Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of tap migrations to new cask names. #2419

Merged
merged 1 commit into from
Mar 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion Library/Homebrew/migrator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,21 @@ def fix_tabs
end

def from_same_taps?
new_tap = if old_tap
if migrate_tap = old_tap.tap_migrations[formula.oldname]
new_tap_user, new_tap_repo, = migrate_tap.split("/")
"#{new_tap_user}/#{new_tap_repo}"
end
end

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,
# 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 formula.tap && old_tap && formula.tap == old_tap.tap_migrations[formula.oldname]
elsif formula.tap && old_tap && formula.tap == new_tap
fix_tabs
true
else
Expand Down
10 changes: 7 additions & 3 deletions Library/Homebrew/missing_formula.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,14 @@ def tap_migration_reason(name)
message = nil

Tap.each do |old_tap|
new_tap_name = old_tap.tap_migrations[name]
next unless new_tap_name
new_tap = old_tap.tap_migrations[name]
next unless new_tap

new_tap_user, new_tap_repo, = new_tap.split("/")
new_tap_name = "#{new_tap_user}/#{new_tap_repo}"

message = <<-EOS.undent
It was migrated from #{old_tap} to #{new_tap_name}.
It was migrated from #{old_tap} to #{new_tap}.
You can access it again by running:
brew tap #{new_tap_name}
EOS
Expand Down