[elbe-devel] [PATCH 6/6] virtapt: add VirtaptError Exception, and throw it when do_downloads() errors

Torben Hohn torben.hohn at linutronix.de
Mon Jul 8 16:27:13 CEST 2019


printing the return value is not useful.

throw and Exception, when the package download does not work.

Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
 elbepack/virtapt.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/elbepack/virtapt.py b/elbepack/virtapt.py
index f74facd0c..58f1efbbe 100644
--- a/elbepack/virtapt.py
+++ b/elbepack/virtapt.py
@@ -28,6 +28,9 @@ from elbepack.xmldefaults import ElbeDefaults
 from elbepack.rfs import create_apt_prefs
 
 
+class VirtaptError(Exception):
+    pass
+
 def getdeps(pkg):
     for dd in pkg.depends_list.get("Depends", []):
         for d in dd:
@@ -242,7 +245,8 @@ class VirtApt(object):
 
     def do_downloads(self):
         res = self.acquire.run()
-        print(res)
+        if res != 0:
+            raise VirtaptError('download failed')
 
     def get_downloaded_files(self):
         ret = []
-- 
2.11.0




More information about the elbe-devel mailing list