Patchwork [RFC,4/7] gtk-icon-cache: run the icon generation at rootfs time

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

Comments

Laurentiu Palcu - Sept. 19, 2012, 11:49 a.m.
This change will allow for the icon cache generation at rootfs time and
only once, at the end. So, even though there will be many packages
depending on gtk+, the icon cache generation will be done once.
Hopefully, this will lower the target's first boot time significantly
by using the power of the host machine to generate the cache.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
 meta/classes/gtk-icon-cache.bbclass |   21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)
Khem Raj - Sept. 19, 2012, 1:28 p.m.
On Wed, Sep 19, 2012 at 4:49 AM, Laurentiu Palcu
<laurentiu.palcu@intel.com> wrote:
> This change will allow for the icon cache generation at rootfs time and
> only once, at the end. So, even though there will be many packages
> depending on gtk+, the icon cache generation will be done once.
> Hopefully, this will lower the target's first boot time significantly
> by using the power of the host machine to generate the cache.
>
> Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
> ---
>  meta/classes/gtk-icon-cache.bbclass |   21 +++++++++++++++++----
>  1 file changed, 17 insertions(+), 4 deletions(-)
>
> diff --git a/meta/classes/gtk-icon-cache.bbclass b/meta/classes/gtk-icon-cache.bbclass
> index 01fb2f3..f65b11c 100644
> --- a/meta/classes/gtk-icon-cache.bbclass
> +++ b/meta/classes/gtk-icon-cache.bbclass
> @@ -1,12 +1,24 @@
>  FILES_${PN} += "${datadir}/icons/hicolor"
>
> -DEPENDS += "${@['hicolor-icon-theme', '']['${BPN}' == 'hicolor-icon-theme']}"
> +DEPENDS += "${@['hicolor-icon-theme', '']['${BPN}' == 'hicolor-icon-theme']} gtk+-native"
>
> -# This could run on the host as icon cache files are architecture independent,
> -# but there is no gtk-update-icon-cache built natively.
>  gtk_icon_cache_postinst() {
>  if [ "x$D" != "x" ]; then
> -        exit 1
> +    if [ ! -f $INTERCEPT_DIR/update_icon_cache ]; then
> +        cat << "EOF" > $INTERCEPT_DIR/update_icon_cache
> +#!/bin/bash -x

Do you really need bash for this script to run ? if so then can it be
written so that it works on posixly shells.

> +
> +# Update the native pixbuf loader's cache
> +gdk-pixbuf-query-loaders --update-cache
> +
> +for icondir in $D/usr/share/icons/* ; do
> +    if [ -d $icondir ] ; then
> +        gtk-update-icon-cache -fqt  $icondir
> +    fi
> +done
> +EOF
> +    fi
> +    exit 0
>  fi
>
>  # Update the pixbuf loaders in case they haven't been registered yet
> @@ -17,6 +29,7 @@ for icondir in /usr/share/icons/* ; do
>          gtk-update-icon-cache -fqt  $icondir
>      fi
>  done
> +
>  }
>
>  gtk_icon_cache_postrm() {
> --
> 1.7.9.5
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Ross Burton - Sept. 19, 2012, 1:38 p.m.
On 19 September 2012 14:28, Khem Raj <raj.khem@gmail.com> wrote:
> Do you really need bash for this script to run ? if so then can it be
> written so that it works on posixly shells.

#! /bin/bash and no dependency on bash...  probably should make that
sh-compliant.

Ross
Laurentiu Palcu - Sept. 19, 2012, 3:26 p.m.
On 09/19/2012 04:38 PM, Burton, Ross wrote:
> On 19 September 2012 14:28, Khem Raj <raj.khem@gmail.com> wrote:
>> Do you really need bash for this script to run ? if so then can it be
>> written so that it works on posixly shells.
> 
> #! /bin/bash and no dependency on bash...  probably should make that
> sh-compliant.
Will do.

Thanks,
Laurentiu
> 
> Ross
>

Patch

diff --git a/meta/classes/gtk-icon-cache.bbclass b/meta/classes/gtk-icon-cache.bbclass
index 01fb2f3..f65b11c 100644
--- a/meta/classes/gtk-icon-cache.bbclass
+++ b/meta/classes/gtk-icon-cache.bbclass
@@ -1,12 +1,24 @@ 
 FILES_${PN} += "${datadir}/icons/hicolor"
 
-DEPENDS += "${@['hicolor-icon-theme', '']['${BPN}' == 'hicolor-icon-theme']}"
+DEPENDS += "${@['hicolor-icon-theme', '']['${BPN}' == 'hicolor-icon-theme']} gtk+-native"
 
-# This could run on the host as icon cache files are architecture independent,
-# but there is no gtk-update-icon-cache built natively.
 gtk_icon_cache_postinst() {
 if [ "x$D" != "x" ]; then
-        exit 1
+    if [ ! -f $INTERCEPT_DIR/update_icon_cache ]; then
+        cat << "EOF" > $INTERCEPT_DIR/update_icon_cache
+#!/bin/bash -x
+
+# Update the native pixbuf loader's cache
+gdk-pixbuf-query-loaders --update-cache
+
+for icondir in $D/usr/share/icons/* ; do
+    if [ -d $icondir ] ; then
+        gtk-update-icon-cache -fqt  $icondir
+    fi
+done
+EOF
+    fi
+    exit 0
 fi
 
 # Update the pixbuf loaders in case they haven't been registered yet
@@ -17,6 +29,7 @@  for icondir in /usr/share/icons/* ; do
         gtk-update-icon-cache -fqt  $icondir
     fi
 done
+
 }
 
 gtk_icon_cache_postrm() {