Change -x/-v to only affect top-level targets by default, not recursively.

Because redo targets are nicely isolated (unlike make targets), you
usually only want to debug one of them at a time.  Using -x could be
confusing, because you might end up with a dump of output from a
dependency you're not interested in.

Now, by default we'll disable -x when recursing into sub-targets, so
you only see the trace from the targets you are actually trying to
debug.  To get recursive behaviour, specify -x twice, eg. -xx.

Same idea with -v.
This commit is contained in:
Avery Pennarun 2019-03-02 18:46:00 -05:00
commit b196315222
4 changed files with 15 additions and 7 deletions

View file

@ -292,7 +292,7 @@ class _BuildJob(object):
jobserver.start(self.t, jobfunc=subtask, donefunc=job_exited)
def _subproc(self, dodir, basename, ext, argv):
"""The function by jobserver.start to exec the build script.
"""The function called by jobserver.start to exec the build script.
This is run in the *child* process.
"""
@ -306,6 +306,10 @@ class _BuildJob(object):
os.environ['REDO_PWD'] = state.relpath(newp, env.v.STARTDIR)
os.environ['REDO_TARGET'] = basename + ext
os.environ['REDO_DEPTH'] = env.v.DEPTH + ' '
if env.v.XTRACE == 1:
os.environ['REDO_XTRACE'] = '0'
if env.v.VERBOSE == 1:
os.environ['REDO_VERBOSE'] = '0'
cycles.add(self.lock.fid)
if dodir:
os.chdir(dodir)