Patchwork [1/4] gtk-icon-cache.bbclass:fix support postrm at image creation time

login
register
mail settings
Submitter Hongxu Jia
Date Jan. 17, 2013, 7:07 a.m.
Message ID <4dc1347ed4057656a542263878aeeadf768dd2e9.1358406049.git.hongxu.jia@windriver.com>
Download mbox | patch
Permalink /patch/42761/
State New
Headers show

Comments

Hongxu Jia - Jan. 17, 2013, 7:07 a.m.
The gtk_icon_cache_postrm failed at image creation time because ${D} is not
assigned as the prefix of icondir.

[YOCTO #3633]

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 meta/classes/gtk-icon-cache.bbclass |    9 +++++++++
 1 file changed, 9 insertions(+)
Laurentiu Palcu - Jan. 17, 2013, 9:10 a.m.
On 01/17/2013 09:07 AM, Hongxu Jia wrote:
>  gtk_icon_cache_postrm() {
> +if [ "$D" != "" ]; then
> +    for icondir in $D/usr/share/icons/* ; do
> +        if [ -d $icondir ] ; then
> +            gtk-update-icon-cache -qt  $icondir
> +        fi
> +    done
> +    exit 0
> +fi
I think you can just exit 0 here and let the hook in intercept-scripts
directory do the rest. The hook was added in the postinst and it will
properly call gtk-update-icon-cache. If you look in the log.do_rootfs
you'll see that the intercept scripts are run at the end (just look for
"Running intercept scripts"). So, I don't think you need to do this loop
here. Besides, it will be called for every postrm and running
gtk-update-icon-cache is not cheap...

Thanks,
Laurentiu
Martin Jansa - Jan. 17, 2013, 9:26 a.m.
On Thu, Jan 17, 2013 at 03:07:19PM +0800, Hongxu Jia wrote:
> The gtk_icon_cache_postrm failed at image creation time because ${D} is not
> assigned as the prefix of icondir.

Some packages are removed at image creation time? Why is postrm
executed?

And why don't use use $D in both cases (when empty and not empty) those
2 for cycles look the same.
 
Cheers,

> [YOCTO #3633]
> 
> Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
> ---
>  meta/classes/gtk-icon-cache.bbclass |    9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/meta/classes/gtk-icon-cache.bbclass b/meta/classes/gtk-icon-cache.bbclass
> index 7c7dd78..4499782 100644
> --- a/meta/classes/gtk-icon-cache.bbclass
> +++ b/meta/classes/gtk-icon-cache.bbclass
> @@ -32,6 +32,15 @@ done
>  }
>  
>  gtk_icon_cache_postrm() {
> +if [ "$D" != "" ]; then
> +    for icondir in $D/usr/share/icons/* ; do
> +        if [ -d $icondir ] ; then
> +            gtk-update-icon-cache -qt  $icondir
> +        fi
> +    done
> +    exit 0
> +fi
> +
>  for icondir in /usr/share/icons/* ; do
>      if [ -d $icondir ] ; then
>          gtk-update-icon-cache -qt  $icondir
> -- 
> 1.7.10.4
> 
> 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Hongxu Jia - Jan. 17, 2013, 9:39 a.m.
On 01/17/2013 05:10 PM, Laurentiu Palcu wrote:
>
> On 01/17/2013 09:07 AM, Hongxu Jia wrote:
>>   gtk_icon_cache_postrm() {
>> +if [ "$D" != "" ]; then
>> +    for icondir in $D/usr/share/icons/* ; do
>> +        if [ -d $icondir ] ; then
>> +            gtk-update-icon-cache -qt  $icondir
>> +        fi
>> +    done
>> +    exit 0
>> +fi
> I think you can just exit 0 here and let the hook in intercept-scripts
> directory do the rest. The hook was added in the postinst and it will
> properly call gtk-update-icon-cache. If you look in the log.do_rootfs
> you'll see that the intercept scripts are run at the end (just look for
> "Running intercept scripts"). So, I don't think you need to do this loop
> here. Besides, it will be called for every postrm and running
> gtk-update-icon-cache is not cheap...
>
> Thanks,
> Laurentiu
Ok, I will work on it to let the hook in intercept-scripts do the rest.

Thanks,
Hongxu
Laurentiu Palcu - Jan. 17, 2013, 9:51 a.m.
On 01/17/2013 11:39 AM, Hongxu Jia wrote:
> On 01/17/2013 05:10 PM, Laurentiu Palcu wrote:
>>
>> On 01/17/2013 09:07 AM, Hongxu Jia wrote:
>>>   gtk_icon_cache_postrm() {
>>> +if [ "$D" != "" ]; then
>>> +    for icondir in $D/usr/share/icons/* ; do
>>> +        if [ -d $icondir ] ; then
>>> +            gtk-update-icon-cache -qt  $icondir
>>> +        fi
>>> +    done
>>> +    exit 0
>>> +fi
>> I think you can just exit 0 here and let the hook in intercept-scripts
>> directory do the rest. The hook was added in the postinst and it will
>> properly call gtk-update-icon-cache. If you look in the log.do_rootfs
>> you'll see that the intercept scripts are run at the end (just look for
>> "Running intercept scripts"). So, I don't think you need to do this loop
>> here. Besides, it will be called for every postrm and running
>> gtk-update-icon-cache is not cheap...
>>
>> Thanks,
>> Laurentiu
> Ok, I will work on it to let the hook in intercept-scripts do the rest.
I just realized that, in order for the hook to be installed, the postint
scriptlet has to be run in the same do_rootfs session, otherwise the
hook will not be installed... In which case you might want to do that in
the postrm itself (like it was done for postinst).

Thanks,
Laurentiu

> 
> Thanks,
> Hongxu
>

Patch

diff --git a/meta/classes/gtk-icon-cache.bbclass b/meta/classes/gtk-icon-cache.bbclass
index 7c7dd78..4499782 100644
--- a/meta/classes/gtk-icon-cache.bbclass
+++ b/meta/classes/gtk-icon-cache.bbclass
@@ -32,6 +32,15 @@  done
 }
 
 gtk_icon_cache_postrm() {
+if [ "$D" != "" ]; then
+    for icondir in $D/usr/share/icons/* ; do
+        if [ -d $icondir ] ; then
+            gtk-update-icon-cache -qt  $icondir
+        fi
+    done
+    exit 0
+fi
+
 for icondir in /usr/share/icons/* ; do
     if [ -d $icondir ] ; then
         gtk-update-icon-cache -qt  $icondir