aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-07-25 11:04:15 +1200
committerPaul Eggleton <paul.eggleton@linux.intel.com>2016-07-25 20:45:41 +1200
commit6e980bf908d294687167afc3e0b3cbf44255dbfb (patch)
tree40ee0ece5f81b0d21f5c5cf676caabb7338149e2
parent0a2df616a5c3316704742f1dcf37b450920e0280 (diff)
downloadopenembedded-core-contrib-6e980bf908d294687167afc3e0b3cbf44255dbfb.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]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
-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):
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)