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

Torben Hohn torben.hohn at linutronix.de
Mon Dec 18 11:10:19 CET 2017


On Mon, Dec 11, 2017 at 10:11:19AM +0100, Manuel Traut wrote:
> 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" )

This is too simple, and the error message will not be informative.

Please log the exception, that is thrown.
We also want to know the filename which is causing the problem.

And, we agreed, that in case of an error with one license, we dont
generate the licence file. So the licence file has to be removed here.
and we mus make sure, that its not added to the images list, of files
downloaeded from initvm.

>  
>          # Use some handwaving to determine grub version
>          # jessie and wheezy grubs are 2.0 but differ in behaviour
> -- 
> 2.15.1
> 
> 
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel

-- 
Mit freundlichen Grüßen
Torben Hohn

Linutronix GmbH

Standort: Bremen

Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99

Firmensitz / Registered Office: D-88690 Uhldingen, Bahnhofstr. 3
Registergericht / Local District Court: Amtsgericht Freiburg i. Br.; HRB
Nr. / Trade register no.: 700 806

Geschäftsführer / Managing Directors: Heinz Egger, Thomas Gleixner

Eine Bitte von uns: Sollten Sie diese E-Mail irrtümlich erhalten haben,
benachrichtigen Sie uns in diesem Falle bitte sobald wie es Ihnen
möglich ist, durch Antwort-Mail. Vielen Dank!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.linutronix.de/pipermail/elbe-devel/attachments/20171218/5fe959fa/attachment-0001.sig>


More information about the elbe-devel mailing list