Fix a race condition caused by zap_deps().

We can't just delete all the dependencies at the beginning and re-add them:
other people might be checking the same dependencies in parallel.  Instead,
mark them as delete_me up front, and then after the build completes, remove
only the delete_me entries.
This commit is contained in:
Avery Pennarun 2010-12-11 22:59:55 -08:00
commit c64b8a3eb1
2 changed files with 14 additions and 9 deletions

View file

@ -107,7 +107,7 @@ class BuildJob:
sf.set_static()
sf.save()
return self._after2(0)
sf.zap_deps()
sf.zap_deps1()
(dofile, basename, ext) = _find_do_file(sf)
if not dofile:
if os.path.exists(t):
@ -235,18 +235,18 @@ class BuildJob:
sf.csum = None
sf.update_stamp()
sf.set_changed()
sf.save()
else:
unlink(self.tmpname1)
unlink(self.tmpname2)
sf = self.sf
sf.set_failed()
sf.save()
sf.zap_deps2()
sf.save()
f.close()
if rv != 0:
err('%s: exit code %d\n' % (_nice(t),rv))
else:
if vars.VERBOSE or vars.XTRACE:
if vars.VERBOSE or vars.XTRACE or vars.DEBUG:
log('%s (done)\n\n' % _nice(t))
return rv