diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2018-04-04 23:02:36 +1200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-04-05 14:49:07 +0100 |
commit | 5e6ffb2adbf544700470bbdb9428c2e020c9f8a6 (patch) | |
tree | 60c58ad8a7ac9ebbe75bceafa4557277a032df8b /meta | |
parent | eb37cdd8908380e02460111f1739bd1cc0a22d8e (diff) | |
download | poky-5e6ffb2adbf544700470bbdb9428c2e020c9f8a6.tar.gz |
classes/externalsrc: ensure cleandirs code handles non-absolute paths
It's possible that a trailing or extra slash somewhere in the external
source path could result in the directory not being removed from
cleandirs; it's also possible that a cleandirs entry is somewhere
underneath the source tree and that tree should never have parts of it
deleted by the build system. Use oe.path.is_path_parent() (which makes
paths absolute before checking them) to find out if any path in
cleandirs is anywhere underneath the external source path, and drop it
if it is.
(From OE-Core rev: 87ec0fb470274d980f8553a85f778809c269c5d7)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/externalsrc.bbclass | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass index ce8517c58b..c9f5cf767d 100644 --- a/meta/classes/externalsrc.bbclass +++ b/meta/classes/externalsrc.bbclass | |||
@@ -54,6 +54,7 @@ python () { | |||
54 | 54 | ||
55 | if externalsrc: | 55 | if externalsrc: |
56 | import oe.recipeutils | 56 | import oe.recipeutils |
57 | import oe.path | ||
57 | 58 | ||
58 | d.setVar('S', externalsrc) | 59 | d.setVar('S', externalsrc) |
59 | if externalsrcbuild: | 60 | if externalsrcbuild: |
@@ -90,7 +91,7 @@ python () { | |||
90 | cleandirs = oe.recipeutils.split_var_value(d.getVarFlag(task, 'cleandirs', False) or '') | 91 | cleandirs = oe.recipeutils.split_var_value(d.getVarFlag(task, 'cleandirs', False) or '') |
91 | setvalue = False | 92 | setvalue = False |
92 | for cleandir in cleandirs[:]: | 93 | for cleandir in cleandirs[:]: |
93 | if d.expand(cleandir) == externalsrc: | 94 | if oe.path.is_path_parent(externalsrc, d.expand(cleandir)): |
94 | cleandirs.remove(cleandir) | 95 | cleandirs.remove(cleandir) |
95 | setvalue = True | 96 | setvalue = True |
96 | if setvalue: | 97 | if setvalue: |