diff options
author | Ola x Nilsson <ola.x.nilsson@axis.com> | 2017-01-09 17:44:57 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-01-16 18:01:53 +0000 |
commit | cfaad320d9565003e97893efcb14d00d0b8e23bb (patch) | |
tree | c565e8082965874d1b5dd1122641b1b8c9ba035d | |
parent | 785f0343d04c1684363b5289a3012cf7e1caa95f (diff) | |
download | openembedded-core-cfaad320d9565003e97893efcb14d00d0b8e23bb.tar.gz openembedded-core-cfaad320d9565003e97893efcb14d00d0b8e23bb.tar.bz2 openembedded-core-cfaad320d9565003e97893efcb14d00d0b8e23bb.zip |
externalsrc.bbclass: Add task buildclean
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>
Signed-off-by: Ross Burton <ross.burton@intel.com>
-rw-r--r-- | meta/classes/externalsrc.bbclass | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass index 6ec46a6b15..bdf23ec6be 100644 --- a/meta/classes/externalsrc.bbclass +++ b/meta/classes/externalsrc.bbclass @@ -4,7 +4,7 @@ # Copyright (C) 2009 Chris Larson <clarson@kergoth.com> # Released under the MIT license (see COPYING.MIT for the terms) # -# externalsrc.bbclass enables use of an existing source tree, usually external to +# externalsrc.bbclass enables use of an existing source tree, usually external to # the build system to build a piece of software rather than the usual fetch/unpack/patch # process. # @@ -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 @@ -143,6 +147,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, srcdir=None): import shutil import subprocess @@ -189,3 +204,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 |