Skip to contentSkip to conversation

How to turn a poky patch into a bitbake one?

DISCUSSION Michael Opdenacker 5 participants 7 messages Mar 18, 2024 – Mar 19, 2024

lore
Share & tools
lore
#0 lore raw

Greetings,

For testing convenience, I made BitBake changes directly in the Poky tree.

Before I re-apply my changes to a BitBake tree before submitting them, in a very manual way (like removing "bitbake/"  in the paths in my generated patches), would you have a nicer way to turn my changes under Poky's "bitbake/" subdirectory into a proper pathset for BitBake?

Git tips appreciated. I guess I'm not the first one to do this :-} Cheers
Michael.

Signature · 3 lines
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#1 lore raw

If the patches modify existing files and don't introduce new files, then 'git am -3' will apply them without issues even if they were sent from the poky tree, which I have relied on to sent the patches numerous times over the years, and just did the same a couple minutes ago. Admittedly this is not exactly robust, and maintainers can come back complaining.

Alex

Quoted 28 lines · Michael Opdenacker via lists.openembedded.org

Greetings,

For testing convenience, I made BitBake changes directly in the Poky tree.

Before I re-apply my changes to a BitBake tree before submitting them, in a very manual way (like removing "bitbake/" in the paths in my generated patches), would you have a nicer way to turn my changes under Poky's "bitbake/" subdirectory into a proper pathset for BitBake?

Git tips appreciated. I guess I'm not the first one to do this :-} Cheers
Michael.

--
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#16001): https://lists.openembedded.org/g/bitbake-devel/message/16001
Mute This Topic: https://lists.openembedded.org/mt/105004317/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw
In reply to Michael Opdenacker
Quoted 11 lines · Michael Opdenacker via lists.openembedded.org

Greetings,

For testing convenience, I made BitBake changes directly in the Poky tree.

Before I re-apply my changes to a BitBake tree before submitting them, in a very manual way (like removing "bitbake/" in the paths in my generated patches), would you have a nicer way to turn my changes under Poky's "bitbake/" subdirectory into a proper pathset for BitBake?

Git tips appreciated. I guess I'm not the first one to do this :-}

FWIW, I do:
* patch/test/commit in poky
* git format-patch
* patchtest
* and then, I have repos for contribution (splitted poky : oe-core, meta-yocto, yocto-docs, bitbake, ...). Those repos are set up with git-configs to set the correct recipient and [tag][PATCH] when git-send-email.
To import in the bitbake repo, I'd use "git am -p2 <patch from poky.git>"

I've tried to use combo-layer for this but never found the right process.

Quoted 20 lines

Cheers
Michael.

--
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#16001):
https://lists.openembedded.org/g/bitbake-devel/message/16001
Mute This Topic: https://lists.openembedded.org/mt/105004317/4316185
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 2 lines
Yoann Congal
Smile ECS - Tech expert
#3 lore raw
Quoted 28 lines · Yoann Congal
Quoted 11 lines · Michael Opdenacker via lists.openembedded.org

Greetings,

For testing convenience, I made BitBake changes directly in the Poky tree.

Before I re-apply my changes to a BitBake tree before submitting them, in a very manual way (like removing "bitbake/" in the paths in my generated patches), would you have a nicer way to turn my changes under Poky's "bitbake/" subdirectory into a proper pathset for BitBake?

Git tips appreciated. I guess I'm not the first one to do this :-}

FWIW, I do:
* patch/test/commit in poky
* git format-patch
* patchtest
* and then, I have repos for contribution (splitted poky : oe-core, meta-yocto, yocto-docs, bitbake, ...). Those repos are set up with git-configs to set the correct recipient and [tag][PATCH] when git-send-email.
To import in the bitbake repo, I'd use "git am -p2 <patch from poky.git>"

Quoted 2 lines

I've tried to use combo-layer for this but never found the right process.

I have used some of the hints in:
https://stackoverflow.com/questions/16526321/how-to-apply-a-git-patch-to-a-file-with-a-different-name-and-path

Although it's been a couple months since I was doing bitbake work so my brain forgot the commands (and history didn't find them either).

Quoted 30 lines
Quoted 14 lines

Cheers
Michael.

--
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

--
Yoann Congal
Smile ECS - Tech expert

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#16004):
https://lists.openembedded.org/g/bitbake-devel/message/16004
Mute This Topic: https://lists.openembedded.org/mt/105004317/924729
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#4 lore raw
In reply to Michael Opdenacker

Okay, I found the correct thing to do:

git format-patch --relative=bitbake
git send-email --relative=bitbake

This will strip the bitbake prefix from the chunks that have it, and omit the chunks that don't have the prefix altogether.

Would be nice to set up the poky repo to do this by default but I'm not sure how.

Alex

Quoted 28 lines · Michael Opdenacker via lists.openembedded.org

Greetings,

For testing convenience, I made BitBake changes directly in the Poky tree.

Before I re-apply my changes to a BitBake tree before submitting them, in a very manual way (like removing "bitbake/" in the paths in my generated patches), would you have a nicer way to turn my changes under Poky's "bitbake/" subdirectory into a proper pathset for BitBake?

Git tips appreciated. I guess I'm not the first one to do this :-} Cheers
Michael.

--
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#16001): https://lists.openembedded.org/g/bitbake-devel/message/16001
Mute This Topic: https://lists.openembedded.org/mt/105004317/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#5 lore raw

Alex, all,

Many thanks for sharing your tips!

Quoted 7 lines · Alexander Kanavin

Okay, I found the correct thing to do:

git format-patch --relative=bitbake
git send-email --relative=bitbake

This will strip the bitbake prefix from the chunks that have it, and omit the chunks that don't have the prefix altogether.

Brilliant! That's even better than I expected. Nice to know that commits (or even chunks if you're right?) not impacting the specified subdirectory are ignored. Thanks again
Cheers
Michael.

Signature · 3 lines
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#6 lore raw
In reply to Michael Opdenacker

Hi Michael,

Quoted 10 lines · Michael Opdenacker via lists.openembedded.org

Greetings,

For testing convenience, I made BitBake changes directly in the Poky tree.

Before I re-apply my changes to a BitBake tree before submitting them, in a very manual way (like removing "bitbake/"  in the paths in my generated patches), would you have a nicer way to turn my changes under Poky's "bitbake/" subdirectory into a proper pathset for BitBake?

Git tips appreciated. I guess I'm not the first one to do this :-}

there is the option "--relative" to 'git format-patch' (see [1]) that you could use to have the "bitbake/" prefix removed automatically:

  $ git -C <PATH_TO_POKY_WC> format-patch --relative=bitbake -k --stdout <REVISION_RANGE> |
        git -C <PATH_TO_BITBAKE_WC> am -k -p 1

If you ever need to do it the other way round then just use the option "--directory" (see [2]) which 'git am' inherits from 'git apply' that automatically prefixes what you need

  $ git -C <PATH_TO_BITBAKE_WC> format-patch -k --stdout <REVISION_RANGE> |
        git -C <PATH_TO_POKY_WC> am -k --directory=bitbake

Best regards
Ulrich

[1] https://git-scm.com/docs/git-format-patch#Documentation/git-format-patch.txt---relativeltpathgt
[2] https://git-scm.com/docs/git-apply#Documentation/git-apply.txt---directoryltrootgt

Quoted 2 lines

Cheers
Michael.

Signature · 4 lines
Pengutronix e.K.                           | Ulrich Ölmann               |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |