Hi Peter,

On Fri, 2026-02-06 at 02:13 +0100, Peter Kjellerstedt via 
lists.openembedded.org wrote:
> Make sure that new patches that are added as a result of using devtool
> finish are added to the SRC_URI in the same order they were committed.
> 
> Previously, the order was a result of the arbitrary order the patch
> files were returned by os.walk(), which typically resulted in them being
> added to the SRC_URI in the reverse order they were committed.
> 
> Signed-off-by: Peter Kjellerstedt <[email protected]>
> ---
>  meta/lib/oeqa/selftest/cases/devtool.py | 30 +++++++++++++++++++------
>  scripts/lib/devtool/standard.py         |  6 ++++-
>  2 files changed, 28 insertions(+), 8 deletions(-)
> 
> 
> 
[....]

> diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
> index 1fd5947c41..7afb4654cc 100644
> --- a/scripts/lib/devtool/standard.py
> +++ b/scripts/lib/devtool/standard.py
> @@ -1322,7 +1322,11 @@ def _export_patches(srctree, rd, start_revs, destdir, 
> changed_revs=None):
>      patch_pathspec = _git_exclude_path(srctree, 'oe-local-files')
>      GitApplyTree.extractPatches(srctree, start_revs, destdir, patch_pathspec)
>      for dirpath, dirnames, filenames in os.walk(destdir):
> -        new_patches = filenames
> +        # Sort the filenames to avoid the arbitrary order resulting from 
> using
> +        # os.walk(). This matters for added patches, and the assumption is 
> that
> +        # they are prefixed by a four digit number resulting from the order 
> in
> +        # which they were committed.
> +        new_patches = sorted(filenames)
>          reldirpath = os.path.relpath(dirpath, destdir)
>          for new_patch in new_patches:
>              # Strip numbering from patch names. If it's a git sequence named 
> patch,

This looks like a good find and something we should fix.

I did wonder if we always number the patches? I ask as the code in
extractPatches() calls:

"git", "format-patch", "--no-signature", "--no-numbered"

which hints that it might not?

Could we pass the patch list from that function in the correct order
rather than relying on a directory listing?

Cheers,

Richard
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#231035): 
https://lists.openembedded.org/g/openembedded-core/message/231035
Mute This Topic: https://lists.openembedded.org/mt/117664834/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to