diff mbox series

[V2] bash-completion.bbclass: prepend bash-completion to PACKAGES

Message ID 20251109173407.1320188-1-liu.ming50@gmail.com
State New
Headers show
Series [V2] bash-completion.bbclass: prepend bash-completion to PACKAGES | expand

Commit Message

Ming Liu Nov. 9, 2025, 5:34 p.m. UTC
It was observed when FILES:${PN} contains "${sysconfdir}" or
"${datadir}", the bash-completion files wont be installed to
bash-completion package.

Fix it by prepending bash-completion package to PACKAGES, this
ensures bash-completion package get the files packaged before PN.

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
---
 meta/classes-recipe/bash-completion.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ross Burton Nov. 10, 2025, 5:53 p.m. UTC | #1
On 9 Nov 2025, at 17:34, Ming Liu via lists.openembedded.org <liu.ming50=gmail.com@lists.openembedded.org> wrote:
> 
> It was observed when FILES:${PN} contains "${sysconfdir}" or
> "${datadir}", the bash-completion files wont be installed to
> bash-completion package.
> 
> Fix it by prepending bash-completion package to PACKAGES, this
> ensures bash-completion package get the files packaged before PN.
> 
> Signed-off-by: Ming Liu <liu.ming50@gmail.com>
> ---
> meta/classes-recipe/bash-completion.bbclass | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta/classes-recipe/bash-completion.bbclass b/meta/classes-recipe/bash-completion.bbclass
> index b656e76c09..e337c2045d 100644
> --- a/meta/classes-recipe/bash-completion.bbclass
> +++ b/meta/classes-recipe/bash-completion.bbclass
> @@ -6,7 +6,7 @@
> 
> DEPENDS:append:class-target = " bash-completion"
> 
> -PACKAGES += "${PN}-bash-completion"
> +PACKAGES:prepend = "${PN}-bash-completion “

Please use PACKAGES_BEFORE_PN for this, and just +=.

Ross
Ming Liu Nov. 11, 2025, 8:17 a.m. UTC | #2
Hi, Ross:

I was using exact PACKAGES_BEFORE_PN with += as you suggested in V1 patch,
but it broke the build, clearly PACKAGES_BEFORE_PN is not handled correctly
in some recipes.

//Ming Liu

Ross Burton <Ross.Burton@arm.com> 於 2025年11月10日 週一 下午6:54寫道:

> On 9 Nov 2025, at 17:34, Ming Liu via lists.openembedded.org <liu.ming50=
> gmail.com@lists.openembedded.org> wrote:
> >
> > It was observed when FILES:${PN} contains "${sysconfdir}" or
> > "${datadir}", the bash-completion files wont be installed to
> > bash-completion package.
> >
> > Fix it by prepending bash-completion package to PACKAGES, this
> > ensures bash-completion package get the files packaged before PN.
> >
> > Signed-off-by: Ming Liu <liu.ming50@gmail.com>
> > ---
> > meta/classes-recipe/bash-completion.bbclass | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/meta/classes-recipe/bash-completion.bbclass
> b/meta/classes-recipe/bash-completion.bbclass
> > index b656e76c09..e337c2045d 100644
> > --- a/meta/classes-recipe/bash-completion.bbclass
> > +++ b/meta/classes-recipe/bash-completion.bbclass
> > @@ -6,7 +6,7 @@
> >
> > DEPENDS:append:class-target = " bash-completion"
> >
> > -PACKAGES += "${PN}-bash-completion"
> > +PACKAGES:prepend = "${PN}-bash-completion “
>
> Please use PACKAGES_BEFORE_PN for this, and just +=.
>
> Ross
>
>
Ross Burton Nov. 11, 2025, 10:49 a.m. UTC | #3
On 11 Nov 2025, at 08:17, Ming Liu <liu.ming50@gmail.com> wrote:
> 
> I was using exact PACKAGES_BEFORE_PN with += as you suggested in V1 patch, but it broke the build, clearly PACKAGES_BEFORE_PN is not handled correctly in some recipes.

Those recipes are assigning to PACKAGES_BEFORE_PN, so this class should use PACKAGES_BEFORE_PN:prepend instead.

Ross
Ming Liu Nov. 11, 2025, 11:42 a.m. UTC | #4
Hi, Ross:

Yes, that should work, but I have to use prepend any way, I am wondering
"PACKAGES_BEFORE_PN:prepend " is better than "PACKAGES:prepend"?

//Ming Liu

Ross Burton <Ross.Burton@arm.com> 於 2025年11月11日 週二 上午11:50寫道:

> On 11 Nov 2025, at 08:17, Ming Liu <liu.ming50@gmail.com> wrote:
> >
> > I was using exact PACKAGES_BEFORE_PN with += as you suggested in V1
> patch, but it broke the build, clearly PACKAGES_BEFORE_PN is not handled
> correctly in some recipes.
>
> Those recipes are assigning to PACKAGES_BEFORE_PN, so this class should
> use PACKAGES_BEFORE_PN:prepend instead.
>
> Ross
>
>
Ross Burton Nov. 11, 2025, 11:46 a.m. UTC | #5
On 11 Nov 2025, at 11:42, Ming Liu <liu.ming50@gmail.com> wrote:
> 
> Hi, Ross:
> 
> Yes, that should work, but I have to use prepend any way, I am wondering "PACKAGES_BEFORE_PN:prepend " is better than "PACKAGES:prepend”?

Personally I think it’s better because we have a variable that is designed to be the packages that are collected before PN, so we should use it.

Ross
Peter Kjellerstedt Nov. 12, 2025, 10:13 a.m. UTC | #6
> -----Original Message-----
> From: openembedded-core@lists.openembedded.org <openembedded-
> core@lists.openembedded.org> On Behalf Of Ross Burton via
> lists.openembedded.org
> Sent: den 11 november 2025 12:46
> To: Ming Liu <liu.ming50@gmail.com>
> Cc: openembedded-core@lists.openembedded.org
> Subject: Re: [OE-core] [PATCH V2] bash-completion.bbclass: prepend bash-
> completion to PACKAGES
> 
> On 11 Nov 2025, at 11:42, Ming Liu <liu.ming50@gmail.com> wrote:
> >
> > Hi, Ross:
> >
> > Yes, that should work, but I have to use prepend any way, I am wondering "PACKAGES_BEFORE_PN:prepend " is better than "PACKAGES:prepend”?
> 
> Personally I think it’s better because we have a variable that is designed
> to be the packages that are collected before PN, so we should use it.
> 
> Ross

The reason I suggested to use PACKAGES:prepend rather than 
PACKAGE_BEFORE_PN:prepend is that we do not know what is in PACKAGES 
and in their FILES variables. However, we do know that the user wants 
to package the bash-completion package and thus expects it to claim 
its paths regardless of what else is in PACKAGES and FILES. I.e., to 
support someone doing something like:

inherit bash-completion

PACKAGES =+ "${PN}-foo"

FILES:${PN}-foo = "${sysconfdir}"

we need to prepend to PACKAGES rather than PACKAGE_BEFORE_PN.

//Peter
Richard Purdie Nov. 12, 2025, 4:21 p.m. UTC | #7
On Wed, 2025-11-12 at 10:13 +0000, Peter Kjellerstedt via
lists.openembedded.org wrote:
> > -----Original Message-----
> > From: openembedded-core@lists.openembedded.org <openembedded-
> > core@lists.openembedded.org> On Behalf Of Ross Burton via
> > lists.openembedded.org
> > Sent: den 11 november 2025 12:46
> > To: Ming Liu <liu.ming50@gmail.com>
> > Cc: openembedded-core@lists.openembedded.org
> > Subject: Re: [OE-core] [PATCH V2] bash-completion.bbclass: prepend
> > bash-
> > completion to PACKAGES
> > 
> > On 11 Nov 2025, at 11:42, Ming Liu <liu.ming50@gmail.com> wrote:
> > > 
> > > Hi, Ross:
> > > 
> > > Yes, that should work, but I have to use prepend any way, I am
> > > wondering "PACKAGES_BEFORE_PN:prepend " is better than
> > > "PACKAGES:prepend”?
> > 
> > Personally I think it’s better because we have a variable that is
> > designed
> > to be the packages that are collected before PN, so we should use
> > it.
> > 
> > Ross
> 
> The reason I suggested to use PACKAGES:prepend rather than 
> PACKAGE_BEFORE_PN:prepend is that we do not know what is in PACKAGES 
> and in their FILES variables. However, we do know that the user wants
> to package the bash-completion package and thus expects it to claim 
> its paths regardless of what else is in PACKAGES and FILES. I.e., to 
> support someone doing something like:
> 
> inherit bash-completion
> 
> PACKAGES =+ "${PN}-foo"
> 
> FILES:${PN}-foo = "${sysconfdir}"
> 
> we need to prepend to PACKAGES rather than PACKAGE_BEFORE_PN.

I'm going to weigh in here. I have a very strong preference not to use
prepend/append but just stick with += in the classes.

If that means we need to edit the recipes to have the inherit for bash-
completion in the right place, so be it.

Our recipes are already sensitive to inherit positioning and everything
switching to prepend just makes += ultimately useless and moves the
problem a level down the line.

So we should get ahead of this and just position the inherits
correctly.

Cheers,

Richard
diff mbox series

Patch

diff --git a/meta/classes-recipe/bash-completion.bbclass b/meta/classes-recipe/bash-completion.bbclass
index b656e76c09..e337c2045d 100644
--- a/meta/classes-recipe/bash-completion.bbclass
+++ b/meta/classes-recipe/bash-completion.bbclass
@@ -6,7 +6,7 @@ 
 
 DEPENDS:append:class-target = " bash-completion"
 
-PACKAGES += "${PN}-bash-completion"
+PACKAGES:prepend = "${PN}-bash-completion "
 
 FILES:${PN}-bash-completion = "${datadir}/bash-completion ${sysconfdir}/bash_completion.d"