insane.bbclass: Fix gettext test

The previous gettext check was broken resulting in many false positives.
This improved version works as follows:
* Adds to the existing os.walk() and builds a list of configure.in and
  configure.ac files
* Tests whether DEPENDS includes an appropriate gettext
* If not greps the configure files in the list for instances of AM_GNU_GETTEXT
* If if an instance is found we bb.fatal with an appropriate message

Signed-off-by: Joshua Lock <josh@linux.intel.com>
This commit is contained in:
Joshua Lock 2009-12-19 12:29:14 +00:00
parent 52b821a384
commit 2be65803cb
1 changed files with 18 additions and 22 deletions

View File

@ -439,23 +439,6 @@ def package_qa_check_rdepends(pkg, workdir, d):
return sane
def configure_qa_check_gettext(d):
# Check to see if gettext is required and if so whether it's in DEPENDS
# Returning False means we need gettext but don't have it in DEPENDS
if bb.data.inherits_class('native', d):
gt = "gettext-native"
else:
gt = "gettext"
deps = bb.utils.explode_deps(bb.data.getVar('DEPENDS', d, True) or "")
if gt in deps:
return True
check = "grep \"^[[:space:]]*AM_GNU_GETTEXT\" $CONFIGURE_AC >/dev/null"
if os.system(check) == 0:
return True
else:
return False
# The PACKAGE FUNC to scan each package
python do_package_qa () {
bb.note("DO PACKAGE QA")
@ -502,11 +485,8 @@ python do_qa_staging() {
# have it in DEPENDS
addtask qa_configure after do_configure before do_compile
python do_qa_configure() {
bb.note("Checking for gettext requirement")
if not configure_qa_check_gettext(d):
bb.fatal("Gettext required by configure but not in DEPENDS")
bb.note("Checking sanity of the config.log file")
configs = []
bb.note("Checking autotools environment for common misconfiguration")
for root, dirs, files in os.walk(bb.data.getVar('WORKDIR', d, True)):
statement = "grep 'CROSS COMPILE Badness:' %s > /dev/null" % \
os.path.join(root,"config.log")
@ -514,4 +494,20 @@ python do_qa_configure() {
if os.system(statement) == 0:
bb.fatal("""This autoconf log indicates errors, it looked at host includes.
Rerun configure task after fixing this. The path was '%s'""" % root)
if "configure.ac" in files:
configs.append(os.path.join(root,"configure.ac"))
if "configure.in" in files:
configs.append(os.path.join(root, "configure.in"))
if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross', d) or bb.data.inherits_class('crosssdk', d) or bb.data.inherits_class('nativesdk', d):
gt = "gettext-native"
else:
gt = "gettext"
deps = bb.utils.explode_deps(bb.data.getVar('DEPENDS', d, True) or "")
if gt not in deps:
for config in configs:
gnu = "grep \"^[[:space:]]*AM_GNU_GETTEXT\" %s >/dev/null" % config
if os.system(gnu) == 0:
bb.fatal("Gettext required but not in DEPENDS for file %s" % config)
}