systemd/pixbufcache/gio-module-cache/fontcache: fix build warning when using qemu usermode

Submitted by changqing.li@windriver.com on May 24, 2018, 2:19 a.m. | Patch ID: 150981

Details

Message ID 1527128380-337444-1-git-send-email-changqing.li@windriver.com
State New
Headers show

Commit Message

changqing.li@windriver.com May 24, 2018, 2:19 a.m.
From: Changqing Li <changqing.li@windriver.com>

udev-hwdb/pixbufcache/gio-module-cache/fontcache uses qemu usermode by default,
but some architecture such as Intel skylake does not support qemu usermode, this can
lead to a build warning as below:
warning: %post(udev-hwdb-1:234-r0.skylake_64) scriptlet failed, exit status
"WARNING: The postinstall intercept hook 'update_pixbufcache' failed".
"WARNING: The postinstall intercept hook 'update_gio_module_cache' failed".
"WARNING: The postinstall intercept hook 'update_font_cache' failed".

Add a judgement of qemu usermode to fix the build warning.

Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
 meta/classes/fontcache.bbclass           | 18 +++++++++++-------
 meta/classes/gio-module-cache.bbclass    | 18 +++++++++++-------
 meta/classes/pixbufcache.bbclass         |  8 ++++++--
 meta/recipes-core/systemd/systemd_237.bb | 10 +++++++---
 4 files changed, 35 insertions(+), 19 deletions(-)

Patch hide | download patch | download mbox

diff --git a/meta/classes/fontcache.bbclass b/meta/classes/fontcache.bbclass
index e763311..3eb868f 100644
--- a/meta/classes/fontcache.bbclass
+++ b/meta/classes/fontcache.bbclass
@@ -17,13 +17,17 @@  FONTCONFIG_CACHE_PARAMS ?= "-v"
 FONTCONFIG_CACHE_ENV ?= "FC_DEBUG=1"
 fontcache_common() {
 if [ -n "$D" ] ; then
-	$INTERCEPT_DIR/postinst_intercept update_font_cache ${PKG} mlprefix=${MLPREFIX} \
-		'bindir="${bindir}"' \
-		'libdir="${libdir}"' \
-		'base_libdir="${base_libdir}"' \
-		'fontconfigcachedir="${FONTCONFIG_CACHE_DIR}"' \
-		'fontconfigcacheparams="${FONTCONFIG_CACHE_PARAMS}"' \
-		'fontconfigcacheenv="${FONTCONFIG_CACHE_ENV}"'
+	if ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'true','false', d)}; then
+		$INTERCEPT_DIR/postinst_intercept update_font_cache ${PKG} mlprefix=${MLPREFIX} \
+			'bindir="${bindir}"' \
+			'libdir="${libdir}"' \
+			'base_libdir="${base_libdir}"' \
+			'fontconfigcachedir="${FONTCONFIG_CACHE_DIR}"' \
+			'fontconfigcacheparams="${FONTCONFIG_CACHE_PARAMS}"' \
+			'fontconfigcacheenv="${FONTCONFIG_CACHE_ENV}"'
+	else
+		exit 1
+	fi
 else
 	${FONTCONFIG_CACHE_ENV} fc-cache ${FONTCONFIG_CACHE_PARAMS}
 fi
diff --git a/meta/classes/gio-module-cache.bbclass b/meta/classes/gio-module-cache.bbclass
index e429bd3..0173823 100644
--- a/meta/classes/gio-module-cache.bbclass
+++ b/meta/classes/gio-module-cache.bbclass
@@ -5,13 +5,17 @@  GIO_MODULE_PACKAGES ??= "${PN}"
 
 gio_module_cache_common() {
 if [ "x$D" != "x" ]; then
-    $INTERCEPT_DIR/postinst_intercept update_gio_module_cache ${PKG} \
-            mlprefix=${MLPREFIX} \
-            binprefix=${MLPREFIX} \
-            libdir=${libdir} \
-            libexecdir=${libexecdir} \
-            base_libdir=${base_libdir} \
-            bindir=${bindir}
+	if ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'true','false', d)}; then
+	    $INTERCEPT_DIR/postinst_intercept update_gio_module_cache ${PKG} \
+		    mlprefix=${MLPREFIX} \
+		    binprefix=${MLPREFIX} \
+		    libdir=${libdir} \
+		    libexecdir=${libexecdir} \
+		    base_libdir=${base_libdir} \
+		    bindir=${bindir}
+	else
+		exit 1
+	fi
 else
     ${libexecdir}/${MLPREFIX}gio-querymodules ${libdir}/gio/modules/
 fi
diff --git a/meta/classes/pixbufcache.bbclass b/meta/classes/pixbufcache.bbclass
index b3e507f..c7d3e84 100644
--- a/meta/classes/pixbufcache.bbclass
+++ b/meta/classes/pixbufcache.bbclass
@@ -12,8 +12,12 @@  PACKAGE_WRITE_DEPS += "qemu-native gdk-pixbuf-native"
 
 pixbufcache_common() {
 if [ "x$D" != "x" ]; then
-	$INTERCEPT_DIR/postinst_intercept update_pixbuf_cache ${PKG} mlprefix=${MLPREFIX} libdir=${libdir} \
-		bindir=${bindir} base_libdir=${base_libdir}
+	if ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'true','false', d)}; then
+		$INTERCEPT_DIR/postinst_intercept update_pixbuf_cache ${PKG} mlprefix=${MLPREFIX} libdir=${libdir} \
+			bindir=${bindir} base_libdir=${base_libdir}
+	else
+		exit 1
+	fi
 else
 
 	# Update the pixbuf loaders in case they haven't been registered yet
diff --git a/meta/recipes-core/systemd/systemd_237.bb b/meta/recipes-core/systemd/systemd_237.bb
index b7c2113..f4847f8 100644
--- a/meta/recipes-core/systemd/systemd_237.bb
+++ b/meta/recipes-core/systemd/systemd_237.bb
@@ -580,9 +580,13 @@  pkg_prerm_${PN} () {
 PACKAGE_WRITE_DEPS += "qemu-native"
 pkg_postinst_udev-hwdb () {
 	if test -n "$D"; then
-		${@qemu_run_binary(d, '$D', '${base_bindir}/udevadm')} hwdb --update \
-			--root $D
-		chown root:root $D${sysconfdir}/udev/hwdb.bin
+		if ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'true','false', d)}; then
+			${@qemu_run_binary(d, '$D', '${base_bindir}/udevadm')} hwdb --update \
+				--root $D
+			chown root:root $D${sysconfdir}/udev/hwdb.bin
+		else
+			exit 1
+		fi
 	else
 		udevadm hwdb --update
 	fi

Comments

Alexander Kanavin May 24, 2018, 6:43 a.m.
On 05/24/2018 05:19 AM, changqing.li@windriver.com wrote:
> udev-hwdb/pixbufcache/gio-module-cache/fontcache uses qemu usermode by default,
> but some architecture such as Intel skylake does not support qemu usermode, this can
> lead to a build warning as below:
> warning: %post(udev-hwdb-1:234-r0.skylake_64) scriptlet failed, exit status
> "WARNING: The postinstall intercept hook 'update_pixbufcache' failed".
> "WARNING: The postinstall intercept hook 'update_gio_module_cache' failed".
> "WARNING: The postinstall intercept hook 'update_font_cache' failed".
> 
> Add a judgement of qemu usermode to fix the build warning.

Using 'exit 1' in postinst is now deprecated and will soon become a real 
failure. The better way is to make qemuwrapper-cross determine whether 
qemu usermode is supported, and print the warning only if it is 
supported and running qemu fails.

Alex