[OE-core] [PATCH v1] postinst-intercepts: check tool presence in intercept hooks

Alexander Kanavin alex.kanavin at gmail.com
Wed Jun 26 18:10:20 UTC 2019


Basically they are executed only when you have something in your target image that requires their execution (usually to populate some database). If the execution fails for some reason, the correct way to handle that is to look into the failure instead of fixing the symptoms (missing files for instance).

Alex

> On 26 Jun 2019, at 19.33, Sinan Kaya <Okaya at kernel.org> wrote:
> 
> Here is my investigation:
> 
> The intercepts are executed on QEMU during cross-compilation using
> qemu-wrapper.
> 
> I see that the tools were built for the native architecture but
> of course they do not exist on the target image and I have no
> interest in pulling fonts and such into my image to make bitbake
> happy.
> 
> DEBUG: Collected intercepts:
>  poky/scripts/postinst-intercepts/update_font_cache
>  poky/scripts/postinst-intercepts/update_gio_module_cache
>  poky/scripts/postinst-intercepts/update_gtk_immodules_cache
>  poky/scripts/postinst-intercepts/update_icon_cache
>  poky/scripts/postinst-intercepts/update_pixbuf_cache
>  poky/scripts/postinst-intercepts/update_udev_hwdb
> 
> I also see that other intercepts are doing the same folder/executable
> checks.
> 
> What is so special about these?
> 
> 
>> On 6/26/2019 4:59 AM, Alexander Kanavin wrote:
>> Yes, this looks suspicious to me as well. If the tools are absent you
>> need to investigate why they are absent; skipping the tools execution is
>> just sweeping the problem under the carpet, not fixing it.
>> 
>> Alex
>> 
>> On Wed, 26 Jun 2019 at 04:15, ChenQi <Qi.Chen at windriver.com
>> <mailto:Qi.Chen at windriver.com>> wrote:
>> 
>>    Under which circumstances will the tools be absent?
>>    And why do you check the existence of files for some the the existence
>>    of directories for others?
>> 
>>    Best Regards,
>>    Chen Qi
>> 
>>>    On 06/26/2019 06:13 AM, Sinan Kaya wrote:
>>> do_rootfs: The postinstall intercept hook 'update_udev_hwdb'
>>> do_rootfs: The postinstall intercept hook
>>    'update_gio_module_cache' failed
>>> do_rootfs: The postinstall intercept hook 'update_icon_cache' failed
>>> do_rootfs: The postinstall intercept hook 'update_icon_cache' failed
>>> 
>>> Signed-off-by: Sinan Kaya <okaya at kernel.org <mailto:okaya at kernel.org>>
>>> ---
>>>    scripts/postinst-intercepts/update_font_cache    |  6 ++++--
>>>    .../postinst-intercepts/update_gio_module_cache  | 10 +++++++---
>>>    scripts/postinst-intercepts/update_icon_cache    | 16
>>    +++++++++-------
>>>    scripts/postinst-intercepts/update_pixbuf_cache  |  5 ++++-
>>>    scripts/postinst-intercepts/update_udev_hwdb     |  6 ++++--
>>>    5 files changed, 28 insertions(+), 15 deletions(-)
>>> 
>>> diff --git a/scripts/postinst-intercepts/update_font_cache
>>    b/scripts/postinst-intercepts/update_font_cache
>>> index 3053c7065f4..954acbb41b2 100644
>>> --- a/scripts/postinst-intercepts/update_font_cache
>>> +++ b/scripts/postinst-intercepts/update_font_cache
>>> @@ -5,5 +5,7 @@
>>>    
>>>    set -e
>>>    
>>> -PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D -E
>>    ${fontconfigcacheenv} $D${libexecdir}/${binprefix}fc-cache
>>    --sysroot=$D --system-only ${fontconfigcacheparams}
>>> -chown -R root:root $D${fontconfigcachedir}
>>> +if [ -f $D${libexecdir}/${binprefix}fc-cache ]; then
>>> +     PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D -E
>>    ${fontconfigcacheenv} $D${libexecdir}/${binprefix}fc-cache
>>    --sysroot=$D --system-only ${fontconfigcacheparams}
>>> +     chown -R root:root $D${fontconfigcachedir}
>>> +fi
>>> diff --git a/scripts/postinst-intercepts/update_gio_module_cache
>>    b/scripts/postinst-intercepts/update_gio_module_cache
>>> index c87fa85db9e..e8483cb0bf5 100644
>>> --- a/scripts/postinst-intercepts/update_gio_module_cache
>>> +++ b/scripts/postinst-intercepts/update_gio_module_cache
>>> @@ -5,7 +5,11 @@
>>>    
>>>    set -e
>>>    
>>> -PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D
>>    $D${libexecdir}/${binprefix}gio-querymodules $D${libdir}/gio/modules/
>>> +if [ -f $D${libexecdir}/${binprefix}gio-querymodules ]; then
>>> +
>>> +     PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D
>>    $D${libexecdir}/${binprefix}gio-querymodules $D${libdir}/gio/modules/
>>> +
>>> +     [ ! -e $D${libdir}/gio/modules/giomodule.cache ] ||
>>> +             chown root:root $D${libdir}/gio/modules/giomodule.cache
>>> +fi
>>>    
>>> -[ ! -e $D${libdir}/gio/modules/giomodule.cache ] ||
>>> -     chown root:root $D${libdir}/gio/modules/giomodule.cache
>>> diff --git a/scripts/postinst-intercepts/update_icon_cache
>>    b/scripts/postinst-intercepts/update_icon_cache
>>> index 212209a9daf..a67ff7ef970 100644
>>> --- a/scripts/postinst-intercepts/update_icon_cache
>>> +++ b/scripts/postinst-intercepts/update_icon_cache
>>> @@ -5,12 +5,14 @@
>>>    
>>>    set -e
>>>    
>>> -# update native pixbuf loaders
>>> 
>>    -$STAGING_DIR_NATIVE/${libdir_native}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders
>>    --update-cache
>>> +if [ -d $STAGING_DIR_NATIVE/${libdir_native}/gdk-pixbuf-2.0 ]; then
>>> +     # update native pixbuf loaders
>>> +   
>>     $STAGING_DIR_NATIVE/${libdir_native}/gdk-pixbuf-2.0/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
>>> +     for icondir in $D/usr/share/icons/*/ ; do
>>> +         if [ -d $icondir ] ; then
>>> +             gtk-update-icon-cache -fqt  $icondir
>>> +         fi
>>> +     done
>>> +fi
>>>    
>>> diff --git a/scripts/postinst-intercepts/update_pixbuf_cache
>>    b/scripts/postinst-intercepts/update_pixbuf_cache
>>> index ea12814474e..166422e5c37 100644
>>> --- a/scripts/postinst-intercepts/update_pixbuf_cache
>>> +++ b/scripts/postinst-intercepts/update_pixbuf_cache
>>> @@ -8,6 +8,9 @@ set -e
>>>    export
>>    GDK_PIXBUF_MODULEDIR=$D${libdir}/gdk-pixbuf-2.0/2.10.0/loaders
>>>    export GDK_PIXBUF_FATAL_LOADER=1
>>>    
>>> -PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D
>>    $D${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders \
>>> +if [ -d $D${libdir}/gdk-pixbuf-2.0 ]; then
>>> +     PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D
>>    $D${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders \
>>>        >$GDK_PIXBUF_MODULEDIR/../loaders.cache && \
>>>        sed -i -e "s:$D::g" $GDK_PIXBUF_MODULEDIR/../loaders.cache
>>> +fi
>>> +
>>> diff --git a/scripts/postinst-intercepts/update_udev_hwdb
>>    b/scripts/postinst-intercepts/update_udev_hwdb
>>> index c4fb2bffcbf..7b6e38338f3 100644
>>> --- a/scripts/postinst-intercepts/update_udev_hwdb
>>> +++ b/scripts/postinst-intercepts/update_udev_hwdb
>>> @@ -5,5 +5,7 @@
>>>    
>>>    set -e
>>>    
>>> -PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D
>>    $D${libexecdir}/${binprefix}udevadm hwdb --update --root $D
>>> -chown root:root $D${sysconfdir}/udev/hwdb.bin
>>> +if [ -d $D/lib/udev/hwdb.d ]; then
>>> +     PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D
>>    $D${libexecdir}/${binprefix}udevadm hwdb --update --root $D
>>> +     chown root:root $D${sysconfdir}/udev/hwdb.bin
>>> +fi
>> 
>> 
>>    -- 
>>    _______________________________________________
>>    Openembedded-core mailing list
>>    Openembedded-core at lists.openembedded.org
>>    <mailto:Openembedded-core at lists.openembedded.org>
>>    http://lists.openembedded.org/mailman/listinfo/openembedded-core
>> 
> 


More information about the Openembedded-core mailing list