docs.lists.yoctoproject.org archive mirror
 help / color / mirror / Atom feed
* Re: [bitbake-devel] [PATCH v3] bitbake-user-manual: Document override :append, :prepend, :remove order
       [not found] <20220725155625.381756-1-marex@denx.de>
@ 2022-07-25 18:14 ` Enrico Scholz
  2022-07-25 22:04   ` [docs] " Richard Purdie
  0 siblings, 1 reply; 2+ messages in thread
From: Enrico Scholz @ 2022-07-25 18:14 UTC (permalink / raw)
  To: Marek Vasut; +Cc: bitbake-devel, docs

"Marek Vasut" <marex@denx.de> writes:

>  
> +.. note::
> +
> +   The overrides are applied in this order, ":append", ":prepend", ":remove".
> +   This implies it is not possible to re-append previously removed
>     strings.

fwiw, this is possible by anonymous python functions which are evaluated
after ":remove"

| FOO = "123 abc XYZ"
| 
| python () {
|     v = d.getVar('FOO')
|     d.setVar('FOO', v + ' abc 789')
| }
| 
| FOO:remove = "abc XYZ"

results in

| FOO="123   abc 789"



Enrico


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [docs] [bitbake-devel] [PATCH v3] bitbake-user-manual: Document override :append, :prepend, :remove order
  2022-07-25 18:14 ` [bitbake-devel] [PATCH v3] bitbake-user-manual: Document override :append, :prepend, :remove order Enrico Scholz
@ 2022-07-25 22:04   ` Richard Purdie
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Purdie @ 2022-07-25 22:04 UTC (permalink / raw)
  To: enrico.scholz, Marek Vasut; +Cc: bitbake-devel, docs

On Mon, 2022-07-25 at 20:14 +0200, Enrico Scholz via
lists.yoctoproject.org wrote:
> "Marek Vasut" <marex@denx.de> writes:
> 
> >  
> > +.. note::
> > +
> > +   The overrides are applied in this order, ":append", ":prepend", ":remove".
> > +   This implies it is not possible to re-append previously removed
> >     strings.
> 
> fwiw, this is possible by anonymous python functions which are evaluated
> after ":remove"
> 
> > FOO = "123 abc XYZ"
> > 
> > python () {
> >     v = d.getVar('FOO')
> >     d.setVar('FOO', v + ' abc 789')
> > }
> > 
> > FOO:remove = "abc XYZ"
> 
> results in
> 
> > FOO="123   abc 789"

The reason for this isn't perhaps obvious and worth documenting - use
of setVar clears all append/prepend/remove operations against a
variable.

FOO = "A"
FOO:append = " B"

python () {
    d.setVar('FOO', 'C')
}

results in C.

Cheers,

Richard


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-25 22:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20220725155625.381756-1-marex@denx.de>
2022-07-25 18:14 ` [bitbake-devel] [PATCH v3] bitbake-user-manual: Document override :append, :prepend, :remove order Enrico Scholz
2022-07-25 22:04   ` [docs] " Richard Purdie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).