[elbe-devel] [PATCH v2 08/28] Add logging to buildchroot

Torben Hohn torben.hohn at linutronix.de
Wed Jun 26 14:50:11 CEST 2019


On Fri, Jun 21, 2019 at 07:40:00PM +0200, dion at linutronix.de wrote:
> From: Olivier Dion <dion at linutronix.de>
> 
> Signed-off-by: Olivier Dion <dion at linutronix.de>
> ---
>  elbepack/commands/buildchroot.py | 54 +++++++++++++++++++++-------------------
>  1 file changed, 29 insertions(+), 25 deletions(-)
> 
> diff --git a/elbepack/commands/buildchroot.py b/elbepack/commands/buildchroot.py
> index 5761f5e8..73eed1fc 100644
> --- a/elbepack/commands/buildchroot.py
> +++ b/elbepack/commands/buildchroot.py
> @@ -10,12 +10,14 @@ from __future__ import print_function
>  
>  from optparse import OptionParser
>  import sys
> +import os
>  
>  from elbepack.shellhelper import CommandError
>  from elbepack.elbeproject import ElbeProject
>  from elbepack.elbexml import ValidationError
>  from elbepack.db import ElbeDB
>  from elbepack.cdroms import CDROM_SIZE
> +from elbepack.log import elbe_logging
>  from sqlalchemy.exc import OperationalError
>  
>  
> @@ -87,28 +89,30 @@ def run_command(argv):
>          print("WARNING: Skip CDROMS is now the default, "
>                "use --build-bin to build binary CDROM")
>  
> -    try:
> -        project = ElbeProject(opt.target, args[0], opt.output, opt.name,
> -                              opt.buildtype, opt.skip_validation)
> -    except ValidationError as e:
> -        print(str(e))
> -        print("xml validation failed. Bailing out")
> -        sys.exit(20)
> -
> -    try:
> -        project.build(
> -            opt.build_bin,
> -            opt.build_sources,
> -            opt.cdrom_size,
> -            opt.skip_pkglist,
> -            opt.skip_pbuild)
> -    except CommandError as ce:
> -        print("command in project build failed: %s" % ce.cmd)
> -        sys.exit(20)
> -
> -    try:
> -        db = ElbeDB()
> -        db.save_project(project)
> -    except OperationalError:
> -        print("failed to save project in database")
> -        sys.exit(20)
> +    # Is opt.output necessary here?

opt.output is put into the logpath argument.
so, when opt.output is set, we want the logging to go there.

> +    with eble_logging(opt.target):

typo        ^^^^

> +        try:
> +            project = ElbeProject(opt.target, args[0], opt.output, opt.name,
> +                                  opt.buildtype, opt.skip_validation)

ElbeProject needs to have logpath argument removed, i think.

> +        except ValidationError as e:
> +            print(str(e))
> +            print("xml validation failed. Bailing out")
> +            sys.exit(20)
> +
> +        try:
> +            project.build(
> +                opt.build_bin,
> +                opt.build_sources,
> +                opt.cdrom_size,
> +                opt.skip_pkglist,
> +                opt.skip_pbuild)
> +        except CommandError as ce:
> +            print("command in project build failed: %s" % ce.cmd)

why print, instead of logging ?

> +            sys.exit(20)
> +
> +        try:
> +            db = ElbeDB()
> +            db.save_project(project)
> +        except OperationalError:
> +            print("failed to save project in database")
why print, instead of logging ?
> +            sys.exit(20)
> -- 
> 2.11.0
> 
> 
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel

-- 
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99

Hinweise zum Datenschutz finden Sie hier (Informations on data privacy 
can be found here): https://linutronix.de/kontakt/Datenschutz.php

Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen | 
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700 
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner



More information about the elbe-devel mailing list