apenwarr-redo/redo-ood.py
Avery Pennarun 711b05766f Print a better message when detecting pre-existing cyclic dependencies.
We already printed an error at build time, but added the broken
dependency anyway.  If the .do script decided to succeed despite
redo-ifchange aborting, the target would be successfully created
and we'd end up with an infinite loop when running isdirty() later.

The result was still "correct", because python helpfully aborted
the infinite loop after the recursion got too deep.  But let's
explicitly detect it and print a better error message.

(Thanks to Nils Dagsson Moskopp's redo-testcases repo for exposing this
problem.  If you put a #!/bin/sh header on your .do script means you
need to run 'set -e' yourself if you want .do scripts to abort after an
error, which you almost always do, and those testcases don't, which
exposed this bug if you ran the tests twice.)
2018-11-02 02:20:52 -04:00

29 lines
622 B
Python
Executable file

#!/usr/bin/env python
import sys, os
import vars_init
vars_init.init([])
import vars, state, deps
from log 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
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 f.nicename()