diff mbox series

gtk-icon-cache.bbclass: replace += by :append

Message ID 20221229151110.224320-1-f_l_k@t-online.de
State New
Headers show
Series gtk-icon-cache.bbclass: replace += by :append | expand

Commit Message

Markus Volk Dec. 29, 2022, 3:11 p.m. UTC
While updating gnome-control-center I encountered an issue where
gtk-update-icon-cache could not be found and do_configure failed:

| Program glib-compile-schemas found: YES (glib-compile-schemas)
| Program gtk4-update-icon-cache found: NO
| Program gtk-update-icon-cache found: NO
|
| ../gnome-control-center-43.2/meson.build:298:6: ERROR: Program 'gtk-update-icon-cache' not found or not executable

This can be fixed by using DEPENDS:append instead of DEPENDS +=

Signed-off-by: Markus Volk <f_l_k@t-online.de>
---
 meta/classes-recipe/gtk-icon-cache.bbclass | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Alexander Kanavin Dec. 29, 2022, 3:14 p.m. UTC | #1
But what is the actual issue? Did depends end up malformed, and how?

Alex

On Thu 29. Dec 2022 at 16.11, Markus Volk <f_l_k@t-online.de> wrote:

> While updating gnome-control-center I encountered an issue where
> gtk-update-icon-cache could not be found and do_configure failed:
>
> | Program glib-compile-schemas found: YES (glib-compile-schemas)
> | Program gtk4-update-icon-cache found: NO
> | Program gtk-update-icon-cache found: NO
> |
> | ../gnome-control-center-43.2/meson.build:298:6: ERROR: Program
> 'gtk-update-icon-cache' not found or not executable
>
> This can be fixed by using DEPENDS:append instead of DEPENDS +=
>
> Signed-off-by: Markus Volk <f_l_k@t-online.de>
> ---
>  meta/classes-recipe/gtk-icon-cache.bbclass | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/meta/classes-recipe/gtk-icon-cache.bbclass
> b/meta/classes-recipe/gtk-icon-cache.bbclass
> index 9ecb49916c..2096dcfcbb 100644
> --- a/meta/classes-recipe/gtk-icon-cache.bbclass
> +++ b/meta/classes-recipe/gtk-icon-cache.bbclass
> @@ -16,10 +16,11 @@ GTKIC_CMD = "${@ 'gtk4-update-icon-cache' if
> d.getVar('GTKIC_VERSION') == '4' el
>  inherit features_check
>  ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}"
>
> -DEPENDS +=" ${@ '' if d.getVar('BPN') == 'hicolor-icon-theme' else
> 'hicolor-icon-theme' } \
> -            ${@ '' if d.getVar('BPN') == 'gdk-pixbuf' else 'gdk-pixbuf' }
> \
> -            ${@ '' if d.getVar('BPN') == d.getVar('GTKPN') else
> d.getVar('GTKPN') } \
> -            ${GTKPN}-native \
> +DEPENDS:append = " \
> +       ${@ '' if d.getVar('BPN') == 'hicolor-icon-theme' else
> 'hicolor-icon-theme' } \
> +       ${@ '' if d.getVar('BPN') == 'gdk-pixbuf' else 'gdk-pixbuf' } \
> +       ${@ '' if d.getVar('BPN') == d.getVar('GTKPN') else
> d.getVar('GTKPN') } \
> +       ${GTKPN}-native \
>  "
>
>  PACKAGE_WRITE_DEPS += "${GTKPN}-native gdk-pixbuf-native"
> --
> 2.34.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#175101):
> https://lists.openembedded.org/g/openembedded-core/message/175101
> Mute This Topic: https://lists.openembedded.org/mt/95937867/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
Martin Jansa Dec. 29, 2022, 3:18 p.m. UTC | #2
On Thu, Dec 29, 2022 at 4:14 PM Alexander Kanavin <alex.kanavin@gmail.com>
wrote:

> But what is the actual issue? Did depends end up malformed, and how?
>

My guess is that it was caused by gnome-control-center inheritting
gtk-icon-cache before setting DEPENDS, so the DEPENDS from bbclass are
overwritten.

Moving inherit bellow DEPENDS would solve it as well, but I agree that
append in this case might be less surprising as many people aren't very
careful about inherit position inside the recipe.
Mikko Rapeli Dec. 29, 2022, 3:20 p.m. UTC | #3
Hi,

On Thu, Dec 29, 2022 at 04:11:10PM +0100, Markus Volk wrote:
> While updating gnome-control-center I encountered an issue where
> gtk-update-icon-cache could not be found and do_configure failed:
> 
> | Program glib-compile-schemas found: YES (glib-compile-schemas)
> | Program gtk4-update-icon-cache found: NO
> | Program gtk-update-icon-cache found: NO
> |
> | ../gnome-control-center-43.2/meson.build:298:6: ERROR: Program 'gtk-update-icon-cache' not found or not executable
> 
> This can be fixed by using DEPENDS:append instead of DEPENDS +=

Why? += and :append are applied differently and it is crucial to
understand why this is a problem in your case.

IMO it's bad design to use :append everywhere because the changes can't
be overwritten in a bbappend without explicitly removing all added
things with :remove. In upstream and intermediate layers it's best to
use += where ever possible since these can then easily be overwritten in
product specific layers with a simple assignment.

Cheers,

-Mikko

> Signed-off-by: Markus Volk <f_l_k@t-online.de>
> ---
>  meta/classes-recipe/gtk-icon-cache.bbclass | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/meta/classes-recipe/gtk-icon-cache.bbclass b/meta/classes-recipe/gtk-icon-cache.bbclass
> index 9ecb49916c..2096dcfcbb 100644
> --- a/meta/classes-recipe/gtk-icon-cache.bbclass
> +++ b/meta/classes-recipe/gtk-icon-cache.bbclass
> @@ -16,10 +16,11 @@ GTKIC_CMD = "${@ 'gtk4-update-icon-cache' if d.getVar('GTKIC_VERSION') == '4' el
>  inherit features_check
>  ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}"
>  
> -DEPENDS +=" ${@ '' if d.getVar('BPN') == 'hicolor-icon-theme' else 'hicolor-icon-theme' } \
> -            ${@ '' if d.getVar('BPN') == 'gdk-pixbuf' else 'gdk-pixbuf' } \
> -            ${@ '' if d.getVar('BPN') == d.getVar('GTKPN') else d.getVar('GTKPN') } \
> -            ${GTKPN}-native \
> +DEPENDS:append = " \
> +	${@ '' if d.getVar('BPN') == 'hicolor-icon-theme' else 'hicolor-icon-theme' } \
> +	${@ '' if d.getVar('BPN') == 'gdk-pixbuf' else 'gdk-pixbuf' } \
> +	${@ '' if d.getVar('BPN') == d.getVar('GTKPN') else d.getVar('GTKPN') } \
> +	${GTKPN}-native \
>  "
>  
>  PACKAGE_WRITE_DEPS += "${GTKPN}-native gdk-pixbuf-native"
> -- 
> 2.34.1
> 

> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#175101): https://lists.openembedded.org/g/openembedded-core/message/175101
> Mute This Topic: https://lists.openembedded.org/mt/95937867/7159507
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [mikko.rapeli@linaro.org]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Markus Volk Dec. 29, 2022, 3:22 p.m. UTC | #4
Am Do, 29. Dez 2022 um 16:14:02 +0100 schrieb Alexander Kanavin 
<alex.kanavin@gmail.com>:
> But what is the actual issue? Did depends end up malformed, and how?

The issue is, that for whatever reason the DEPENDS += line gets ignored 
and I had to explicitly add gtk4-native to the DEPENDS of the 
gnome-control-center recipe to get gtk-update-icon-cache found although 
gtk-icon-cache was present in inherit.
Markus Volk Dec. 29, 2022, 3:27 p.m. UTC | #5
Am Do, 29. Dez 2022 um 16:18:26 +0100 schrieb Martin Jansa 
<Martin.Jansa@gmail.com>:
> My guess is that it was caused by gnome-control-center inheritting 
> gtk-icon-cache before setting DEPENDS, so the DEPENDS from bbclass 
> are overwritten.

Absolutely true, that's been my issue. Thanks for the hint
Richard Purdie Dec. 29, 2022, 5:16 p.m. UTC | #6
On Thu, 2022-12-29 at 17:20 +0200, Mikko Rapeli wrote:
> Hi,
> 
> On Thu, Dec 29, 2022 at 04:11:10PM +0100, Markus Volk wrote:
> > While updating gnome-control-center I encountered an issue where
> > gtk-update-icon-cache could not be found and do_configure failed:
> > 
> > > Program glib-compile-schemas found: YES (glib-compile-schemas)
> > > Program gtk4-update-icon-cache found: NO
> > > Program gtk-update-icon-cache found: NO
> > > 
> > > ../gnome-control-center-43.2/meson.build:298:6: ERROR: Program 'gtk-update-icon-cache' not found or not executable
> > 
> > This can be fixed by using DEPENDS:append instead of DEPENDS +=
> 
> Why? += and :append are applied differently and it is crucial to
> understand why this is a problem in your case.
> 
> IMO it's bad design to use :append everywhere because the changes can't
> be overwritten in a bbappend without explicitly removing all added
> things with :remove. In upstream and intermediate layers it's best to
> use += where ever possible since these can then easily be overwritten in
> product specific layers with a simple assignment.

I would much prefer to keep the += and tweak the other place this is
being set to use += as well so that :append isn't needed.

Replacing all += with DEPENDS (which is where this path leads) creates
different and likely harder problems.

Cheers,

Richard
Richard Purdie Dec. 29, 2022, 5:30 p.m. UTC | #7
On Thu, 2022-12-29 at 17:20 +0200, Mikko Rapeli wrote:
> Hi,
> 
> On Thu, Dec 29, 2022 at 04:11:10PM +0100, Markus Volk wrote:
> > While updating gnome-control-center I encountered an issue where
> > gtk-update-icon-cache could not be found and do_configure failed:
> > 
> > > Program glib-compile-schemas found: YES (glib-compile-schemas)
> > > Program gtk4-update-icon-cache found: NO
> > > Program gtk-update-icon-cache found: NO
> > > 
> > > ../gnome-control-center-43.2/meson.build:298:6: ERROR: Program 'gtk-update-icon-cache' not found or not executable
> > 
> > This can be fixed by using DEPENDS:append instead of DEPENDS +=
> 
> Why? += and :append are applied differently and it is crucial to
> understand why this is a problem in your case.
> 
> IMO it's bad design to use :append everywhere because the changes can't
> be overwritten in a bbappend without explicitly removing all added
> things with :remove. In upstream and intermediate layers it's best to
> use += where ever possible since these can then easily be overwritten in
> product specific layers with a simple assignment.

I would much prefer to keep the += and tweak the other place this is
being set to use += as well so that :append isn't needed.

Replacing all += with DEPENDS (which is where this path leads) creates
different and likely harder problems.

Cheers,

Richard
diff mbox series

Patch

diff --git a/meta/classes-recipe/gtk-icon-cache.bbclass b/meta/classes-recipe/gtk-icon-cache.bbclass
index 9ecb49916c..2096dcfcbb 100644
--- a/meta/classes-recipe/gtk-icon-cache.bbclass
+++ b/meta/classes-recipe/gtk-icon-cache.bbclass
@@ -16,10 +16,11 @@  GTKIC_CMD = "${@ 'gtk4-update-icon-cache' if d.getVar('GTKIC_VERSION') == '4' el
 inherit features_check
 ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}"
 
-DEPENDS +=" ${@ '' if d.getVar('BPN') == 'hicolor-icon-theme' else 'hicolor-icon-theme' } \
-            ${@ '' if d.getVar('BPN') == 'gdk-pixbuf' else 'gdk-pixbuf' } \
-            ${@ '' if d.getVar('BPN') == d.getVar('GTKPN') else d.getVar('GTKPN') } \
-            ${GTKPN}-native \
+DEPENDS:append = " \
+	${@ '' if d.getVar('BPN') == 'hicolor-icon-theme' else 'hicolor-icon-theme' } \
+	${@ '' if d.getVar('BPN') == 'gdk-pixbuf' else 'gdk-pixbuf' } \
+	${@ '' if d.getVar('BPN') == d.getVar('GTKPN') else d.getVar('GTKPN') } \
+	${GTKPN}-native \
 "
 
 PACKAGE_WRITE_DEPS += "${GTKPN}-native gdk-pixbuf-native"