From: Ola x Nilsson <ola.x.nilsson@axis.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH v2 1/2] externalsrc.bbclass: Add task buildclean
Date: Mon, 9 Jan 2017 17:20:32 +0100 [thread overview]
Message-ID: <1483978833-20276-1-git-send-email-olani@axis.com> (raw)
The buildclean task should call the package build system clean
command, just implemented for Make for now.
This is meant for recipes where S == B, but can be useful as a
standalone task for other recipes too.
When S == B, set it to run before do_clean which will do what most
developers expect when calling bitbake -c clean. For S != B, do not
add it before clean as it is not needed and may take some time.
Signed-off-by: Ola x Nilsson <olani@axis.com>
---
meta/classes/externalsrc.bbclass | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass
index e115a47..8acd10d 100644
--- a/meta/classes/externalsrc.bbclass
+++ b/meta/classes/externalsrc.bbclass
@@ -108,6 +108,10 @@ python () {
# We don't want the workdir to go away
d.appendVar('RM_WORK_EXCLUDE', ' ' + d.getVar('PN'))
+ bb.build.addtask('do_buildclean',
+ 'do_clean' if d.getVar('S') == d.getVar('B') else None,
+ None, d)
+
# If B=S the same builddir is used even for different architectures.
# Thus, use a shared CONFIGURESTAMPFILE and STAMP directory so that
# change of do_configure task hash is correctly detected and stamps are
@@ -142,6 +146,17 @@ python externalsrc_compile_prefunc() {
bb.plain('NOTE: %s: compiling from external source tree %s' % (d.getVar('PN'), d.getVar('EXTERNALSRC')))
}
+do_buildclean[dirs] = "${S} ${B}"
+do_buildclean[nostamp] = "1"
+do_buildclean[doc] = "Call 'make clean' or equivalent in ${B}"
+externalsrc_do_buildclean() {
+ if [ -e Makefile -o -e makefile -o -e GNUmakefile ]; then
+ oe_runmake clean || die "make failed"
+ else
+ bbnote "nothing to do - no makefile found"
+ fi
+}
+
def srctree_hash_files(d):
import shutil
import subprocess
@@ -188,3 +203,5 @@ def srctree_configure_hash_files(d):
if f in search_files:
out_items.append('%s:True' % os.path.join(root, f))
return ' '.join(out_items)
+
+EXPORT_FUNCTIONS do_buildclean
--
2.1.4
next reply other threads:[~2017-01-09 16:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-09 16:20 Ola x Nilsson [this message]
2017-01-09 16:20 ` [PATCH v2 2/2] oe-selftest: devtool: Add test for externalsrc buildclean Ola x Nilsson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1483978833-20276-1-git-send-email-olani@axis.com \
--to=ola.x.nilsson@axis.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox