[elbe-devel] [PATCH v3 52/52] Add 'logging' and missing 'do' to updatepkg.py

dion at linutronix.de dion at linutronix.de
Thu Jun 27 14:45:06 CEST 2019


From: Olivier Dion <dion at linutronix.de>

Signed-off-by: Olivier Dion <dion at linutronix.de>
---
 elbepack/updatepkg.py | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/elbepack/updatepkg.py b/elbepack/updatepkg.py
index 16570355..a5441068 100644
--- a/elbepack/updatepkg.py
+++ b/elbepack/updatepkg.py
@@ -4,8 +4,6 @@
 #
 # SPDX-License-Identifier: GPL-3.0-or-later
 
-from __future__ import print_function
-
 import os
 import logging
 
@@ -15,6 +13,7 @@ from elbepack.elbexml import ElbeXML
 from elbepack.dump import dump_fullpkgs
 from elbepack.ziparchives import create_zip_archive
 from elbepack.repomanager import UpdateRepo
+from elbepack.shellhelper import do
 
 
 class MissingData(Exception):
@@ -75,7 +74,7 @@ def gen_update_pkg(project, xml_filename, upd_filename,
             xmlindex[name] = p
 
             if name not in instindex:
-                print("package removed: %s" % name)
+                logging.info("Package removed: %s", )
                 continue
 
             ipkg = instindex[name]
@@ -84,24 +83,23 @@ def gen_update_pkg(project, xml_filename, upd_filename,
             pfname = ipkg.installed_deb
 
             if comp == 0:
-                print("package ok: %s-%s" % (name, ipkg.installed_version))
+                logging.info("Package ok: %s-%s", name, ipkg.installed_version)
                 if debug:
                     fnamelist.append(pfname)
                 continue
 
             if comp > 0:
-                print("package upgrade: %s" % pfname)
+                logging.info("Package upgrade: %s", pfname)
                 fnamelist.append(pfname)
             else:
-                print(
-                    "package downgrade: %s-%s" %
-                    (name, ipkg.installed_version))
+                logging.info("Package downgrade: %s-%s",
+                             name, ipkg.installed_version)
 
         for p in instpkgs:
             if p.name in xmlindex:
                 continue
 
-            print("package %s newly installed" % p.name)
+            logging.info("Package %s newly installed", p.name)
             pfname = p.installed_deb
             fnamelist.append(pfname)
 
@@ -156,8 +154,7 @@ def gen_update_pkg(project, xml_filename, upd_filename,
 
     if project.postbuild_file:
         logging.info("Postbuild script")
-        do(project.postbuild_file + ' "%s %s %s"' % (
-            upd_filename,
-            project.xml.text("project/version"),
-            project.xml.text("project/name")),
-           allow_fail=True)
+        cmd = ' "%s %s %s"' % (upd_filename,
+                               project.xml.text("project/version"),
+                               project.xml.text("project/name"))
+        do(project.postbuild_file + cmd, allow_fail=True)
-- 
2.11.0




More information about the elbe-devel mailing list