Patchwork [RFC,5/7] gdk-pixbuf: generate the pixbuf loader's cache ar rootfs time

login
register
mail settings
Submitter Laurentiu Palcu
Date Sept. 19, 2012, 11:49 a.m.
Message ID <5ad9edce72b7300237251048d1cddc22259d496f.1348052899.git.laurentiu.palcu@intel.com>
Download mbox | patch
Permalink /patch/36907/
State New
Headers show

Comments

Laurentiu Palcu - Sept. 19, 2012, 11:49 a.m.
This will generate the loaders.cache file for pixbuf, at rootfs time.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
 meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.24.1.bb |   24 ++++++++++++--------
 1 file changed, 14 insertions(+), 10 deletions(-)
Khem Raj - Sept. 19, 2012, 1:30 p.m.
On Wed, Sep 19, 2012 at 4:49 AM, Laurentiu Palcu
<laurentiu.palcu@intel.com> wrote:
> This will generate the loaders.cache file for pixbuf, at rootfs time.
>
> Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
> ---
>  meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.24.1.bb |   24 ++++++++++++--------
>  1 file changed, 14 insertions(+), 10 deletions(-)
>
> diff --git a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.24.1.bb b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.24.1.bb
> index 99f6cb4..c4afb97 100644
> --- a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.24.1.bb
> +++ b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.24.1.bb
> @@ -57,18 +57,22 @@ FILES_${PN}-dbg += " \
>
>  postinst_pixbufloader () {
>  if [ "x$D" != "x" ]; then
> -    exit 1
> +# Update the target's pixbuf loader's cache. Since the native binary will
> +# throw an error if the shared objects do not belong to the same ELF class,
> +# we trick the gdk-pixbuf-query-loaders into scanning the native shared
> +# objects and then we remove the NATIVE_ROOT prefix from the paths in
> +# loaders.cache.
> +gdk-pixbuf-query-loaders $(find $D/${libdir}/gdk-pixbuf-2.0/2.10.0/loaders \
> +        -name *.so | sed -e "s:$D:$NATIVE_ROOT:g") > \
> +        $D/${libdir}/gdk-pixbuf-2.0/2.10.0/loaders.cache || exit 1
> +
> +sed -i -e "s:$NATIVE_ROOT:/:g" $D/${libdir}/gdk-pixbuf-2.0/2.10.0/loaders.cache
> +



gdk-pixbuf-2.0/2.10.0 seems to be quite hardcoded. Can it be converted
into something more general may be use wildcard appropriately ?

> +exit 0
>  fi
>
> -GDK_PIXBUF_MODULEDIR=${libdir}/gdk-pixbuf-2.0/${LIBV}/loaders gdk-pixbuf-query-loaders --update-cache
> -
> -if [ -x ${bindir}/gtk-update-icon-cache ] && [ -d ${datadir}/icons ]; then
> -    for icondir in /usr/share/icons/*; do
> -        if [ -d ${icondir} ]; then
> -            gtk-update-icon-cache -t -q ${icondir}
> -        fi
> -    done
> -fi
> +# Update the pixbuf loaders in case they haven't been registered yet
> +GDK_PIXBUF_MODULEDIR=${libdir}/gdk-pixbuf-2.0/2.10.0/loaders gdk-pixbuf-query-loaders --update-cache
>  }
>
>  PACKAGES_DYNAMIC += "gdk-pixbuf-loader-*"
> --
> 1.7.9.5
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Laurentiu Palcu - Sept. 19, 2012, 3:29 p.m.
On 09/19/2012 04:30 PM, Khem Raj wrote:
> On Wed, Sep 19, 2012 at 4:49 AM, Laurentiu Palcu
> <laurentiu.palcu@intel.com> wrote:
>> This will generate the loaders.cache file for pixbuf, at rootfs time.
>>
>> Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
>> ---
>>  meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.24.1.bb |   24 ++++++++++++--------
>>  1 file changed, 14 insertions(+), 10 deletions(-)
>>
>> diff --git a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.24.1.bb b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.24.1.bb
>> index 99f6cb4..c4afb97 100644
>> --- a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.24.1.bb
>> +++ b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.24.1.bb
>> @@ -57,18 +57,22 @@ FILES_${PN}-dbg += " \
>>
>>  postinst_pixbufloader () {
>>  if [ "x$D" != "x" ]; then
>> -    exit 1
>> +# Update the target's pixbuf loader's cache. Since the native binary will
>> +# throw an error if the shared objects do not belong to the same ELF class,
>> +# we trick the gdk-pixbuf-query-loaders into scanning the native shared
>> +# objects and then we remove the NATIVE_ROOT prefix from the paths in
>> +# loaders.cache.
>> +gdk-pixbuf-query-loaders $(find $D/${libdir}/gdk-pixbuf-2.0/2.10.0/loaders \
>> +        -name *.so | sed -e "s:$D:$NATIVE_ROOT:g") > \
>> +        $D/${libdir}/gdk-pixbuf-2.0/2.10.0/loaders.cache || exit 1
>> +
>> +sed -i -e "s:$NATIVE_ROOT:/:g" $D/${libdir}/gdk-pixbuf-2.0/2.10.0/loaders.cache
>> +
> 
> 
> 
> gdk-pixbuf-2.0/2.10.0 seems to be quite hardcoded. Can it be converted
> into something more general may be use wildcard appropriately ?
I will investigate and see if I can find a more generic solution.
Basically, I just wanted to be consistent with what was already there.
I'll see what I can do.

Thanks,
Laurentiu
> 
>> +exit 0
>>  fi
>>
>> -GDK_PIXBUF_MODULEDIR=${libdir}/gdk-pixbuf-2.0/${LIBV}/loaders gdk-pixbuf-query-loaders --update-cache
>> -
>> -if [ -x ${bindir}/gtk-update-icon-cache ] && [ -d ${datadir}/icons ]; then
>> -    for icondir in /usr/share/icons/*; do
>> -        if [ -d ${icondir} ]; then
>> -            gtk-update-icon-cache -t -q ${icondir}
>> -        fi
>> -    done
>> -fi
>> +# Update the pixbuf loaders in case they haven't been registered yet
>> +GDK_PIXBUF_MODULEDIR=${libdir}/gdk-pixbuf-2.0/2.10.0/loaders gdk-pixbuf-query-loaders --update-cache
>>  }
>>
>>  PACKAGES_DYNAMIC += "gdk-pixbuf-loader-*"
>> --
>> 1.7.9.5
>>
>>
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core@lists.openembedded.org
>> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

Patch

diff --git a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.24.1.bb b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.24.1.bb
index 99f6cb4..c4afb97 100644
--- a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.24.1.bb
+++ b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.24.1.bb
@@ -57,18 +57,22 @@  FILES_${PN}-dbg += " \
 
 postinst_pixbufloader () {
 if [ "x$D" != "x" ]; then
-    exit 1
+# Update the target's pixbuf loader's cache. Since the native binary will
+# throw an error if the shared objects do not belong to the same ELF class,
+# we trick the gdk-pixbuf-query-loaders into scanning the native shared
+# objects and then we remove the NATIVE_ROOT prefix from the paths in
+# loaders.cache.
+gdk-pixbuf-query-loaders $(find $D/${libdir}/gdk-pixbuf-2.0/2.10.0/loaders \
+        -name *.so | sed -e "s:$D:$NATIVE_ROOT:g") > \
+        $D/${libdir}/gdk-pixbuf-2.0/2.10.0/loaders.cache || exit 1
+
+sed -i -e "s:$NATIVE_ROOT:/:g" $D/${libdir}/gdk-pixbuf-2.0/2.10.0/loaders.cache
+
+exit 0
 fi
 
-GDK_PIXBUF_MODULEDIR=${libdir}/gdk-pixbuf-2.0/${LIBV}/loaders gdk-pixbuf-query-loaders --update-cache
-
-if [ -x ${bindir}/gtk-update-icon-cache ] && [ -d ${datadir}/icons ]; then
-    for icondir in /usr/share/icons/*; do
-        if [ -d ${icondir} ]; then
-            gtk-update-icon-cache -t -q ${icondir}
-        fi
-    done
-fi
+# Update the pixbuf loaders in case they haven't been registered yet
+GDK_PIXBUF_MODULEDIR=${libdir}/gdk-pixbuf-2.0/2.10.0/loaders gdk-pixbuf-query-loaders --update-cache
 }
 
 PACKAGES_DYNAMIC += "gdk-pixbuf-loader-*"