Skip to content

Commit

Permalink
Disable file locks on Tiger
Browse files Browse the repository at this point in the history
The new file lock feature depends on ruby's File.flock and
Pathname#flock, which aren't available on ruby 1.8.2.

If possible, they will eventually be reenabled after flock is
backported.
  • Loading branch information
mistydemeo committed Jan 29, 2013
1 parent 73c1714 commit eace716
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Library/Homebrew/formula.rb
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ def brew
end

def lock
# ruby 1.8.2 doesn't implement flock
# TODO backport the flock feature and reenable it
return if MacOS.version == :tiger

HOMEBREW_CACHE_FORMULA.mkpath
lockpath = HOMEBREW_CACHE_FORMULA/"#{@name}.brewing"
@lockfile = lockpath.open(File::RDWR | File::CREAT)
Expand Down
4 changes: 4 additions & 0 deletions Library/Homebrew/formula_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,10 @@ def hold_locks?
end

def lock
# ruby 1.8.2 doesn't implement flock
# TODO backport the flock feature and reenable it
return if MacOS.version == :tiger

if (@@locked ||= []).empty?
f.recursive_dependencies.each do |dep|
@@locked << dep.to_formula
Expand Down
4 changes: 4 additions & 0 deletions Library/Homebrew/keg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ def fname
end

def lock
# ruby 1.8.2 doesn't implement flock
# TODO backport the flock feature and reenable it
yield if MacOS.version == :tiger

HOMEBREW_CACHE_FORMULA.mkpath
path = HOMEBREW_CACHE_FORMULA/"#{fname}.brewing"
file = path.open(File::RDWR | File::CREAT)
Expand Down

0 comments on commit eace716

Please sign in to comment.