From: Paul Eggleton Date: Thu, 19 Feb 2015 16:39:52 +0000 (+0000) Subject: classes/externalsrc: fix source being wiped out on clean with kernel X-Git-Tag: lucaceresoli/bug-15201-perf-libtraceevent-missing~31150 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b5071fb2667b8751885d38ca62fa36c870177cd5;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git 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 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 Signed-off-by: Richard Purdie --- diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass index 4e429d78d81..e3723928014 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)