[elbe-devel] [PATCH 25/25] handle licence generation exceptions

Manuel Traut manut at linutronix.de
Mon Dec 11 10:11:19 CET 2017


The code might raise execptions, see comments inline.
As long as the code is not reworked:

https://github.com/Linutronix/elbe/issues/133

a strict handling needs to be introduced to enable image builds even if
licence generation throws some errors.

Signed-off-by: Manuel Traut <manut at linutronix.de>
---
 elbepack/elbeproject.py | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/elbepack/elbeproject.py b/elbepack/elbeproject.py
index 2232b4c1..42161dc6 100644
--- a/elbepack/elbeproject.py
+++ b/elbepack/elbeproject.py
@@ -297,10 +297,15 @@ class ElbeProject (object):
         elbe_report( self.xml, self.buildenv, self.get_rpcaptcache(),
                 reportpath, self.targetfs )
 
-        # Licenses
-        f = io.open( os.path.join( self.builddir, "licence.txt" ), "w+", encoding='utf-8' )
-        self.buildenv.rfs.write_licenses(f, self.log, os.path.join( self.builddir, "licence.xml"))
-        f.close()
+        # the current license code raises an exception that interrupts the hole
+        # build if a licence can't be converted to utf-8. Exception handling can
+        # be removed as soon as the licence code is more stable
+        try:
+            f = io.open( os.path.join( self.builddir, "licence.txt" ), "w+", encoding='utf-8' )
+            self.buildenv.rfs.write_licenses(f, self.log, os.path.join( self.builddir, "licence.xml"))
+            f.close()
+        except Exception:
+            self.log.printo( "error during generating licence.txt/xml" )
 
         # Use some handwaving to determine grub version
         # jessie and wheezy grubs are 2.0 but differ in behaviour
-- 
2.15.1




More information about the elbe-devel mailing list