* [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
* Re: [PATCH] gtk-icon-cache.bbclass: Fix multiple rebuilds of the icon cache on first boot
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-23 12:12 ` Richard Purdie
1 sibling, 1 reply; 10+ messages in thread
From: Koen Kooi @ 2012-03-22 19:34 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
Op 22 mrt. 2012, om 20:15 heeft Andreas Müller het volgende geschreven:
> * 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
Wouldn't adding it to the opkg intercept code (and likely rpm as well) be a better idea?
regards,
Koen
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] gtk-icon-cache.bbclass: Fix multiple rebuilds of the icon cache on first boot
2012-03-22 19:34 ` Koen Kooi
@ 2012-03-22 19:51 ` Andreas Müller
2012-03-22 20:06 ` Koen Kooi
0 siblings, 1 reply; 10+ messages in thread
From: Andreas Müller @ 2012-03-22 19:51 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
On Thu, Mar 22, 2012 at 8:34 PM, Koen Kooi <koen@dominion.thruhere.net> wrote:
>
> Op 22 mrt. 2012, om 20:15 heeft Andreas Müller het volgende geschreven:
>
>> * 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
>
> Wouldn't adding it to the opkg intercept code (and likely rpm as well) be a better idea?
>
We wanted to be independent of package manager selected and decided to
follow the systemd-compat-units approach. Ehm opkg intercept code -
teach me :)
Andreas
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] gtk-icon-cache.bbclass: Fix multiple rebuilds of the icon cache on first boot
2012-03-22 19:51 ` Andreas Müller
@ 2012-03-22 20:06 ` Koen Kooi
0 siblings, 0 replies; 10+ messages in thread
From: Koen Kooi @ 2012-03-22 20:06 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
Op 22 mrt. 2012, om 20:51 heeft Andreas Müller het volgende geschreven:
> On Thu, Mar 22, 2012 at 8:34 PM, Koen Kooi <koen@dominion.thruhere.net> wrote:
>>
>> Op 22 mrt. 2012, om 20:15 heeft Andreas Müller het volgende geschreven:
>>
>>> * 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
>>
>> Wouldn't adding it to the opkg intercept code (and likely rpm as well) be a better idea?
>>
> We wanted to be independent of package manager selected and decided to
> follow the systemd-compat-units approach. Ehm opkg intercept code -
> teach me :)
Have a look at http://code.google.com/p/opkg/source/browse/#svn%2Ftrunk%2Fintercept
It is a bit iffy to encode knowledge of postinsts into the package manager, but you show that something like that is needed. Another thought: can the icon updates be done at do_rootfs time and mark the postinsts as done?
regards,
Koen
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] gtk-icon-cache.bbclass: Fix multiple rebuilds of the icon cache on first boot
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-23 12:12 ` Richard Purdie
2012-03-23 22:46 ` Andreas Müller
1 sibling, 1 reply; 10+ messages in thread
From: Richard Purdie @ 2012-03-23 12:12 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
On Thu, 2012-03-22 at 20:15 +0100, Andreas Müller wrote:
> * 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
Can't we just reduce this to adding a "touch
${sysconfdir}/init.d/gtk-update-icon-cache-runonce" to the above code
and then clear that file at boot time?
Cheers,
Richard
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] gtk-icon-cache.bbclass: Fix multiple rebuilds of the icon cache on first boot
2012-03-23 12:12 ` Richard Purdie
@ 2012-03-23 22:46 ` Andreas Müller
2012-03-23 23:37 ` Richard Purdie
0 siblings, 1 reply; 10+ messages in thread
From: Andreas Müller @ 2012-03-23 22:46 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
On Fri, Mar 23, 2012 at 1:12 PM, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
> On Thu, 2012-03-22 at 20:15 +0100, Andreas Müller wrote:
>> * 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
>
>
> Can't we just reduce this to adding a "touch
> ${sysconfdir}/init.d/gtk-update-icon-cache-runonce" to the above code
> and then clear that file at boot time?
>
Maybe it's a misunderstanding on my side but how shall an empty file
cover the three tasks during 1st boot:
1. Preventing all postints of running gtk-update-icon-cache by existing
2. Running gtk-update-icon-cache ( after postinsts )
3. Deleting itself and thereby avoid running during subsequent boots
and ensuring that packages which are installed later do run
gtk-update-icon-cache.
Andreas
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] gtk-icon-cache.bbclass: Fix multiple rebuilds of the icon cache on first boot
2012-03-23 22:46 ` Andreas Müller
@ 2012-03-23 23:37 ` Richard Purdie
2012-03-26 7:39 ` Andreas Müller
0 siblings, 1 reply; 10+ messages in thread
From: Richard Purdie @ 2012-03-23 23:37 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
On Fri, 2012-03-23 at 23:46 +0100, Andreas Müller wrote:
> On Fri, Mar 23, 2012 at 1:12 PM, Richard Purdie
> <richard.purdie@linuxfoundation.org> wrote:
> > On Thu, 2012-03-22 at 20:15 +0100, Andreas Müller wrote:
> >> * 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
> >
> >
> > Can't we just reduce this to adding a "touch
> > ${sysconfdir}/init.d/gtk-update-icon-cache-runonce" to the above code
> > and then clear that file at boot time?
> >
> Maybe it's a misunderstanding on my side but how shall an empty file
> cover the three tasks during 1st boot:
>
> 1. Preventing all postints of running gtk-update-icon-cache by existing
> 2. Running gtk-update-icon-cache ( after postinsts )
> 3. Deleting itself and thereby avoid running during subsequent boots
> and ensuring that packages which are installed later do run
> gtk-update-icon-cache.
The first time something tries this it creates the "lock".
Any subsequent postinstall sees the "lock" and knows not to run.
There are two problems:
a) Knowing these are postinstalls at first boot and not package installs
b) Deleting the unused "lock" files afterwards
You'd therefore probably have to add something to the postinstalls core
which:
a) Creates some file during final rootfs postinstalls on first boot
b) Clears some set of files after first boot.
I don't see a major issue with doing either of these two things though
and it would simplify your patch whilst also allowing other similar
cases to work in a similar way.
Cheers,
Richard
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] gtk-icon-cache.bbclass: Fix multiple rebuilds of the icon cache on first boot
2012-03-23 23:37 ` Richard Purdie
@ 2012-03-26 7:39 ` Andreas Müller
2012-03-26 9:19 ` Richard Purdie
0 siblings, 1 reply; 10+ messages in thread
From: Andreas Müller @ 2012-03-26 7:39 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
On Sat, Mar 24, 2012 at 12:37 AM, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
> On Fri, 2012-03-23 at 23:46 +0100, Andreas Müller wrote:
>> On Fri, Mar 23, 2012 at 1:12 PM, Richard Purdie
>> <richard.purdie@linuxfoundation.org> wrote:
>> > On Thu, 2012-03-22 at 20:15 +0100, Andreas Müller wrote:
>> >> * 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
>> >
>> >
>> > Can't we just reduce this to adding a "touch
>> > ${sysconfdir}/init.d/gtk-update-icon-cache-runonce" to the above code
>> > and then clear that file at boot time?
>> >
>> Maybe it's a misunderstanding on my side but how shall an empty file
>> cover the three tasks during 1st boot:
>>
>> 1. Preventing all postints of running gtk-update-icon-cache by existing
>> 2. Running gtk-update-icon-cache ( after postinsts )
>> 3. Deleting itself and thereby avoid running during subsequent boots
>> and ensuring that packages which are installed later do run
>> gtk-update-icon-cache.
>
> The first time something tries this it creates the "lock".
> Any subsequent postinstall sees the "lock" and knows not to run.
>
> There are two problems:
>
> a) Knowing these are postinstalls at first boot and not package installs
> b) Deleting the unused "lock" files afterwards
>
> You'd therefore probably have to add something to the postinstalls core
> which:
>
> a) Creates some file during final rootfs postinstalls on first boot
> b) Clears some set of files after first boot.
Isn't this exactly what we are doing?
>
> I don't see a major issue with doing either of these two things though
> and it would simplify your patch whilst also allowing other similar
> cases to work in a similar way.
>
We presented a working solution fixing an issue existing for long time
and don't see that this suggestion gives major enhancements. Feel free
to present a different solution.
Andreas
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] gtk-icon-cache.bbclass: Fix multiple rebuilds of the icon cache on first boot
2012-03-26 7:39 ` Andreas Müller
@ 2012-03-26 9:19 ` Richard Purdie
2012-03-26 11:43 ` Andreas Müller
0 siblings, 1 reply; 10+ messages in thread
From: Richard Purdie @ 2012-03-26 9:19 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
On Mon, 2012-03-26 at 09:39 +0200, Andreas Müller wrote:
> On Sat, Mar 24, 2012 at 12:37 AM, Richard Purdie
> <richard.purdie@linuxfoundation.org> wrote:
> > On Fri, 2012-03-23 at 23:46 +0100, Andreas Müller wrote:
> >> On Fri, Mar 23, 2012 at 1:12 PM, Richard Purdie
> >> <richard.purdie@linuxfoundation.org> wrote:
> >> > On Thu, 2012-03-22 at 20:15 +0100, Andreas Müller wrote:
> >> >> * 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
> >> >
> >> >
> >> > Can't we just reduce this to adding a "touch
> >> > ${sysconfdir}/init.d/gtk-update-icon-cache-runonce" to the above code
> >> > and then clear that file at boot time?
> >> >
> >> Maybe it's a misunderstanding on my side but how shall an empty file
> >> cover the three tasks during 1st boot:
> >>
> >> 1. Preventing all postints of running gtk-update-icon-cache by existing
> >> 2. Running gtk-update-icon-cache ( after postinsts )
> >> 3. Deleting itself and thereby avoid running during subsequent boots
> >> and ensuring that packages which are installed later do run
> >> gtk-update-icon-cache.
> >
> > The first time something tries this it creates the "lock".
> > Any subsequent postinstall sees the "lock" and knows not to run.
> >
> > There are two problems:
> >
> > a) Knowing these are postinstalls at first boot and not package installs
> > b) Deleting the unused "lock" files afterwards
> >
> > You'd therefore probably have to add something to the postinstalls core
> > which:
> >
> > a) Creates some file during final rootfs postinstalls on first boot
> > b) Clears some set of files after first boot.
> Isn't this exactly what we are doing?
> >
> > I don't see a major issue with doing either of these two things though
> > and it would simplify your patch whilst also allowing other similar
> > cases to work in a similar way.
> >
> We presented a working solution fixing an issue existing for long time
> and don't see that this suggestion gives major enhancements. Feel free
> to present a different solution.
Right, what I'm trying to figure out is whether we can simplify that
implementation a little so we don't need a new recipe, dependencies and
a new init script. There is nothing wrong with that solution but I think
its possible to simplify things a little.
My worry is whether the simplifications I have in mind will work in the
systemd world :/.
Cheers,
Richard
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] gtk-icon-cache.bbclass: Fix multiple rebuilds of the icon cache on first boot
2012-03-26 9:19 ` Richard Purdie
@ 2012-03-26 11:43 ` Andreas Müller
0 siblings, 0 replies; 10+ messages in thread
From: Andreas Müller @ 2012-03-26 11:43 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
On Mon, Mar 26, 2012 at 11:19 AM, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
>> > There are two problems:
>> >
>> > a) Knowing these are postinstalls at first boot and not package installs
>> > b) Deleting the unused "lock" files afterwards
>> >
>> > You'd therefore probably have to add something to the postinstalls core
>> > which:
>> >
>> > a) Creates some file during final rootfs postinstalls on first boot
>> > b) Clears some set of files after first boot.
>> Isn't this exactly what we are doing?
>> >
>> > I don't see a major issue with doing either of these two things though
>> > and it would simplify your patch whilst also allowing other similar
>> > cases to work in a similar way.
>> >
>> We presented a working solution fixing an issue existing for long time
>> and don't see that this suggestion gives major enhancements. Feel free
>> to present a different solution.
>
> Right, what I'm trying to figure out is whether we can simplify that
> implementation a little so we don't need a new recipe, dependencies and
> a new init script. There is nothing wrong with that solution but I think
> its possible to simplify things a little.
OK - you are looking for a more generic approach (next candidate might
be mime.bbclass/update-mime-database). Without taking care of how /
where / by whom a framework for runonce-functionalty is going to be
implemented - how about:
* Each class/recipe requiring runonce functionality adds code
snippets by appending into a global variable. For
gtk-icon-cache.bbclass something like
<snip>
gtk-update-icon-cache-runonce = " \
gtk-update-icon-cache-runonce() {
for icondir in @datadir@/icons/* ; do \
if [ -d $icondir ] ; then \
gtk-update-icon-cache -fqt $icondir
fi
done
}
"
# online
RUNONCE_TASKS += "gtk-update-icon-cache-runonce"
# offline - requires gtk+-native
# RUNONCE_TASKS_OFFLINE += "gtk-update-icon-cache-runonce"
gtk_icon_cache_postinst() {
if [ "x$D" != "x" ]; then
exit 1
fi
# after 1st boot
if [ ! -e ${sysconfdir}/init.d/runonce ]; then
${gtk-update-icon-cache-runonce}
fi
}
<\snip>
* In case the global variable RUNONCE_TASKS is not empty, the
framework creates one systemwide initscript (
${sysconfdir}/init.d/runonce ) + systemd-service ( we sent systemd
implementation for gtk-icon-update approach in meta-oe [1] ). The
contents of this script are the snippets and code to delete itself and
systemd-stuff. Since the code snippets are identified by a name ( here
gtk-update-icon-cache-runonce ), it is no problem to ensure that each
snippet is added only once.
* In case RUNONCE_TASK_OFFLINE is not empty, the framework creates
one script with similar contents. This is called after
offline-postinst. If we decide to have gtk+-native in oe-core, we
could do gtk-icon-update offline ( as Koen suggested ).
> My worry is whether the simplifications I have in mind will work in the
> systemd world :/.
See above
Andreas
[1] http://patches.openembedded.org/patch/24181/
^ permalink raw reply [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