aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2017-11-29 15:00:52 +1300
committerPaul Eggleton <paul.eggleton@linux.intel.com>2017-12-05 14:39:23 +1300
commita99c084e27b0c41bb7fabd8e33d26f014c541cc3 (patch)
tree9f2fa64bc7ba10d7e52e36c06edc143eb81c74e8
parent14d9372e1dd715028f9ec181ffda89e43c7cb867 (diff)
downloadopenembedded-core-contrib-a99c084e27b0c41bb7fabd8e33d26f014c541cc3.tar.gz
lib/oe/recipeutils: allow patch_recipe_file() to be re-called
If patch_recipe_file() is called with output redirection on the same file twice in succession, then we don't want to wipe out the changes the first call made so we need to be reading in the redirected file if it exists instead of the original one. This is important to enable devtool finish to work with multiple source trees within the same recipe. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
-rw-r--r--meta/lib/oe/recipeutils.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/meta/lib/oe/recipeutils.py b/meta/lib/oe/recipeutils.py
index 4e0859e6d9..49287273c9 100644
--- a/meta/lib/oe/recipeutils.py
+++ b/meta/lib/oe/recipeutils.py
@@ -258,13 +258,18 @@ def patch_recipe_file(fn, values, patch=False, relpath='', redirect_output=None)
since this cannot handle all situations.
"""
- with open(fn, 'r') as f:
+ read_fn = fn
+ if redirect_output:
+ redirect_fn = os.path.join(redirect_output, os.path.basename(fn))
+ if os.path.exists(redirect_fn):
+ read_fn = redirect_fn
+ with open(read_fn, 'r') as f:
fromlines = f.readlines()
_, tolines = patch_recipe_lines(fromlines, values)
if redirect_output:
- with open(os.path.join(redirect_output, os.path.basename(fn)), 'w') as f:
+ with open(redirect_fn, 'w') as f:
f.writelines(tolines)
return None
elif patch: