Fix a race condition generating stampfiles.

This makes 'redo -j1000' now run successfully in t/curse, except that we
foolishly generate the same files more than once.  But at least not more
than once *in parallel*.
This commit is contained in:
Avery Pennarun 2010-11-19 00:57:27 -08:00
commit a5ff60ccf3
2 changed files with 16 additions and 10 deletions

View file

@ -1,16 +1,20 @@
#!/usr/bin/python
import sys, os
import sys, os, errno
import vars
from helpers import sname, add_dep, debug, err, mkdirp, unlink
def _dirty_deps(t, depth, fromdir):
debug('%s?%s\n' % (depth, t))
if not os.path.exists(sname('stamp', t, fromdir)):
debug('%s-- DIRTY (no stamp)\n' % depth)
return True
try:
stamptime = os.stat(sname('stamp', t, fromdir)).st_mtime
except OSError, e:
if e.errno == errno.ENOENT:
debug('%s-- DIRTY (no stamp)\n' % depth)
return True
else:
raise
stamptime = os.stat(sname('stamp', t, fromdir)).st_mtime
try:
realtime = os.stat(os.path.join(fromdir or '', t)).st_mtime
except OSError: