[oe] [patch] autotools: detect missing depends for aclocal packages

Phil Blundell pb at reciva.com
Thu Jun 4 16:18:03 UTC 2009


On Thu, 2009-06-04 at 17:13 +0300, Ihar Hrachyshka wrote:
> -DEPENDS = "gmp-native"
> +DEPENDS = "gmp-native gettext-native"

For laughs, here's a small patch to detect this kind of thing
automatically in at least some cases.

p.

--

diff --git a/classes/autotools.bbclass b/classes/autotools.bbclass
index e43b289..214da3c 100644
--- a/classes/autotools.bbclass
+++ b/classes/autotools.bbclass
@@ -67,6 +67,49 @@ oe_runconf () {
 	fi
 }
 
+python autotools_do_check_aclocal() {
+        frags = bb.data.expand('${T}/acfragments', d)
+        bb.note(frags)
+        if os.path.exists(frags):
+                pcproviders = {}
+                needed = []
+                f = open(frags, "r")
+                import re
+                sr = re.compile("aclocal: saw macro (.*)")
+                fr = re.compile("aclocal: found macro (.*) in .*/(.*).m4")
+                for l in f.readlines():
+                        l = l.rstrip()
+                        m = sr.match(l)
+                        if m:
+                                if not m.group(1) in needed:
+                                        needed.append(m.group(1))
+                        else:
+                                m = fr.match(l)
+                                if m:
+                                        pcproviders[m.group(1)] = m.group(2)
+                f.close()
+                needed_pkgs = []
+                for n in needed:
+                        if not pcproviders.has_key(n):
+                                continue
+                        fn = bb.data.expand("${STAGING_DIR}/${HOST_SYS}/acdeps/%s.m4" % pcproviders[n], d)
+                        if os.path.exists(fn):
+                                f = open(fn, "r")
+                                p = f.readline().rstrip()
+                                f.close()
+                                if not p in needed_pkgs:
+                                        needed_pkgs.append(p)
+                deps = bb.data.getVar("DEPENDS", d, True).split()
+                lost = []
+                for n in needed_pkgs:
+                        if not n in deps:
+                                lost.append(n)
+                if lost:
+                        bb.note("possibly missing dependencies: %s" % " ".join(lost))
+}
+
+addtask check_aclocal after do_configure
+
 autotools_do_configure() {
 	case ${PN} in
 	autoconf*)
@@ -126,6 +169,8 @@ autotools_do_configure() {
 			  oenote Executing intltoolize --copy --force --automake
 			  intltoolize --copy --force --automake
 			fi
+                        oenote Extracting list of required m4 fragments
+                        aclocal --output=/dev/null --verbose 2>&1 | egrep '(^aclocal: found macro)|(^aclocal: saw macro)' > ${T}/acfragments || true
 			oenote Executing autoreconf --verbose --install --force ${EXTRA_AUTORECONF} $acpaths
 			mkdir -p m4
 			autoreconf -Wcross --verbose --install --force ${EXTRA_AUTORECONF} $acpaths || oefatal "autoreconf execution failed."
@@ -239,8 +284,14 @@ autotools_stage_all() {
 	rm -rf ${STAGE_TEMP}/${mandir} || true
 	rm -rf ${STAGE_TEMP}/${infodir} || true
 	autotools_stage_dir ${STAGE_TEMP}/${datadir} ${STAGING_DATADIR}
+        if [ -d ${STAGE_TEMP}/${datadir}/aclocal ]; then
+                mkdir -p ${STAGING_DIR}/${HOST_SYS}/acdeps
+                for i in `find ${STAGE_TEMP}/${datadir}/aclocal/ -name '*.m4'`; do
+                        echo ${PN} > ${STAGING_DIR}/${HOST_SYS}/acdeps/`basename $i`
+                done
+        fi
 	rm -rf ${STAGE_TEMP}
 }
 
-EXPORT_FUNCTIONS do_configure do_install
+EXPORT_FUNCTIONS do_configure do_install do_check_aclocal
 






More information about the Openembedded-devel mailing list