Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Commit

Permalink
Keg#unlink: use ObserverPathnameExtension
Browse files Browse the repository at this point in the history
#link was using the extension but #unlink wasn't, so the counting
criteria were potentially different and `brew unlink` was ignoring
--verbose.
  • Loading branch information
mistydemeo committed Oct 5, 2012
1 parent b11de18 commit 2834ccc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Library/Homebrew/keg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@ def uninstall
end

def unlink
n=0
# these are used by the ObserverPathnameExtension to count the number
# of files and directories linked
$n=$d=0

%w[bin etc lib include sbin share var].map{ |d| self/d }.each do |src|
next unless src.exist?
src.find do |src|
next if src == self
dst=HOMEBREW_PREFIX+src.relative_path_from(self)
dst.extend ObserverPathnameExtension

# check whether the file to be unlinked is from the current keg first
if !dst.symlink? || !dst.exist? || src != dst.resolved_path
Expand All @@ -43,12 +46,11 @@ def unlink
dst.uninstall_info if dst.to_s =~ INFOFILE_RX and ENV['HOMEBREW_KEEP_INFO']
dst.unlink
dst.parent.rmdir_if_possible
n+=1
Find.prune if src.directory?
end
end
linked_keg_record.unlink if linked_keg_record.symlink?
n
$n+$d
end

def fname
Expand Down Expand Up @@ -84,8 +86,6 @@ def basename
def link mode=nil
raise "Cannot link #{fname}\nAnother version is already linked: #{linked_keg_record.realpath}" if linked_keg_record.directory?

# these are used by the ObserverPathnameExtension to count the number
# of files and directories linked
$n=0
$d=0

Expand Down

0 comments on commit 2834ccc

Please sign in to comment.