Use the keg object to manipulate the linked keg record

This commit is contained in:
Jack Nagel 2014-06-27 16:20:17 -05:00
parent 2de2d64907
commit 982a165e52
2 changed files with 11 additions and 10 deletions

View File

@ -546,14 +546,13 @@ class FormulaInstaller
end end
def link def link
if f.linked_keg.directory? and f.linked_keg.resolved_path == f.prefix
opoo "This keg was marked linked already, continuing anyway"
# otherwise Keg.link will bail
f.linked_keg.unlink
end
keg = Keg.new(f.prefix) keg = Keg.new(f.prefix)
if keg.linked?
opoo "This keg was marked linked already, continuing anyway"
keg.remove_linked_keg_record
end
begin begin
keg.link keg.link
rescue Keg::ConflictError => e rescue Keg::ConflictError => e

View File

@ -180,16 +180,18 @@ class Keg
end end
end end
if linked? remove_linked_keg_record if linked?
linked_keg_record.unlink
linked_keg_record.parent.rmdir_if_possible
end
dirs.reverse_each(&:rmdir_if_possible) dirs.reverse_each(&:rmdir_if_possible)
ObserverPathnameExtension.total ObserverPathnameExtension.total
end end
def remove_linked_keg_record
linked_keg_record.unlink
linked_keg_record.parent.rmdir_if_possible
end
def lock def lock
FormulaLock.new(name).with_lock { yield } FormulaLock.new(name).with_lock { yield }
end end