chiark / gitweb /
ownsrc debugging
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 5 Apr 2017 00:13:15 +0000 (01:13 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 5 Apr 2017 00:13:15 +0000 (01:13 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
hippotatd
hippotatlib/__init__.py
hippotatlib/ownsource.py
srcbombtest.py

index a6d3179..399dfe7 100755 (executable)
--- 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]))
index feb7894..8a26bee 100644 (file)
@@ -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)
index 8e30979..ac467f0 100644 (file)
@@ -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)
 
index 25bc318..f0607ba 100755 (executable)
@@ -3,6 +3,8 @@
 from hippotatlib.ownsource import SourceShipmentPreparer
 
 import twisted
+import sys
 
 p = SourceShipmentPreparer('tmp')
+p.stream_debug = sys.stdout
 p.generate()