]> code.ossystems Code Review - openembedded-core.git/commitdiff
externalsrc.bbclass: better filtering of cleandirs
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 8 Sep 2015 10:36:40 +0000 (13:36 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 12 Sep 2015 21:47:06 +0000 (22:47 +0100)
We really do not want our (external) source tree to be removed. There
might be multiple values in the 'cleandirs' varflag pointing to our
source tree - causing it to be wiped out. This patch improves the
filtering of 'cleandirs' by examining the expanded values inside it. Any
(expanded) values pointing to our source tree get removed.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/classes/externalsrc.bbclass

index 37c6320fca71c88d07db2a67172b3ce8d251f8fc..0fa5817d9af6790598c7fcd754c5b0a2565d2706 100644 (file)
@@ -62,18 +62,14 @@ python () {
                 d.appendVarFlag(task, "lockfiles", " ${S}/singletask.lock")
 
             # We do not want our source to be wiped out, ever (kernel.bbclass does this for do_clean)
-            cleandirs = d.getVarFlag(task, 'cleandirs', False)
-            if cleandirs:
-                cleandirs = cleandirs.split()
-                setvalue = False
-                if '${S}' in cleandirs:
-                    cleandirs.remove('${S}')
+            cleandirs = (d.getVarFlag(task, 'cleandirs', False) or '').split()
+            setvalue = False
+            for cleandir in cleandirs[:]:
+                if d.expand(cleandir) == externalsrc:
+                    cleandirs.remove(cleandir)
                     setvalue = True
-                if externalsrcbuild == externalsrc and '${B}' in cleandirs:
-                    cleandirs.remove('${B}')
-                    setvalue = True
-                if setvalue:
-                    d.setVarFlag(task, 'cleandirs', ' '.join(cleandirs))
+            if setvalue:
+                d.setVarFlag(task, 'cleandirs', ' '.join(cleandirs))
 
         fetch_tasks = ['do_fetch', 'do_unpack']
         # If we deltask do_patch, there's no dependency to ensure do_unpack gets run, so add one