]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
devtool: improve parse failure handling paule/devtool25
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Tue, 31 Jan 2017 20:56:14 +0000 (09:56 +1300)
committerPaul Eggleton <paul.eggleton@linux.intel.com>
Mon, 6 Feb 2017 20:43:52 +0000 (09:43 +1300)
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.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
scripts/create-pull-request
scripts/lib/devtool/__init__.py
scripts/lib/devtool/standard.py

index e82858bc983769400845bc34fcc1c2c0c597af67..7c6b96d5c41ada3cce50cf4dea34ceb9f7f3c1ee 100755 (executable)
@@ -183,6 +183,7 @@ if [ -n "$WEB_URL" ]; then
                git push $REMOTE $L_BRANCH:$BRANCH
                echo ""
        fi
+       echo $WEB_URL
        wget --no-check-certificate -q $WEB_URL -O /dev/null
        if [ $? -ne 0 ]; then
                echo "WARNING: Branch '$BRANCH' was not found on the contrib git tree."
index fd2f042ba520ef897642556b604bc0ecbe792d14..91111e11092cac0610eb0cb65f25e704491509b2 100644 (file)
@@ -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):
     """
index 30b247fa74c841b29819d3ae2ea5f82dac08e418..5bd498c933d79d9ccd49ba8bf05de0135c434252 100644 (file)
@@ -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: