[gnome-continuous-yocto/gnomeostree-3.28-rocko: 4542/8267] devtool: improve parse failure handling



commit e8f4e06e762670c6e451dc4028be7c3cccd71c46
Author: Paul Eggleton <paul eggleton linux intel com>
Date:   Tue Feb 7 09:45:43 2017 +1300

    devtool: improve parse failure handling
    
    With the move to tinfoil2, the behaviour when parsing failed has changed
    a bit - exceptions are now raised, so handle these appropriately.
    Specifically when if parsing the recipe created when running devtool add
    fails, rename it to .bb.parsefailed so that the user can run bitbake
    afterwards without parsing being interrupted.
    
    (From OE-Core rev: b9592bd3c1ab2155b9f62d18ce593b9c88eff279)
    
    Signed-off-by: Paul Eggleton <paul eggleton linux intel com>
    Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>

 scripts/lib/devtool/__init__.py |    7 ++++++-
 scripts/lib/devtool/standard.py |   11 ++++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py
index fd2f042..91111e1 100644
--- a/scripts/lib/devtool/__init__.py
+++ b/scripts/lib/devtool/__init__.py
@@ -135,7 +135,12 @@ def parse_recipe(config, tinfoil, pn, appends, filter_workspace=True):
                             not path.startswith(config.workspace_path)]
     else:
         append_files = None
-    return tinfoil.parse_recipe_file(recipefile, appends, append_files)
+    try:
+        rd = tinfoil.parse_recipe_file(recipefile, appends, append_files)
+    except Exception as e:
+        logger.error(str(e))
+        return None
+    return rd
 
 def check_workspace_recipe(workspace, pn, checksrc=True, bbclassextend=False):
     """
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 30b247f..5bd498c 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -224,8 +224,17 @@ def add(args, config, basepath, workspace):
 
     tinfoil = setup_tinfoil(config_only=True, basepath=basepath)
     try:
-        rd = tinfoil.parse_recipe_file(recipefile, False)
+        try:
+            rd = tinfoil.parse_recipe_file(recipefile, False)
+        except Exception as e:
+            logger.error(str(e))
+            rd = None
         if not rd:
+            # Parsing failed. We just created this recipe and we shouldn't
+            # leave it in the workdir or it'll prevent bitbake from starting
+            movefn = '%s.parsefailed' % recipefile
+            logger.error('Parsing newly created recipe failed, moving recipe to %s for reference. If this 
looks to be caused by the recipe itself, please report this error.' % movefn)
+            shutil.move(recipefile, movefn)
             return 1
 
         if args.fetchuri and not args.no_git:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]