apenwarr-redo/redo-ood.py
Avery Pennarun c06d1fba40 {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.
2018-11-23 19:18:43 -05:00

30 lines
681 B
Python
Executable file

#!/usr/bin/env python2
import sys, os
import vars_init
vars_init.init([])
import vars, state, deps
from logs import err
if len(sys.argv[1:]) != 0:
err('%s: no arguments expected.\n' % sys.argv[0])
sys.exit(1)
cache = {}
def is_checked(f):
return cache.get(f.id, 0)
def set_checked(f):
cache[f.id] = 1
cwd = os.getcwd()
for f in state.files():
if f.is_generated and f.read_stamp() != state.STAMP_MISSING:
if deps.isdirty(f, depth='', max_changed=vars.RUNID,
already_checked=[],
is_checked=is_checked, set_checked=set_checked):
print state.relpath(os.path.join(vars.BASE, f.name), cwd)