Patchwork insane: configure option checking

login
register
mail settings
Submitter Ross Burton
Date Sept. 5, 2013, 1:55 p.m.
Message ID <1378389321-28598-2-git-send-email-ross.burton@intel.com>
Download mbox | patch
Permalink /patch/57467/
State New
Headers show

Comments

Ross Burton - Sept. 5, 2013, 1:55 p.m.
Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 meta/classes/insane.bbclass |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Patch

diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 524cdca..9809cba 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -919,6 +919,25 @@  Missing inherit gettext?""" % (gt, config))
     if not package_qa_check_license(workdir, d):
         bb.fatal("Licensing Error: LIC_FILES_CHKSUM does not match, please fix")
 
+    ###########################################################################
+    # Check unrecognised configure options (with a white list)
+    ###########################################################################
+    if bb.data.inherits_class("autotools", d):
+        bb.note("Checking configure output for unrecognised options")
+        try:
+            flag = "WARNING: unrecognized options:"
+            log = os.path.join(d.getVar('B', True), 'config.log')
+            output = subprocess.check_output(['grep', '-F', flag, log])
+            options = set(map(lambda s: s.strip(' ,'), output.partition(flag)[2].split()))
+            whitelist = {'--enable-nls', '--disable-nls', '--disable-silent-rules', '--disable-dependency-tracking', '--with-libtool-sysroot'}
+            # TODO: allow additions per-recipe?
+            options -= whitelist
+            if options:
+		pn = d.getVar('PN', True)
+                error_msg = pn + ": configure was passed unrecognised options: " + " ".join(options)
+                package_qa_handle_error("unknown-configure-option", error_msg, d)
+        except subprocess.CalledProcessError:
+            pass
 }
 # The Staging Func, to check all staging
 #addtask qa_staging after do_populate_sysroot before do_build