Skip to contentSkip to conversation

pango: Fix postinst

PATCH In review Martin Jansa 3 participants 6 messages Feb 27, 2014 – Mar 1, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pango: Fix postinst

* do_split_packages was appending call to ${bindir}/${MLPREFIX}pango-querymodules
without $D prefix or test if $D is empty, so it was always failing on buildhostis without pango-querymodules and such failure is fatal when rootfs is read-only (do_rootfs fails because some packages weren't configured)

---
 meta/recipes-graphics/pango/pango.inc | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
meta/recipes-graphics/pango/pango.inc +9 -5
index 17006d3..5fddff9 100644
@@ -42,21 +42,25 @@ EXTRA_OECONF = "--disable-introspection \
 LEAD_SONAME = "libpango-1.0*"
 LIBV = "1.8.0"
 
-postinst_prologue() {
+pango_postinst() {
 if ! [ -e $D${sysconfdir}/pango ] ; then
 	mkdir -p $D${sysconfdir}/pango
 fi
 
-if [ "x$D" != "x" ]; then
+if [ -n "$D" ]; then
 	${@qemu_run_binary(d, '$D','${bindir}/${MLPREFIX}pango-querymodules')} \
 		$D${libdir}/pango/${LIBV}/modules/*.so \
 		> $D${sysconfdir}/pango/${MLPREFIX}pango.modules 2>/dev/null
 
-	[ $? -ne 0 ] && exit 1
+	if [ $? -ne 0 ] ; then
+		echo "qemu_run_binary call ${bindir}/${MLPREFIX}pango-querymodules $D${libdir}/pango/${LIBV}/modules/*.so > $D${sysconfdir}/pango/${MLPREFIX}pango.modules failed"
+		exit 1
 
 	sed -i -e "s:$D::" $D${sysconfdir}/pango/${MLPREFIX}pango.modules
 
 	exit 0
+else
+	${bindir}/${MLPREFIX}pango-querymodules > /etc/pango/${MLPREFIX}pango.modules
 fi
 }
 
@@ -68,11 +72,11 @@ do_install_append () {
 
 
 python populate_packages_prepend () {
-    prologue = d.getVar("postinst_prologue", True)
+    pango_postinst = d.getVar("pango_postinst", True)
 
     modules_root = d.expand('${libdir}/pango/${LIBV}/modules')
 
-    do_split_packages(d, modules_root, '^pango-(.*)\.so$', 'pango-module-%s', 'Pango module %s', prologue + '${bindir}/${MLPREFIX}pango-querymodules > /etc/pango/${MLPREFIX}pango.modules')
+    do_split_packages(d, modules_root, '^pango-(.*)\.so$', 'pango-module-%s', 'Pango module %s', pango_postinst)
 }
 
 FILES_${PN} = "${sysconfdir}/pango/* ${bindir}/* ${libdir}/libpango*${SOLIBS}"
Signature · 1 line
1.9.0
#1 lore raw
Quoted 27 lines · Martin Jansa

* do_split_packages was appending call to ${bindir}/${MLPREFIX}pango-querymodules
without $D prefix or test if $D is empty, so it was always failing on buildhostis without pango-querymodules and such failure is fatal when rootfs is read-only (do_rootfs fails because some packages weren't configured)

---
  meta/recipes-graphics/pango/pango.inc | 14 +++++++++-----
  1 file changed, 9 insertions(+), 5 deletions(-)
meta/recipes-graphics/pango/pango.inc +1 -2
index 17006d3..5fddff9 100644
@@ -42,21 +42,25 @@ EXTRA_OECONF = "--disable-introspection \
  LEAD_SONAME = "libpango-1.0*"
  LIBV = "1.8.0"
 
-postinst_prologue() {
+pango_postinst() {
  if ! [ -e $D${sysconfdir}/pango ] ; then
  	mkdir -p $D${sysconfdir}/pango
  fi
 
-if [ "x$D" != "x" ]; then

meta/recipes-graphics/pango/pango.inc EXTRA_OECONF = "--disable-introspection \ · line 58

Quoted 10 lines
meta/recipes-graphics/pango/pango.inc +4 -1
+if [ -n "$D" ]; then
  	${@qemu_run_binary(d, '$D','${bindir}/${MLPREFIX}pango-querymodules')} \
  		$D${libdir}/pango/${LIBV}/modules/*.so \
  		> $D${sysconfdir}/pango/${MLPREFIX}pango.modules 2>/dev/null
 
-	[ $? -ne 0 ] && exit 1
+	if [ $? -ne 0 ] ; then
+		echo "qemu_run_binary call ${bindir}/${MLPREFIX}pango-querymodules $D${libdir}/pango/${LIBV}/modules/*.so > $D${sysconfdir}/pango/${MLPREFIX}pango.modules failed"
+		exit 1
 

Are you missing a 'fi' here?

I got an error during parsing:

Quoted 3 lines

ERROR: ExpansionError during parsing /home/sgw/yocto/poky/meta/recipes-graphics/pango/pango_1.36.2.bb: Failure expanding variable pango_postinst: ShellSyntaxError: None followed by:

Sau!

Quoted 23 lines
  	sed -i -e "s:$D::" $D${sysconfdir}/pango/${MLPREFIX}pango.modules

exit 0

meta/recipes-graphics/pango/pango.inc +4 -2
+else
+	${bindir}/${MLPREFIX}pango-querymodules > /etc/pango/${MLPREFIX}pango.modules
  fi
  }
@@ -68,11 +72,11 @@ do_install_append () {
 
 
  python populate_packages_prepend () {
-    prologue = d.getVar("postinst_prologue", True)
+    pango_postinst = d.getVar("pango_postinst", True)
 
      modules_root = d.expand('${libdir}/pango/${LIBV}/modules')
 
-    do_split_packages(d, modules_root, '^pango-(.*)\.so$', 'pango-module-%s', 'Pango module %s', prologue + '${bindir}/${MLPREFIX}pango-querymodules > /etc/pango/${MLPREFIX}pango.modules')
+    do_split_packages(d, modules_root, '^pango-(.*)\.so$', 'pango-module-%s', 'Pango module %s', pango_postinst)
  }
 
  FILES_${PN} = "${sysconfdir}/pango/* ${bindir}/* ${libdir}/libpango*${SOLIBS}"
#2 lore raw
In reply to Martin Jansa
Quoted 6 lines · Martin Jansa

* do_split_packages was appending call to ${bindir}/${MLPREFIX}pango-querymodules
without $D prefix or test if $D is empty, so it was always failing on buildhostis without pango-querymodules and such failure is fatal when rootfs is read-only (do_rootfs fails because some packages weren't configured)

Something is wrong, in theory the
if [ "x$D" != "x" ]; then
case should always exit with 0 or 1 before it reaches the call added by do_split_packages so it has to be qemu_run_binary call failing and causing exit 1

Quoted 56 lines
---
 meta/recipes-graphics/pango/pango.inc | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
meta/recipes-graphics/pango/pango.inc +9 -5
index 17006d3..5fddff9 100644
@@ -42,21 +42,25 @@ EXTRA_OECONF = "--disable-introspection \
 LEAD_SONAME = "libpango-1.0*"
 LIBV = "1.8.0"
 
-postinst_prologue() {
+pango_postinst() {
 if ! [ -e $D${sysconfdir}/pango ] ; then
 	mkdir -p $D${sysconfdir}/pango
 fi
 
-if [ "x$D" != "x" ]; then
+if [ -n "$D" ]; then
 	${@qemu_run_binary(d, '$D','${bindir}/${MLPREFIX}pango-querymodules')} \
 		$D${libdir}/pango/${LIBV}/modules/*.so \
 		> $D${sysconfdir}/pango/${MLPREFIX}pango.modules 2>/dev/null
 
-	[ $? -ne 0 ] && exit 1
+	if [ $? -ne 0 ] ; then
+		echo "qemu_run_binary call ${bindir}/${MLPREFIX}pango-querymodules $D${libdir}/pango/${LIBV}/modules/*.so > $D${sysconfdir}/pango/${MLPREFIX}pango.modules failed"
+		exit 1
 
 	sed -i -e "s:$D::" $D${sysconfdir}/pango/${MLPREFIX}pango.modules
 
 	exit 0
+else
+	${bindir}/${MLPREFIX}pango-querymodules > /etc/pango/${MLPREFIX}pango.modules
 fi
 }
 
@@ -68,11 +72,11 @@ do_install_append () {
 
 
 python populate_packages_prepend () {
-    prologue = d.getVar("postinst_prologue", True)
+    pango_postinst = d.getVar("pango_postinst", True)
 
     modules_root = d.expand('${libdir}/pango/${LIBV}/modules')
 
-    do_split_packages(d, modules_root, '^pango-(.*)\.so$', 'pango-module-%s', 'Pango module %s', prologue + '${bindir}/${MLPREFIX}pango-querymodules > /etc/pango/${MLPREFIX}pango.modules')
+    do_split_packages(d, modules_root, '^pango-(.*)\.so$', 'pango-module-%s', 'Pango module %s', pango_postinst)
 }
 
 FILES_${PN} = "${sysconfdir}/pango/* ${bindir}/* ${libdir}/libpango*${SOLIBS}"
Signature · 1 line
1.9.0
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#3 lore raw
Quoted 8 lines · Martin Jansa
Quoted 6 lines · Martin Jansa

* do_split_packages was appending call to ${bindir}/${MLPREFIX}pango-querymodules
without $D prefix or test if $D is empty, so it was always failing on buildhostis without pango-querymodules and such failure is fatal when rootfs is read-only (do_rootfs fails because some packages weren't configured)

Quoted 5 lines

Something is wrong, in theory the
if [ "x$D" != "x" ]; then
case should always exit with 0 or 1 before it reaches the call added by do_split_packages so it has to be qemu_run_binary call failing and causing exit 1

Saul's error shows the shell parser in bitbake exiting. The function in question isn't getting run, its never getting past the parsing stage. As Saul mentions, it appears the if/fi balance isn't correct which would upset the shell parser...

Cheers,

Richard

#4 lore raw
Quoted 15 lines · Richard Purdie
Quoted 8 lines · Martin Jansa
Quoted 6 lines · Martin Jansa

* do_split_packages was appending call to ${bindir}/${MLPREFIX}pango-querymodules
without $D prefix or test if $D is empty, so it was always failing on buildhostis without pango-querymodules and such failure is fatal when rootfs is read-only (do_rootfs fails because some packages weren't configured)

Quoted 5 lines

Something is wrong, in theory the
if [ "x$D" != "x" ]; then
case should always exit with 0 or 1 before it reaches the call added by do_split_packages so it has to be qemu_run_binary call failing and causing exit 1

Quoted 4 lines

Saul's error shows the shell parser in bitbake exiting. The function in question isn't getting run, its never getting past the parsing stage. As Saul mentions, it appears the if/fi balance isn't correct which would upset the shell parser...

Saul is correct, this version was wrong.. I had fixed version locally, but than I've noticed that the exit calls should prevent the added pango-querymodules call to be executed in do_rootfs, so I have started checking what could be wrong and forgot to update status of this patch on e-mail (or send v2 with fixed parsing) now I'm testing if the failure is just because of missing qemu-native dependency.

meta/classes/qemu.bbclass doesn't add the dependency on qemu-native and in image without any package which would be built with
meta/classes/fontcache.bbclass:DEPENDS += "qemu-native" meta/classes/pixbufcache.bbclass:DEPENDS += "qemu-native"
it's IMHO still possible to end with do_rootfs being executed without qemu-native being pulled into the build.

So v2 will came later after more testing.

Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#5 lore raw

PATCH 1/1 pango: Fix postinst by adding missing qemu-native dependency

* postinst_prologue calls qemu_run_binary but there is no dependency on qemu-native which causes postinst to sometimes fail which is fatal for building read-only rootfs

---
 meta/recipes-graphics/pango/pango.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-graphics/pango/pango.inc +1 -1
index 17006d3..4a20d20 100644
@@ -10,7 +10,7 @@ SECTION = "libs"
 LICENSE = "LGPLv2.0+"
 
 X11DEPENDS = "virtual/libx11 libxft"
-DEPENDS = "glib-2.0 fontconfig freetype zlib virtual/libiconv cairo harfbuzz"
+DEPENDS = "glib-2.0 fontconfig freetype zlib virtual/libiconv cairo harfbuzz qemu-native"
 
 PACKAGECONFIG ??= "${@base_contains('DISTRO_FEATURES', 'x11', 'x11', '', d)}"
 PACKAGECONFIG[x11] = "--with-xft,--without-xft,${X11DEPENDS}"
Signature · 1 line
1.9.0