Re: [OE-core] [PATCH] kernel-yocto: Add KERNEL_SKIP_BRANCH_CONVERSION var to skip branch conversion from remote to local
From: Bruce Ashfield <hidden>
Date: 2021-10-26 13:08:10
It's typically a good idea to cc' me on kernel-yocto commits, but I did happen to notice this one, so all is well. On Tue, Oct 26, 2021 at 3:34 AM Tomasz Dziendzielski < tomasz.dziendzielski@gmail.com> wrote:
Introduced poky upstream commit: 14df6d53b6 linux-yocto: improve checkout error handling and reporting converts all remote branches to local branches. Our Linux repo has ~4500 remote branches: git branch -a | grep remotes |wc -l -> 4575
One would argue that having that many remote branches isn't a great idea .. but I'll stay out of that. A wise person doesn't mess with someone else's repository structure and workflow :)
This costs our best workstations ~20 minutes to simply do that conversion in do_kernel_checkout which is not needed (at least I do not see any benefit after testing with this patch). Since this conversion is required for some linux-yocto workflows we introduce variable that allows skipping this on demand.
Right, it definitely is required for quite a few.
quoted hunk ↗ jump to hunk
Signed-off-by: Tomasz Dziendzielski <redacted> Signed-off-by: Jan Brzezanski <redacted> Signed-off-by: Ricardo Rodrigues <redacted> Signed-off-by: Szymon Czarnuch <redacted> Signed-off-by: Kamil Kwiek <redacted> --- meta/classes/kernel-yocto.bbclass | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)diff --git a/meta/classes/kernel-yocto.bbclassb/meta/classes/kernel-yocto.bbclass index 1d5a8cdf29..68fb1af821 100644--- a/meta/classes/kernel-yocto.bbclass +++ b/meta/classes/kernel-yocto.bbclass@@ -363,13 +363,15 @@ do_kernel_checkout() { cd ${S} # convert any remote branches to local tracking ones - for i in `git branch -a --no-color | grep remotes | grep -v HEAD`; do - b=`echo $i | cut -d' ' -f2 | sed's%remotes/origin/%%'`; - git show-ref --quiet --verify -- "refs/heads/$b" - if [ $? -ne 0 ]; then - git branch $b $i > /dev/null - fi - done + if [ "${KERNEL_SKIP_BRANCH_CONVERSION}" != "1" ]; then
A new variable like this would need to be documented, so an accompanying
patch to documentation would be required.
As for the variable, something like KERNEL_YOCTO_REMOTES_TO_LOCAL would be
better, and set the default to non-zero (i.e. "t" )
so it could be: if [ -n "${KERNEL_YOCTO_REMOTES_TO_LOCAL}" ]; then
...
+ for i in `git branch -a --no-color | grep remotes | grep -v HEAD`; do + b=`echo $i | cut -d' ' -f2 | sed 's%remotes/origin/%%'`; + git show-ref --quiet --verify -- "refs/heads/$b" + if [ $? -ne 0 ]; then + git branch $b $i > /dev/null + fi + done + fi
Not all git versions automatically track a remote -> local, which is why that code was initially required. To be safe this needs to at least convert KBRANCH to a local, since it will be checked out by the code that follows. There are other parts of the patching/merging/meta processes that need local branches, but since this wouldn't be on by default, we don't have to worry about converting the other possible branches to local. Bruce
# Create a working tree copy of the kernel by checking out
a branch
machine_branch="${@ get_machine_branch(d, "${KBRANCH}" )}"
--
2.33.0
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#157376):
https://lists.openembedded.org/g/openembedded-core/message/157376
Mute This Topic: https://lists.openembedded.org/mt/86597675/1050810
Group Owner: openembedded-core+owner@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
bruce.ashfield@gmail.com]
-=-=-=-=-=-=-=-=-=-=-=-
-- - Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end - "Use the force Harry" - Gandalf, Star Trek II