Merge pull request #988 from MikeMcQuaid/move-linkedkegs-migration
Move LinkedKegs migration.
This commit is contained in:
commit
299dffd903
@ -87,6 +87,9 @@ begin
|
|||||||
# `Homebrew.help` never returns, except for external/unknown commands.
|
# `Homebrew.help` never returns, except for external/unknown commands.
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Migrate LinkedKegs/PinnedKegs if update didn't already do so
|
||||||
|
migrate_legacy_keg_symlinks_if_necessary
|
||||||
|
|
||||||
# Uninstall old brew-cask if it's still around; we just use the tap now.
|
# Uninstall old brew-cask if it's still around; we just use the tap now.
|
||||||
if cmd == "cask" && (HOMEBREW_CELLAR/"brew-cask").exist?
|
if cmd == "cask" && (HOMEBREW_CELLAR/"brew-cask").exist?
|
||||||
system(HOMEBREW_BREW_FILE, "uninstall", "--force", "brew-cask")
|
system(HOMEBREW_BREW_FILE, "uninstall", "--force", "brew-cask")
|
||||||
|
|||||||
@ -7,6 +7,7 @@ require "migrator"
|
|||||||
require "formulary"
|
require "formulary"
|
||||||
require "descriptions"
|
require "descriptions"
|
||||||
require "cleanup"
|
require "cleanup"
|
||||||
|
require "utils"
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
def update_preinstall_header
|
def update_preinstall_header
|
||||||
@ -168,30 +169,6 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def migrate_legacy_keg_symlinks_if_necessary
|
|
||||||
legacy_linked_kegs = HOMEBREW_LIBRARY/"LinkedKegs"
|
|
||||||
return unless legacy_linked_kegs.directory?
|
|
||||||
|
|
||||||
legacy_linked_kegs.children.each do |f|
|
|
||||||
keg = Keg.new(f.realpath)
|
|
||||||
keg.unlink
|
|
||||||
keg.link
|
|
||||||
end
|
|
||||||
FileUtils.rm_rf legacy_linked_kegs
|
|
||||||
|
|
||||||
legacy_pinned_kegs = HOMEBREW_LIBRARY/"PinnedKegs"
|
|
||||||
return unless legacy_pinned_kegs.directory?
|
|
||||||
|
|
||||||
legacy_pinned_kegs.children.each do |f|
|
|
||||||
pin_version = Keg.new(f.realpath).version
|
|
||||||
formula = Formulary.factory(f.basename.to_s)
|
|
||||||
pin = FormulaPin.new(formula)
|
|
||||||
pin.unpin
|
|
||||||
pin.pin_at(pin_version)
|
|
||||||
end
|
|
||||||
FileUtils.rm_rf legacy_pinned_kegs
|
|
||||||
end
|
|
||||||
|
|
||||||
def link_completions_and_docs
|
def link_completions_and_docs
|
||||||
return if HOMEBREW_PREFIX.to_s == HOMEBREW_REPOSITORY.to_s
|
return if HOMEBREW_PREFIX.to_s == HOMEBREW_REPOSITORY.to_s
|
||||||
command = "brew update"
|
command = "brew update"
|
||||||
|
|||||||
@ -18,18 +18,10 @@ HOMEBREW_LIBRARY = Pathname.new(ENV["HOMEBREW_LIBRARY"])
|
|||||||
HOMEBREW_SHIMS_PATH = HOMEBREW_LIBRARY/"Homebrew/shims"
|
HOMEBREW_SHIMS_PATH = HOMEBREW_LIBRARY/"Homebrew/shims"
|
||||||
|
|
||||||
# Where we store symlinks to currently linked kegs
|
# Where we store symlinks to currently linked kegs
|
||||||
HOMEBREW_LINKED_KEGS = if (HOMEBREW_LIBRARY/"LinkedKegs").exist?
|
HOMEBREW_LINKED_KEGS = HOMEBREW_PREFIX/"var/homebrew/linked"
|
||||||
HOMEBREW_LIBRARY/"LinkedKegs"
|
|
||||||
else
|
|
||||||
HOMEBREW_PREFIX/"var/homebrew/linked"
|
|
||||||
end
|
|
||||||
|
|
||||||
# Where we store symlinks to currently version-pinned kegs
|
# Where we store symlinks to currently version-pinned kegs
|
||||||
HOMEBREW_PINNED_KEGS = if (HOMEBREW_LIBRARY/"PinnedKegs").exist?
|
HOMEBREW_PINNED_KEGS = HOMEBREW_PREFIX/"var/homebrew/pinned"
|
||||||
HOMEBREW_LIBRARY/"PinnedKegs"
|
|
||||||
else
|
|
||||||
HOMEBREW_PREFIX/"var/homebrew/pinned"
|
|
||||||
end
|
|
||||||
|
|
||||||
# Where we store lock files
|
# Where we store lock files
|
||||||
HOMEBREW_LOCK_DIR = HOMEBREW_PREFIX/"var/homebrew/locks"
|
HOMEBREW_LOCK_DIR = HOMEBREW_PREFIX/"var/homebrew/locks"
|
||||||
|
|||||||
@ -620,3 +620,27 @@ end
|
|||||||
def link_path_manpages(path, command)
|
def link_path_manpages(path, command)
|
||||||
link_src_dst_dirs(path/"man", HOMEBREW_PREFIX/"share/man", command)
|
link_src_dst_dirs(path/"man", HOMEBREW_PREFIX/"share/man", command)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def migrate_legacy_keg_symlinks_if_necessary
|
||||||
|
legacy_linked_kegs = HOMEBREW_LIBRARY/"LinkedKegs"
|
||||||
|
return unless legacy_linked_kegs.directory?
|
||||||
|
|
||||||
|
legacy_linked_kegs.children.each do |f|
|
||||||
|
keg = Keg.new(f.realpath)
|
||||||
|
keg.unlink
|
||||||
|
keg.link
|
||||||
|
end
|
||||||
|
FileUtils.rm_rf legacy_linked_kegs
|
||||||
|
|
||||||
|
legacy_pinned_kegs = HOMEBREW_LIBRARY/"PinnedKegs"
|
||||||
|
return unless legacy_pinned_kegs.directory?
|
||||||
|
|
||||||
|
legacy_pinned_kegs.children.each do |f|
|
||||||
|
pin_version = Keg.new(f.realpath).version
|
||||||
|
formula = Formulary.factory(f.basename.to_s)
|
||||||
|
pin = FormulaPin.new(formula)
|
||||||
|
pin.unpin
|
||||||
|
pin.pin_at(pin_version)
|
||||||
|
end
|
||||||
|
FileUtils.rm_rf legacy_pinned_kegs
|
||||||
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user