Openembedded Bitbake Development
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: JPEWhacker@gmail.com, bitbake-devel@lists.openembedded.org
Subject: Re: [bitbake-devel][PATCH] bb: Add prefuncs and postfuncs ordering
Date: Sun, 28 Jun 2026 08:29:43 +0100	[thread overview]
Message-ID: <982a310197bcfc6725c8a5d6d8fdf41217cf239b.camel@linuxfoundation.org> (raw)
In-Reply-To: <20260626170044.3829734-1-JPEWhacker@gmail.com>

On Fri, 2026-06-26 at 11:00 -0600, Joshua Watt via lists.openembedded.org wrote:
> Adds the ability for functions specified in prefuncs and postfuncs to
> specify the order in which they must execute. This allows specific
> functions to indicate that they must run first or last (or second,
> second to last, etc.) without needing all places in the code that
> manipulate the function list to have to agree on how to order them
> (a good example of this is sstate.bbclass and buildhistory.bbclass).
> 
> Ordering is done similar to how python list indices work; 0 is always
> sorted first, 1 is second, -2 is second to last, -1 is last, etc. In the
> event of functions having duplicate values, they are grouped together,
> but keep their same relative ordering. If one or more functions do not
> have an order assigned, they executed between the positive order
> functions and the negative order functions, and keep their same relative
> order (this means that existing behavior is preserved in the absence of
> any ordering information).
> 
> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>

I've wondered about something like this for a long time, the trouble is
it does not scale well and I've always concluded it wouldn't really
help overall and solve the real problem.

It solves an immediate issue of making one thing run first, or last. If
a second comes along, it can just about handle that. The trouble is
when you have three or more and they all want to be "last", or "first",
you can't define that in the metadata. This just gets worse when you
think of independent layers trying to pick numeric values. This is
already a pain with layer priorities and I wish we'd never used
numbers.

You can already get some idea of ordering just by the += and =+
operations ordering the data, or reordering the variable contents using
anon python.

You could even define a filter function for the variable which could
reorder things with a custom order function.

So I'm probably against adding this level of complexity when we already
have enough of it and it doesn't fully solve the issue anyway.

If we did something, I'd probably look in the direction of "after" and
"before" operations like tasks, trying to avoid some of the issues we
have there.

Cheers,

Richard



  reply	other threads:[~2026-06-28  7:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-26 17:00 [bitbake-devel][PATCH] bb: Add prefuncs and postfuncs ordering Joshua Watt
2026-06-28  7:29 ` Richard Purdie [this message]
     [not found] ` <18BD2E2AC79FBB10.1079487@lists.openembedded.org>
2026-06-28 10:11   ` Richard Purdie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=982a310197bcfc6725c8a5d6d8fdf41217cf239b.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=JPEWhacker@gmail.com \
    --cc=bitbake-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox