[elbe-devel] [PATCH 27/32] Nuke ASCIIDocLog from "pkgutils.py"
dion at linutronix.de
dion at linutronix.de
Fri Jun 14 22:13:41 CEST 2019
From: Olivier Dion <dion at linutronix.de>
Signed-off-by: Olivier Dion <dion at linutronix.de>
---
elbepack/pkgutils.py | 29 ++++++++++++-----------------
1 file changed, 12 insertions(+), 17 deletions(-)
diff --git a/elbepack/pkgutils.py b/elbepack/pkgutils.py
index a5355863..4187ae2d 100644
--- a/elbepack/pkgutils.py
+++ b/elbepack/pkgutils.py
@@ -10,9 +10,10 @@ from __future__ import print_function
import os
from apt_pkg import TagFile
-from elbepack.shellhelper import CommandError, system
+from elbepack.shellhelper import CommandError, system, do
from elbepack.virtapt import get_virtaptcache
from elbepack.hashes import validate_sha256, HashValidationFailed
+from elbepack.log import log
class NoPackageException(Exception):
@@ -91,8 +92,7 @@ def download_pkg(prj,
defs,
package,
arch="default",
- incl_deps=False,
- log=None):
+ incl_deps=False):
# pylint: disable=too-many-arguments
# pylint: disable=too-many-locals
@@ -132,37 +132,32 @@ def download_pkg(prj,
raise NoPackageException('%s failed to verify: %s' % package,
e.message)
else:
- if log:
- log.printo("WARNING: Using untrusted %s package" % package)
- else:
- print("-----------------------------------------------------")
- print("WARNING:")
- print("Using untrusted %s package" % package)
- print("-----------------------------------------------------")
+ log.warning("Using unstrusted %s package" % package,
+ header="WARNING")
return [y[0] for y in urilist]
-def extract_pkg(prj, target_dir, defs, package, arch, log, incl_deps=False):
+def extract_pkg(prj, target_dir, defs, package, arch, incl_deps=False):
# pylint: disable=too-many-arguments
- pkgs = download_pkg(prj, target_dir, defs, package, arch, incl_deps, log)
+ pkgs = download_pkg(prj, target_dir, defs, package, arch, incl_deps)
for package in pkgs:
ppath = os.path.join(target_dir, "%s.deb" % package)
try:
- log.do('dpkg -x "%s" "%s"' % (ppath, target_dir))
+ do('dpkg -x "%s" "%s"' % (ppath, target_dir))
except CommandError:
try:
# dpkg did not work, try falling back to ar and tar
- log.do('ar p "%s" data.tar.gz | tar xz -C "%s"' % (ppath,
+ do('ar p "%s" data.tar.gz | tar xz -C "%s"' % (ppath,
target_dir))
except CommandError:
try:
- log.do('ar p "%s" data.tar.xz | tar xJ -C "%s"' % (
+ do('ar p "%s" data.tar.xz | tar xJ -C "%s"' % (
ppath, target_dir))
except CommandError as e:
- log.printo("extract %s failed: %s\n" % (ppath, e))
+ log.error(e, header="extract %s failed" % ppath)
raise e
- log.do('rm -f "%s"' % ppath)
+ do('rm -f "%s"' % ppath)
--
2.11.0
More information about the elbe-devel
mailing list