Patchwork pango: Fix postinst

login
register
mail settings
Submitter Martin Jansa
Date Feb. 27, 2014, 8:20 p.m.
Message ID <1393532438-20847-1-git-send-email-Martin.Jansa@gmail.com>
Download mbox | patch
Permalink /patch/67649/
State New
Headers show

Comments

Martin Jansa - Feb. 27, 2014, 8:20 p.m.
* 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)

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 meta/recipes-graphics/pango/pango.inc | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
Saul Wold - Feb. 27, 2014, 9:24 p.m.
On 02/27/2014 10:20 PM, Martin Jansa wrote:
> * 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)
>
> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
> ---
>   meta/recipes-graphics/pango/pango.inc | 14 +++++++++-----
>   1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/meta/recipes-graphics/pango/pango.inc b/meta/recipes-graphics/pango/pango.inc
> index 17006d3..5fddff9 100644
> --- a/meta/recipes-graphics/pango/pango.inc
> +++ b/meta/recipes-graphics/pango/pango.inc
> @@ -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
>
Are you missing a 'fi' here?

I got an error during parsing:
> 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!

>   	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}"
>
Martin Jansa - Feb. 27, 2014, 10:15 p.m.
On Thu, Feb 27, 2014 at 09:20:38PM +0100, Martin Jansa wrote:
> * 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

> 
> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
> ---
>  meta/recipes-graphics/pango/pango.inc | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/meta/recipes-graphics/pango/pango.inc b/meta/recipes-graphics/pango/pango.inc
> index 17006d3..5fddff9 100644
> --- a/meta/recipes-graphics/pango/pango.inc
> +++ b/meta/recipes-graphics/pango/pango.inc
> @@ -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}"
> -- 
> 1.9.0
>
Richard Purdie - Feb. 27, 2014, 10:17 p.m.
On Thu, 2014-02-27 at 23:15 +0100, Martin Jansa wrote:
> On Thu, Feb 27, 2014 at 09:20:38PM +0100, Martin Jansa wrote:
> > * 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

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
Martin Jansa - Feb. 27, 2014, 11:31 p.m.
On Thu, Feb 27, 2014 at 10:17:53PM +0000, Richard Purdie wrote:
> On Thu, 2014-02-27 at 23:15 +0100, Martin Jansa wrote:
> > On Thu, Feb 27, 2014 at 09:20:38PM +0100, Martin Jansa wrote:
> > > * 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
> 
> 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.

Patch

diff --git a/meta/recipes-graphics/pango/pango.inc b/meta/recipes-graphics/pango/pango.inc
index 17006d3..5fddff9 100644
--- a/meta/recipes-graphics/pango/pango.inc
+++ b/meta/recipes-graphics/pango/pango.inc
@@ -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}"