From ff0fc3fa841805cb45013d4fdb3c0ca142b7a330 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 5 Apr 2017 01:13:15 +0100 Subject: [PATCH] ownsrc debugging Signed-off-by: Ian Jackson --- hippotatd | 1 + hippotatlib/__init__.py | 6 ++++-- hippotatlib/ownsource.py | 6 ++++-- srcbombtest.py | 2 ++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/hippotatd b/hippotatd index a6d3179..399dfe7 100755 --- a/hippotatd +++ b/hippotatd @@ -265,6 +265,7 @@ def start_http(): ssp = SourceShipmentPreparer(td) ssp.logger = partial(log_debug, DBG.OWNSOURCE) + if DBG.OWNSOURCE in debug_set: ssp.stream_debug = sys.stdout ssp.generate() resource.putChild(b'source', twisted.web.static.File(ssp.output_paths[0])) diff --git a/hippotatlib/__init__.py b/hippotatlib/__init__.py index feb7894..8a26bee 100644 --- a/hippotatlib/__init__.py +++ b/hippotatlib/__init__.py @@ -567,7 +567,8 @@ def common_startup(process_cfg): def ds_default(od,os,dl,op): global debug_set - debug_set = set(dfs_less_detailed(debug_def_detail)) + debug_set.clear + debug_set |= set(dfs_less_detailed(debug_def_detail)) def ds_select(od,os, spec, op): for it in spec.split(','): @@ -639,7 +640,8 @@ just `+': all DFLAGs. print('\nInvalid configuration, giving up.', file=sys.stderr) sys.exit(12) - #print(repr(debug_set), file=sys.stderr) + + #print('X', debug_set, file=sys.stderr) log_formatter = twisted.logger.formatEventAsClassicLogText stdout_obs = twisted.logger.FileLogObserver(sys.stdout, log_formatter) diff --git a/hippotatlib/ownsource.py b/hippotatlib/ownsource.py index 8e30979..ac467f0 100644 --- a/hippotatlib/ownsource.py +++ b/hippotatlib/ownsource.py @@ -57,6 +57,8 @@ class SourceShipmentPreparer(): s.rune_shell = ['/bin/bash', '-ec'] s.show_pathnames = True s.download_packages = True + s.stream_stderr = sys.stderr + s.stream_debug = open('/dev/null','w') s.rune_cpio = r''' set -o pipefail ( @@ -274,8 +276,8 @@ class SourceShipmentPreparer(): subprocess.run(cmdl, cwd=s._packages_path, stdin=subprocess.DEVNULL, - stdout=sys.stdout, - stderr=sys.stderr, + stdout=s.stream_debug, + stderr=s.stream_stderr, restore_signals=True, check=True) diff --git a/srcbombtest.py b/srcbombtest.py index 25bc318..f0607ba 100755 --- a/srcbombtest.py +++ b/srcbombtest.py @@ -3,6 +3,8 @@ from hippotatlib.ownsource import SourceShipmentPreparer import twisted +import sys p = SourceShipmentPreparer('tmp') +p.stream_debug = sys.stdout p.generate() -- 2.11.0