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
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)
if keg.linked?
opoo "This keg was marked linked already, continuing anyway"
keg.remove_linked_keg_record
end
begin
keg.link
rescue Keg::ConflictError => e

View File

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