]> code.ossystems Code Review - openembedded-core.git/commitdiff
classes/externalsrc: re-run do_configure when configure files change
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Tue, 11 Oct 2016 21:33:47 +0000 (10:33 +1300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 8 Nov 2016 23:03:17 +0000 (23:03 +0000)
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>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
meta/classes/autotools.bbclass
meta/classes/cmake.bbclass
meta/classes/externalsrc.bbclass

index e1686206f74d300ebb6325881ef37bf38ada9623..257e0941499b3fcc271b0d5d3d76a5ab8d2a4cb0 100644 (file)
@@ -229,6 +229,8 @@ python autotools_copy_aclocals () {
 }
 autotools_copy_aclocals[vardepsexclude] += "MACHINE SDK_ARCH BUILD_ARCH SDK_OS BB_TASKDEPDATA"
 
+CONFIGURE_FILES = "${S}/configure.in ${S}/configure.ac ${S}/config.h.in ${S}/acinclude.m4 Makefile.am"
+
 autotools_do_configure() {
        # WARNING: gross hack follows:
        # An autotools built package generally needs these scripts, however only
index 77ab626f9f665a5a0704de8fe597873028d94b24..feabf6dea9f370477f3c2ecd61c47ecb712b6f4e 100644 (file)
@@ -84,6 +84,8 @@ EOF
 
 addtask generate_toolchain_file after do_patch before do_configure
 
+CONFIGURE_FILES = "CMakeLists.txt"
+
 cmake_do_configure() {
        if [ "${OECMAKE_BUILDPATH}" ]; then
                bbnote "cmake.bbclass no longer uses OECMAKE_BUILDPATH.  The default behaviour is now out-of-tree builds with B=WORKDIR/build."
index da7eb4781c51a4a0cf44ef5f7c30777971fcb0ac..f173496ae8439a7d000a00ba294cbf7e8b92d5a0 100644 (file)
@@ -89,6 +89,7 @@ python () {
         # function is run every time
         d.setVar('BB_DONT_CACHE', '1')
         d.setVarFlag('do_compile', 'file-checksums', '${@srctree_hash_files(d)}')
+        d.setVarFlag('do_configure', 'file-checksums', '${@srctree_configure_hash_files(d)}')
 
         # We don't want the workdir to go away
         d.appendVar('RM_WORK_EXCLUDE', ' ' + d.getVar('PN', True))
@@ -152,3 +153,24 @@ def srctree_hash_files(d):
     else:
         ret = d.getVar('EXTERNALSRC', True) + '/*:True'
     return ret
+
+def srctree_configure_hash_files(d):
+    """
+    Get the list of files that should trigger do_configure to re-execute,
+    based on the value of CONFIGURE_FILES
+    """
+    in_files = (d.getVar('CONFIGURE_FILES', True) or '').split()
+    out_items = []
+    search_files = []
+    for entry in in_files:
+        if entry.startswith('/'):
+            out_items.append('%s:%s' % (entry, os.path.exists(entry)))
+        else:
+            search_files.append(entry)
+    if search_files:
+        s_dir = d.getVar('EXTERNALSRC', True)
+        for root, _, files in os.walk(s_dir):
+            for f in files:
+                if f in search_files:
+                    out_items.append('%s:True' % os.path.join(root, f))
+    return ' '.join(out_items)