summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-07-25 20:47:17 +1200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-07-26 08:56:32 +0100
commit25507bfa82fc3bc46624952f15278b491a85ad7d (patch)
tree4c44fc757a1d0df3e86693512c8990ccba2dd2aa
parentdd8540550fc0055cbd66b899ab226ca48e63b4f5 (diff)
downloadpoky-25507bfa82fc3bc46624952f15278b491a85ad7d.tar.gz
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]. (From OE-Core rev: 92a73e870478ddb2a2d137e3fff28828809bec2e) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oe/recipeutils.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/meta/lib/oe/recipeutils.py b/meta/lib/oe/recipeutils.py
index 0e7abf833b..c77664f135 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):
259 changed, tolines = bb.utils.edit_metadata(fromlines, varlist, patch_recipe_varfunc, match_overrides=True) 259 changed, tolines = bb.utils.edit_metadata(fromlines, varlist, patch_recipe_varfunc, match_overrides=True)
260 260
261 if remainingnames: 261 if remainingnames:
262 if tolines[-1].strip() != '': 262 if tolines and tolines[-1].strip() != '':
263 tolines.append('\n') 263 tolines.append('\n')
264 for k in remainingnames.keys(): 264 for k in remainingnames.keys():
265 outputvalue(k, tolines) 265 outputvalue(k, tolines)