chiark / gitweb /
ownsource: logging etc.
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 4 Apr 2017 16:27:43 +0000 (17:27 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 4 Apr 2017 16:27:43 +0000 (17:27 +0100)
hippotatlib/ownsource.py

index 4369cb9..012458f 100644 (file)
@@ -11,7 +11,9 @@ class SourceShipmentPreparer():
   def __init__(s, destdir):
     # caller may modify, and should read after calling generate()
     s.output_name = 'srcbomb.tar.gz'
+    # s.output_path   alternatively caller may read this
     # defaults, caller can modify after creation
+    s.logger = lambda m: print('SourceShipmentPreparer',m)
     s.src_filter = s.src_filter_glob
     s.src_package_globs = ['!/usr/local/*', '/usr*']
     s.src_filter_globs = ['!/etc/*']
@@ -154,6 +156,9 @@ class SourceShipmentPreparer():
     s._dirmap[d] = name
     fh = s.open_output_fh(name, 'wb')
 
+    s.logger('packing up into %s: %s (because %s)' %
+             (name, d, ' '.join(infol)))
+
     subprocess.run(s.rune_shell + [total_rune],
                    cwd=d,
                    stdin=subprocess.DEVNULL,
@@ -218,6 +223,8 @@ class SourceShipmentPreparer():
       debfname = '%s_%s_%s.deb' % (pi['binary'], pi['version'], pi['arch'])
       dscfname = '%s_%s.dsc' % (pi['source'], pi['sourceversion'])
       s.manifest_append_absentfile(dscfname, [debfname])
+      s.logger('mentioning %s and %s because %s' %
+               (dscfname, debfname, pi['files'][0]))
       for fname in pi['files']:
         infol = files[fname]
         if s.show_pathnames: infol = infol + ['loaded='+fname]
@@ -261,14 +268,17 @@ class SourceShipmentPreparer():
       s.src_indir(fname, infol)
 
   def srcs_allitems(s, dirs=sys.path):
+    s.logger('allitems')
     s.src_argv0(sys.argv[0], ['argv[0]'])
     for d in sys.path:
       s.src_syspath(d, ['sys.path'])
     for m in sys.modules.values():
       s.src_module(m, ['sys.modules'])
     s.report_from_packages(s._package_files)
+    s.logger('allitems done')
 
   def mk_portmanteau(s):
+    s.logger('making portmanteau')
     cmdl = s.rune_shell + [ s.rune_portmanteau, 'x',
                             s.output_name, s.manifest_name ]
     mfh = s.open_output_fh(s.manifest_name,'w')
@@ -284,6 +294,8 @@ class SourceShipmentPreparer():
                    stdout=sys.stderr,
                    restore_signals=True,
                    check=True)
+    s.output_path = os.path.join(s._destdir, s.output_name)
+    s.logger('portmanteau ready in %s' % s.output_path)
 
   def generate(s):
     s.srcs_allitems()