[elbe-devel] [PATCH 15/32] Add logging to opt.output for command adjustpkgs

dion at linutronix.de dion at linutronix.de
Fri Jun 14 22:13:29 CEST 2019


From: Olivier Dion <dion at linutronix.de>

Signed-off-by: Olivier Dion <dion at linutronix.de>
---
 elbepack/commands/adjustpkgs.py | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/elbepack/commands/adjustpkgs.py b/elbepack/commands/adjustpkgs.py
index f7dbdd0b..e0752b79 100644
--- a/elbepack/commands/adjustpkgs.py
+++ b/elbepack/commands/adjustpkgs.py
@@ -6,25 +6,24 @@
 
 from __future__ import print_function
 
+import os
 import sys
 from optparse import OptionParser
 
 import apt
 import apt.progress
 
-from elbepack.asciidoclog import ASCIIDocLog
 from elbepack.treeutils import etree
+from elbepack.log import log
 
 
 class adjpkg(object):
-    def __init__(self, logfile, name):
-
-        self.outf = ASCIIDocLog(logfile)
+    def __init__(self, name):
 
         if name:
-            self.outf.h1("ELBE Report for Project " + name)
+            log.h1("ELBE Report for Project " + name)
         else:
-            self.outf.h1("ELBE Report")
+            log.h1("ELBE Report")
 
     def set_pkgs(self, pkglist):
 
@@ -51,7 +50,7 @@ class adjpkg(object):
             for name in pkglist:
 
                 if name not in cache:
-                    self.outf.printo("- package %s does not exist" % name)
+                    log.warning('Package "%s" does not exist' % name)
                     errors += 1
                     continue
 
@@ -114,7 +113,9 @@ def run_command(argv):
         buildenv_pkgs = [p.et.text for p in xml.node(
             "project/buildimage/pkg-list")]
 
-    adj = adjpkg(opt.output, opt.name)
+
+    log.new(opt.output)
+    adj = adjpkg(opt.name)
     return adj.set_pkgs(xml_pkgs + mandatory_pkgs + buildenv_pkgs)
 
 
-- 
2.11.0




More information about the elbe-devel mailing list