This makes them more reliable to parse. redo-log can parse each line, format and print it, then recurse if necessary. This got a little ugly because I wanted 'redo --raw-logs' to work, which we want to format the output nicely, but not call redo-log. (As a result, --raw-logs has a different meaning to redo and redo-log, which is kinda dumb. I should fix that.) As an added bonus, redo-log now handles indenting of recursive logs, so if the build was a -> a/b -> a/b/c, and you look at the log for a/b, it can still start at the top level indentation.
35 lines
984 B
Python
Executable file
35 lines
984 B
Python
Executable file
#!/usr/bin/env python2
|
|
import sys, os
|
|
import state
|
|
from logs import err
|
|
|
|
if len(sys.argv[1:]) < 2:
|
|
err('%s: at least 2 arguments expected.\n' % sys.argv[0])
|
|
sys.exit(1)
|
|
|
|
target = sys.argv[1]
|
|
deps = sys.argv[2:]
|
|
|
|
for d in deps:
|
|
assert(d != target)
|
|
|
|
me = state.File(name=target)
|
|
|
|
# Build the known dependencies of our primary target. This *does* require
|
|
# grabbing locks.
|
|
os.environ['REDO_NO_OOB'] = '1'
|
|
argv = ['redo-ifchange'] + deps
|
|
rv = os.spawnvp(os.P_WAIT, argv[0], argv)
|
|
if rv:
|
|
sys.exit(rv)
|
|
|
|
# We know our caller already owns the lock on target, so we don't have to
|
|
# acquire another one; tell redo-ifchange about that. Also, REDO_NO_OOB
|
|
# persists from up above, because we don't want to do OOB now either.
|
|
# (Actually it's most important for the primary target, since it's the one
|
|
# who initiated the OOB in the first place.)
|
|
os.environ['REDO_UNLOCKED'] = '1'
|
|
argv = ['redo-ifchange', target]
|
|
rv = os.spawnvp(os.P_WAIT, argv[0], argv)
|
|
if rv:
|
|
sys.exit(rv)
|