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:05:13 +0000 |
| commit | 8a85d44ced165ada059874d2595ff20170a2af86 (patch) | |
| tree | fdd8b97802bcea802e5f66e3954a5dac7d365c3b | |
| parent | 9a1e8b9cf5769a96ea4260c9d3eec9d12406875e (diff) | |
| download | poky-8a85d44ced165ada059874d2595ff20170a2af86.tar.gz | |
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.
(From OE-Core rev: cfaad320d9565003e97893efcb14d00d0b8e23bb)
Signed-off-by: Ola x Nilsson <olani@axis.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -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 @@ | |||
| 4 | # Copyright (C) 2009 Chris Larson <clarson@kergoth.com> | 4 | # Copyright (C) 2009 Chris Larson <clarson@kergoth.com> |
| 5 | # Released under the MIT license (see COPYING.MIT for the terms) | 5 | # Released under the MIT license (see COPYING.MIT for the terms) |
| 6 | # | 6 | # |
| 7 | # externalsrc.bbclass enables use of an existing source tree, usually external to | 7 | # externalsrc.bbclass enables use of an existing source tree, usually external to |
| 8 | # the build system to build a piece of software rather than the usual fetch/unpack/patch | 8 | # the build system to build a piece of software rather than the usual fetch/unpack/patch |
| 9 | # process. | 9 | # process. |
| 10 | # | 10 | # |
| @@ -108,6 +108,10 @@ python () { | |||
| 108 | # We don't want the workdir to go away | 108 | # We don't want the workdir to go away |
| 109 | d.appendVar('RM_WORK_EXCLUDE', ' ' + d.getVar('PN')) | 109 | d.appendVar('RM_WORK_EXCLUDE', ' ' + d.getVar('PN')) |
| 110 | 110 | ||
| 111 | bb.build.addtask('do_buildclean', | ||
| 112 | 'do_clean' if d.getVar('S') == d.getVar('B') else None, | ||
| 113 | None, d) | ||
| 114 | |||
| 111 | # If B=S the same builddir is used even for different architectures. | 115 | # If B=S the same builddir is used even for different architectures. |
| 112 | # Thus, use a shared CONFIGURESTAMPFILE and STAMP directory so that | 116 | # Thus, use a shared CONFIGURESTAMPFILE and STAMP directory so that |
| 113 | # change of do_configure task hash is correctly detected and stamps are | 117 | # change of do_configure task hash is correctly detected and stamps are |
| @@ -143,6 +147,17 @@ python externalsrc_compile_prefunc() { | |||
| 143 | bb.plain('NOTE: %s: compiling from external source tree %s' % (d.getVar('PN'), d.getVar('EXTERNALSRC'))) | 147 | bb.plain('NOTE: %s: compiling from external source tree %s' % (d.getVar('PN'), d.getVar('EXTERNALSRC'))) |
| 144 | } | 148 | } |
| 145 | 149 | ||
| 150 | do_buildclean[dirs] = "${S} ${B}" | ||
| 151 | do_buildclean[nostamp] = "1" | ||
| 152 | do_buildclean[doc] = "Call 'make clean' or equivalent in ${B}" | ||
| 153 | externalsrc_do_buildclean() { | ||
| 154 | if [ -e Makefile -o -e makefile -o -e GNUmakefile ]; then | ||
| 155 | oe_runmake clean || die "make failed" | ||
| 156 | else | ||
| 157 | bbnote "nothing to do - no makefile found" | ||
| 158 | fi | ||
| 159 | } | ||
| 160 | |||
| 146 | def srctree_hash_files(d, srcdir=None): | 161 | def srctree_hash_files(d, srcdir=None): |
| 147 | import shutil | 162 | import shutil |
| 148 | import subprocess | 163 | import subprocess |
| @@ -189,3 +204,5 @@ def srctree_configure_hash_files(d): | |||
| 189 | if f in search_files: | 204 | if f in search_files: |
| 190 | out_items.append('%s:True' % os.path.join(root, f)) | 205 | out_items.append('%s:True' % os.path.join(root, f)) |
| 191 | return ' '.join(out_items) | 206 | return ' '.join(out_items) |
| 207 | |||
| 208 | EXPORT_FUNCTIONS do_buildclean | ||
