Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] gtk-icon-cache.bbclass: Fix multiple rebuilds of the icon cache on first boot
@ 2012-03-22 19:15 Andreas Müller
  2012-03-22 19:34 ` Koen Kooi
  2012-03-23 12:12 ` Richard Purdie
  0 siblings, 2 replies; 10+ messages in thread
From: Andreas Müller @ 2012-03-22 19:15 UTC (permalink / raw)
  To: openembedded-core

* Before this patch every inheritance of this class rebuilt the full icon cache at the first boot.
* With this patch the icon cache will only be build once at the first boot and on pkg installations that require it.
* This patch reduces the time needed for the first boot from 96 minutes to 5 minutes on the test machine.
* Build-tested incremental (BB_SIGNATURE_HANDLER = "OEBasicHash") & from scratch
* Run-tested with systemd and opkg

Signed-off-by: Samuel Stirtzel <s.stirtzel@googlemail.com>
Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
---
 meta/classes/gtk-icon-cache.bbclass                |   19 +++++++++-------
 .../gtk+/gtk-update-icon-cache-runonce.bb          |   23 ++++++++++++++++++++
 .../gtk-update-icon-cache-runonce.in               |   16 +++++++++++++
 3 files changed, 50 insertions(+), 8 deletions(-)
 create mode 100644 meta/recipes-gnome/gtk+/gtk-update-icon-cache-runonce.bb
 create mode 100644 meta/recipes-gnome/gtk+/gtk-update-icon-cache-runonce/gtk-update-icon-cache-runonce.in

diff --git a/meta/classes/gtk-icon-cache.bbclass b/meta/classes/gtk-icon-cache.bbclass
index 60e3401..b48aabe 100644
--- a/meta/classes/gtk-icon-cache.bbclass
+++ b/meta/classes/gtk-icon-cache.bbclass
@@ -9,14 +9,16 @@ if [ "x$D" != "x" ]; then
         exit 1
 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
-
-for icondir in /usr/share/icons/* ; do
-    if [ -d $icondir ] ; then
-        gtk-update-icon-cache -fqt  $icondir
-    fi
-done
+# do not execute in case a final run-once is waiting
+if [ ! -e ${sysconfdir}/init.d/gtk-update-icon-cache-runonce ]; then
+    # 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
+    for icondir in /usr/share/icons/* ; do
+        if [ -d $icondir ] ; then
+            gtk-update-icon-cache -fqt  $icondir
+        fi
+    done
+fi
 }
 
 gtk_icon_cache_postrm() {
@@ -56,3 +58,4 @@ python populate_packages_append () {
 		d.setVar('pkg_postrm_%s' % pkg, postrm)
 }
 
+RDEPENDS += "gtk-update-icon-cache-runonce"
diff --git a/meta/recipes-gnome/gtk+/gtk-update-icon-cache-runonce.bb b/meta/recipes-gnome/gtk+/gtk-update-icon-cache-runonce.bb
new file mode 100644
index 0000000..55bec67
--- /dev/null
+++ b/meta/recipes-gnome/gtk+/gtk-update-icon-cache-runonce.bb
@@ -0,0 +1,23 @@
+DESCRIPTION = "Init script calling gtk-update-icon-cache once"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58"
+
+SRC_URI = "file://gtk-update-icon-cache-runonce.in"
+
+INIT_SEQ_NUM = "99"
+
+inherit update-rc.d
+
+do_install() {
+	install -d ${D}${sysconfdir}/init.d
+	sed -e 's,@libdir@,${libdir},g' \
+            -e 's,@datadir@,${datadir},g' \
+            -e 's,@sysconfdir@,${sysconfdir},g' \
+            -e 's,@INIT_SEQ_NUM@,${INIT_SEQ_NUM},g' \
+             < ${WORKDIR}/gtk-update-icon-cache-runonce.in \
+             > ${D}${sysconfdir}/init.d/gtk-update-icon-cache-runonce
+	chmod 755 ${D}${sysconfdir}/init.d/gtk-update-icon-cache-runonce
+}
+
+INITSCRIPT_NAME = "gtk-update-icon-cache-runonce"
+INITSCRIPT_PARAMS = "start ${INIT_SEQ_NUM} S ."
diff --git a/meta/recipes-gnome/gtk+/gtk-update-icon-cache-runonce/gtk-update-icon-cache-runonce.in b/meta/recipes-gnome/gtk+/gtk-update-icon-cache-runonce/gtk-update-icon-cache-runonce.in
new file mode 100644
index 0000000..8952e1a
--- /dev/null
+++ b/meta/recipes-gnome/gtk+/gtk-update-icon-cache-runonce/gtk-update-icon-cache-runonce.in
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+echo 'Updating the GTK icon cache...'
+
+# 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
+
+for icondir in @datadir@/icons/* ; do
+    if [ -d $icondir ] ; then
+        gtk-update-icon-cache -fqt $icondir
+    fi
+done
+
+# This script should only run once at the first boot of the machine
+rm -f @sysconfdir@/rcS.d/S@INIT_SEQ_NUM@gtk-update-icon-cache-runonce
+rm -f @sysconfdir@/init.d/gtk-update-icon-cache-runonce
-- 
1.7.6.5




^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-03-26 11:52 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-22 19:15 [PATCH] gtk-icon-cache.bbclass: Fix multiple rebuilds of the icon cache on first boot Andreas Müller
2012-03-22 19:34 ` Koen Kooi
2012-03-22 19:51   ` Andreas Müller
2012-03-22 20:06     ` Koen Kooi
2012-03-23 12:12 ` Richard Purdie
2012-03-23 22:46   ` Andreas Müller
2012-03-23 23:37     ` Richard Purdie
2012-03-26  7:39       ` Andreas Müller
2012-03-26  9:19         ` Richard Purdie
2012-03-26 11:43           ` Andreas Müller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox