[oe-commits] [openembedded-core] 59/60: lib/oe/recipeutils: fix patch_recipe*() with empty input

git at git.openembedded.org git at git.openembedded.org
Mon Jul 25 08:59:26 UTC 2016


rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit cb686d8113dfd77165f33bd54680a26893ef13e3
Author: Paul Eggleton <paul.eggleton at linux.intel.com>
AuthorDate: Mon Jul 25 20:47:17 2016 +1200

    lib/oe/recipeutils: fix patch_recipe*() with empty input
    
    If you supplied an empty file to patch_recipe() (or an empty list to
    patch_recipe_lines()) then the result was IndexError because the code
    checking to see if it needed to add an extra line of padding didn't
    check to see if there were in fact any lines before trying to access the
    last line.
    
    Fixes [YOCTO #9972].
    
    Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/lib/oe/recipeutils.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/lib/oe/recipeutils.py b/meta/lib/oe/recipeutils.py
index 0e7abf8..c77664f 100644
--- a/meta/lib/oe/recipeutils.py
+++ b/meta/lib/oe/recipeutils.py
@@ -259,7 +259,7 @@ def patch_recipe_lines(fromlines, values, trailing_newline=True):
     changed, tolines = bb.utils.edit_metadata(fromlines, varlist, patch_recipe_varfunc, match_overrides=True)
 
     if remainingnames:
-        if tolines[-1].strip() != '':
+        if tolines and tolines[-1].strip() != '':
             tolines.append('\n')
         for k in remainingnames.keys():
             outputvalue(k, tolines)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list