[OE-core] [PATCH 07/12] lib/oe/recipeutils: allow patch_recipe_file() to be re-called
Paul Eggleton
paul.eggleton at linux.intel.com
Tue Dec 5 01:41:16 UTC 2017
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 at linux.intel.com>
---
meta/lib/oe/recipeutils.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/meta/lib/oe/recipeutils.py b/meta/lib/oe/recipeutils.py
index 4e0859e..4928727 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:
--
2.9.5
More information about the Openembedded-core
mailing list