[OE-core] [PATCH] gtk-icon-cache.bbclass: Fix multiple rebuilds of the icon cache on first boot

Andreas Müller schnitzeltony at googlemail.com
Mon Mar 26 11:43:48 UTC 2012


On Mon, Mar 26, 2012 at 11:19 AM, Richard Purdie
<richard.purdie at 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/




More information about the Openembedded-core mailing list