{ood,sources,targets}: fix relative paths; turn missing targets into sources.

When we check dependencies and a previously-is_generated dependency
existed before, but no longer does, forget that it was is_generated.
This slightly improves the situation where as a project evolves, a file
that used to be a target gets removed, and then later is re-added as a
static source file.  (It doesn't fix the other variant, where a file is
changed from target to source in a single atomic change, and is never
missing.  That one will be trickier to handle.)

While adding a test for this behaviour, I discovered that redo-sources,
redo-targets, and redo-ood were reporting their output relative to
STARTDIR instead of relative to $PWD, so fix that too.
This commit is contained in:
Avery Pennarun 2018-11-23 18:20:32 -05:00
commit c06d1fba40
11 changed files with 89 additions and 8 deletions

13
deps.py
View file

@ -39,6 +39,17 @@ def isdirty(f, depth, max_changed,
if f.stamp != newstamp:
if newstamp == state.STAMP_MISSING:
debug('%s-- DIRTY (missing)\n' % depth)
if f.stamp and f.is_generated:
# previously was stamped and generated, but suddenly missing.
# We can safely forget that it is/was a target; if someone
# does redo-ifchange on it and it doesn't exist, we'll mark
# it a target again, but if someone creates it by hand,
# it'll be a source. This should reduce false alarms when
# files change from targets to sources as a project evolves.
debug('%s converted target -> source\n' % depth)
f.is_generated = False
#f.update_stamp()
f.save()
else:
debug('%s-- DIRTY (mtime)\n' % depth)
if f.csum:
@ -103,5 +114,3 @@ def isdirty(f, depth, max_changed,
state.warn_override(f.name)
set_checked(f)
return CLEAN