[elbe-devel] [PATCH v2 16/28] Add logging to opt.output for command adjustpkgs
dion at linutronix.de
dion at linutronix.de
Fri Jun 21 19:40:08 CEST 2019
From: Olivier Dion <dion at linutronix.de>
Signed-off-by: Olivier Dion <dion at linutronix.de>
---
elbepack/commands/adjustpkgs.py | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/elbepack/commands/adjustpkgs.py b/elbepack/commands/adjustpkgs.py
index f7dbdd0b..0cacb969 100644
--- a/elbepack/commands/adjustpkgs.py
+++ b/elbepack/commands/adjustpkgs.py
@@ -6,25 +6,25 @@
from __future__ import print_function
+import logging
+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 elbe_logging
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)
+ logging.info("ELBE Report for Project " + name)
else:
- self.outf.h1("ELBE Report")
+ logging.info("ELBE Report")
def set_pkgs(self, pkglist):
@@ -51,7 +51,7 @@ class adjpkg(object):
for name in pkglist:
if name not in cache:
- self.outf.printo("- package %s does not exist" % name)
+ logging.warning('Package "%s" does not exist' % name)
errors += 1
continue
@@ -114,8 +114,10 @@ def run_command(argv):
buildenv_pkgs = [p.et.text for p in xml.node(
"project/buildimage/pkg-list")]
- adj = adjpkg(opt.output, opt.name)
- return adj.set_pkgs(xml_pkgs + mandatory_pkgs + buildenv_pkgs)
+
+ with elbe_logging(opt.output):
+ adj = adjpkg(opt.name)
+ return adj.set_pkgs(xml_pkgs + mandatory_pkgs + buildenv_pkgs)
if __name__ == "__main__":
--
2.11.0
More information about the elbe-devel
mailing list