Skip to contentSkip to conversation

insane: configure option checking

RFC PATCH In review Ross Burton 2 participants 3 messages Sep 5, 2013

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 insane: configure option checking

Hi,

First: very much a RFC, this isn't ready for merging. I thought I'd send it before it got lost in a nest of branches.

This is a small sanity test I've been poking at in between builds to detect when configure warns that it has been passed configure options it doesn't recongise. It's got a whitelist for options such as --disable-silent-rules that are passed blindly to large numbers of recipes, and I think we'll need the possibility of a per-recipe whitelist in case they are required[1].

Comments/improvements welcome!

Ross

[1] The rationale here being the Xorg protocol recipes which have a common .inc that disables all forms of documentation, but not every protocol recipe has all forms enabled.

#1 lore raw

PATCH 1/1 insane: configure option checking

---
 meta/classes/insane.bbclass |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
meta/classes/insane.bbclass +19 -0
index 524cdca..9809cba 100644
@@ -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
Signature · 1 line
1.7.10.4
#2 lore raw
In reply to Ross Burton
Quoted 5 lines · Ross Burton

Hi,

First: very much a RFC, this isn't ready for merging. I thought I'd send it before it got lost in a nest of branches.

Quoted 7 lines

This is a small sanity test I've been poking at in between builds to detect when configure warns that it has been passed configure options it doesn't recongise. It's got a whitelist for options such as --disable-silent-rules that are passed blindly to large numbers of recipes, and I think we'll need the possibility of a per-recipe whitelist in case they are required[1].

Comments/improvements welcome!

I like this idea a lot :)

Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]