[oe-commits] Paul Eggleton : classes/externalsrc: fix source being wiped out on clean with kernel

git at git.openembedded.org git at git.openembedded.org
Thu Feb 19 23:16:45 UTC 2015


Module: openembedded-core.git
Branch: master-next
Commit: a25421ad996367e48f65aa21f20f13d19f92fd45
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=a25421ad996367e48f65aa21f20f13d19f92fd45

Author: Paul Eggleton <paul.eggleton at linux.intel.com>
Date:   Thu Feb 19 16:39:52 2015 +0000

classes/externalsrc: fix source being wiped out on clean with kernel

kernel.bbclass adds ${S} do do_clean[cleandirs], but this means if you
run bitbake -c clean <kernelrecipe> then your external source tree will
be trashed, which could be a disaster. For safety, remove ${S} from
cleandirs for every task. We also have to do the same for ${B} in the
case where EXTERNALSRC_BUILD is set to the same value as EXTERNALSRC.

Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 meta/classes/externalsrc.bbclass | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass
index 4e429d7..e372392 100644
--- a/meta/classes/externalsrc.bbclass
+++ b/meta/classes/externalsrc.bbclass
@@ -47,6 +47,20 @@ python () {
                 # Since configure will likely touch ${S}, ensure only we lock so one task has access at a time
                 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}')
+                    setvalue = True
+                if externalsrcbuild == externalsrc and '${B}' in cleandirs:
+                    cleandirs.remove('${B}')
+                    setvalue = True
+                if setvalue:
+                    d.setVarFlag(task, 'cleandirs', ' '.join(cleandirs))
+
         for task in d.getVar("SRCTREECOVEREDTASKS", True).split():
             bb.build.deltask(task, d)
 



More information about the Openembedded-commits mailing list