diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-10-12 10:33:47 +1300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-10-11 23:04:44 +0100 |
commit | f7259298a29e865dc03bde77e4617bc671a9c85e (patch) | |
tree | f219761c8106468283a07fd2ca58c6e23939af94 /meta/classes | |
parent | 2d60ffcbdadb689767ff3291f6b933d72b569b4b (diff) | |
download | poky-f7259298a29e865dc03bde77e4617bc671a9c85e.tar.gz |
classes/externalsrc: re-run do_configure when configure files change
If the user modifies files such as CMakeLists.txt in the case of cmake,
we want do_configure to re-run so that those changes can take effect. In
order to accomplish that, have a variable CONFIGURE_FILES which
specifies a list of files that will be put into do_configure's checksum
(either full paths, or just filenames which will be searched for in the
entire source tree). CONFIGURE_FILES then just needs to be set
appropriately depending on what do_configure is doing; for now I've set
this for autotools and cmake which are the most common cases.
Fixes [YOCTO #7617].
(From OE-Core rev: 923fc20c2862a6d75f949082c9f6532ab7e2d2cd)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/autotools.bbclass | 2 | ||||
-rw-r--r-- | meta/classes/cmake.bbclass | 2 | ||||
-rw-r--r-- | meta/classes/externalsrc.bbclass | 22 |
3 files changed, 26 insertions, 0 deletions
diff --git a/meta/classes/autotools.bbclass b/meta/classes/autotools.bbclass index ecbba9f603..c43ea9a7ef 100644 --- a/meta/classes/autotools.bbclass +++ b/meta/classes/autotools.bbclass | |||
@@ -259,6 +259,8 @@ python autotools_copy_aclocals () { | |||
259 | } | 259 | } |
260 | autotools_copy_aclocals[vardepsexclude] += "MACHINE SDK_ARCH BUILD_ARCH SDK_OS BB_TASKDEPDATA" | 260 | autotools_copy_aclocals[vardepsexclude] += "MACHINE SDK_ARCH BUILD_ARCH SDK_OS BB_TASKDEPDATA" |
261 | 261 | ||
262 | CONFIGURE_FILES = "${S}/configure.in ${S}/configure.ac ${S}/config.h.in ${S}/acinclude.m4 Makefile.am" | ||
263 | |||
262 | autotools_do_configure() { | 264 | autotools_do_configure() { |
263 | # WARNING: gross hack follows: | 265 | # WARNING: gross hack follows: |
264 | # An autotools built package generally needs these scripts, however only | 266 | # An autotools built package generally needs these scripts, however only |
diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass index 7091f8ba81..3e762de6a2 100644 --- a/meta/classes/cmake.bbclass +++ b/meta/classes/cmake.bbclass | |||
@@ -84,6 +84,8 @@ EOF | |||
84 | 84 | ||
85 | addtask generate_toolchain_file after do_patch before do_configure | 85 | addtask generate_toolchain_file after do_patch before do_configure |
86 | 86 | ||
87 | CONFIGURE_FILES = "CMakeLists.txt" | ||
88 | |||
87 | cmake_do_configure() { | 89 | cmake_do_configure() { |
88 | if [ "${OECMAKE_BUILDPATH}" ]; then | 90 | if [ "${OECMAKE_BUILDPATH}" ]; then |
89 | bbnote "cmake.bbclass no longer uses OECMAKE_BUILDPATH. The default behaviour is now out-of-tree builds with B=WORKDIR/build." | 91 | bbnote "cmake.bbclass no longer uses OECMAKE_BUILDPATH. The default behaviour is now out-of-tree builds with B=WORKDIR/build." |
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass index 5c65d2b742..31908c3ca2 100644 --- a/meta/classes/externalsrc.bbclass +++ b/meta/classes/externalsrc.bbclass | |||
@@ -103,6 +103,7 @@ python () { | |||
103 | d.prependVarFlag('do_configure', 'prefuncs', "externalsrc_configure_prefunc ") | 103 | d.prependVarFlag('do_configure', 'prefuncs', "externalsrc_configure_prefunc ") |
104 | 104 | ||
105 | d.setVarFlag('do_compile', 'file-checksums', '${@srctree_hash_files(d)}') | 105 | d.setVarFlag('do_compile', 'file-checksums', '${@srctree_hash_files(d)}') |
106 | d.setVarFlag('do_configure', 'file-checksums', '${@srctree_configure_hash_files(d)}') | ||
106 | 107 | ||
107 | # We don't want the workdir to go away | 108 | # We don't want the workdir to go away |
108 | d.appendVar('RM_WORK_EXCLUDE', ' ' + d.getVar('PN', True)) | 109 | d.appendVar('RM_WORK_EXCLUDE', ' ' + d.getVar('PN', True)) |
@@ -166,3 +167,24 @@ def srctree_hash_files(d): | |||
166 | else: | 167 | else: |
167 | ret = d.getVar('EXTERNALSRC', True) + '/*:True' | 168 | ret = d.getVar('EXTERNALSRC', True) + '/*:True' |
168 | return ret | 169 | return ret |
170 | |||
171 | def srctree_configure_hash_files(d): | ||
172 | """ | ||
173 | Get the list of files that should trigger do_configure to re-execute, | ||
174 | based on the value of CONFIGURE_FILES | ||
175 | """ | ||
176 | in_files = (d.getVar('CONFIGURE_FILES', True) or '').split() | ||
177 | out_items = [] | ||
178 | search_files = [] | ||
179 | for entry in in_files: | ||
180 | if entry.startswith('/'): | ||
181 | out_items.append('%s:%s' % (entry, os.path.exists(entry))) | ||
182 | else: | ||
183 | search_files.append(entry) | ||
184 | if search_files: | ||
185 | s_dir = d.getVar('EXTERNALSRC', True) | ||
186 | for root, _, files in os.walk(s_dir): | ||
187 | for f in files: | ||
188 | if f in search_files: | ||
189 | out_items.append('%s:True' % os.path.join(root, f)) | ||
190 | return ' '.join(out_items) | ||