Don't wipe the timestamp when a target fails to redo.

It's really a separate condition.  And since we're not removing the target
*file* in case of error - we update it atomically, and keeping it is better
than losing it - there's no reason to wipe the timestamp in that case
either.

However, we do need to know that the build failed, so that anybody else
(especially in a parallel build) who looks at that target knows that it
died.  So add a separate flag just for that.
This commit is contained in:
Avery Pennarun 2010-12-10 20:53:31 -08:00
commit 0126f6be1e
4 changed files with 39 additions and 17 deletions

View file

@ -59,6 +59,7 @@ def db():
" is_generated int, "
" checked_runid int, "
" changed_runid int, "
" failed_runid int, "
" stamp, "
" csum)")
_db.execute("create table Deps "
@ -134,18 +135,19 @@ def relpath(t, base):
class File(object):
# use this mostly to avoid accidentally assigning to typos
__slots__ = ['id', 'name', 'is_generated',
'checked_runid', 'changed_runid',
'checked_runid', 'changed_runid', 'failed_runid',
'stamp', 'csum']
def _init_from_cols(self, cols):
(self.id, self.name, self.is_generated,
self.checked_runid, self.changed_runid,
self.checked_runid, self.changed_runid, self.failed_runid,
self.stamp, self.csum) = cols
def __init__(self, id=None, name=None, cols=None):
if cols:
return self._init_from_cols(cols)
q = ('select rowid, name, is_generated, checked_runid, changed_runid, '
q = ('select rowid, name, is_generated, '
' checked_runid, changed_runid, failed_runid, '
' stamp, csum '
' from Files ')
if id != None:
@ -175,21 +177,26 @@ class File(object):
def save(self):
_write('update Files set '
' is_generated=?, checked_runid=?, changed_runid=?, '
' is_generated=?, '
' checked_runid=?, changed_runid=?, failed_runid=?, '
' stamp=?, csum=? '
' where rowid=?',
[self.is_generated,
self.checked_runid, self.changed_runid,
self.checked_runid, self.changed_runid, self.failed_runid,
self.stamp, self.csum,
self.id])
def set_checked(self):
self.checked_runid = vars.RUNID
def set_changed(self):
debug2('BUILT: %r (%r)\n' % (self.name, self.stamp))
self.changed_runid = vars.RUNID
def set_failed(self):
debug2('FAILED: %r\n' % self.name)
self.failed_runid = vars.RUNID
def set_static(self):
self.update_stamp()
@ -200,15 +207,19 @@ class File(object):
self.stamp = newstamp
self.set_changed()
def is_changed(self):
return self.changed_runid and self.changed_runid >= vars.RUNID
def is_checked(self):
return self.checked_runid and self.checked_runid >= vars.RUNID
def is_changed(self):
return self.changed_runid and self.changed_runid >= vars.RUNID
def is_failed(self):
return self.failed_runid and self.failed_runid >= vars.RUNID
def deps(self):
q = ('select Deps.mode, Deps.source, '
' name, is_generated, checked_runid, changed_runid, '
' name, is_generated, '
' checked_runid, changed_runid, failed_runid, '
' stamp, csum '
' from Files '
' join Deps on Files.rowid = Deps.source '