[OE-core] [PATCH 1/3] insane: added 'pkgconfig-nosysroot' check

Enrico Scholz enrico.scholz at sigma-chemnitz.de
Thu Dec 18 11:04:21 UTC 2014


pkgconfig files should not contain references to $PKG_CONFIG_SYSROOT_DIR.
E.g. when a .pc file contains

| Cflags: -I/absolute-path-to-sysroot/usr/include/freetype2

pkgconfig will expand this in the next 'pkgconfig --cflags' call as

| -I/absolute-path-to-sysroot/absolute-path-to-sysroot/usr/include/freetype2

(note the duplicate path).

This patch checks therefore whether installed .pc files contain such
absolute paths.

Because some OE core packages trigger this check (fontconfig, libkmod),
it is only a warning for now.

Signed-off-by: Enrico Scholz <enrico.scholz at sigma-chemnitz.de>
---
 meta/classes/insane.bbclass | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index b4bffd2..d327294 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -29,7 +29,7 @@ QA_SANE = "True"
 WARN_QA ?= "ldflags useless-rpaths rpaths staticdev libdir xorg-driver-abi \
             textrel already-stripped incompatible-license files-invalid \
             installed-vs-shipped compile-host-path install-host-path \
-            pn-overrides infodir build-deps file-rdeps \
+            pn-overrides infodir build-deps file-rdeps pkgconfig-nosysroot \
             "
 ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
             perms dep-cmp pkgvarcheck perm-config perm-line perm-link \
@@ -606,6 +606,20 @@ def package_qa_check_symlink_to_sysroot(path, name, d, elf, messages):
                 trimmed = path.replace(os.path.join (d.getVar("PKGDEST", True), name), "")
                 messages["symlink-to-sysroot"] = "Symlink %s in %s points to TMPDIR" % (trimmed, name)
 
+QAPATHTEST[pkgconfig-nosysroot] = "package_qa_check_pkgconfig_nosysroot"
+def package_qa_check_pkgconfig_nosysroot(file, pkgname, d, elf, messages):
+    if not file.endswith('.pc') or os.path.islink(file):
+	return
+
+    sysroot = d.getVar("PKG_CONFIG_SYSROOT_DIR", True)
+    if not sysroot:
+        return
+
+    with open(file) as f:
+        content = f.read()
+        if sysroot in content:
+            messages["pkgconfig-nosysroot"] = "pkgconfig file %s contains absolute reference to sysroot" % package_qa_clean_path(file,d)
+
 def package_qa_check_license(workdir, d):
     """
     Check for changes in the license files 
-- 
1.9.3




More information about the Openembedded-core mailing list