]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
classes/externalsrc: ensure cleandirs code handles non-absolute paths
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Wed, 4 Apr 2018 11:02:36 +0000 (23:02 +1200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 5 Apr 2018 13:48:58 +0000 (14:48 +0100)
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.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/externalsrc.bbclass

index ce8517c58b7794090ad4b49b995a6c3acba3cdc1..c9f5cf767d082fc796b833965c8bcfc31bbc4937 100644 (file)
@@ -54,6 +54,7 @@ python () {
 
     if externalsrc:
         import oe.recipeutils
+        import oe.path
 
         d.setVar('S', externalsrc)
         if externalsrcbuild:
@@ -90,7 +91,7 @@ python () {
             cleandirs = oe.recipeutils.split_var_value(d.getVarFlag(task, 'cleandirs', False) or '')
             setvalue = False
             for cleandir in cleandirs[:]:
-                if d.expand(cleandir) == externalsrc:
+                if oe.path.is_path_parent(externalsrc, d.expand(cleandir)):
                     cleandirs.remove(cleandir)
                     setvalue = True
             if setvalue: