summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorPaul Barker <paul@pbarker.dev>2021-08-02 11:44:30 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-09-09 10:19:42 +0100
commit6e2b2ab438e08a080d85a2ef24e5ea1f16390204 (patch)
treeccdb668a59e867f11ec04e91476a38249ce5ee41 /meta
parentf4526a6e7dbb9ec16ccd579d9746842e14634849 (diff)
downloadpoky-6e2b2ab438e08a080d85a2ef24e5ea1f16390204.tar.gz
kernel-yocto: Simplify no git repo case in do_kernel_checkout
If the kernel sources are not fetched via git, a local git repository is created in do_kernel_checkout. In this case we know that there will be no remote branches and we will already be on the correct branch (since only one branch will exist). So we can simplify things by skipping these steps. This also removes the assumption that the default git branch name will be "master". Prior to this change, the final git checkout command in do_kernel_checkout could fail if a local git repo was created and the user had changed init.defaultBranch in their gitconfig. (From OE-Core rev: 0c8d643d7b474a845588ad7dbf86f85a9aad5c49) Signed-off-by: Paul Barker <paul@pbarker.dev> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit af2a9c92d4498492ca23388c7b4bbed48abdc4d7) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/kernel-yocto.bbclass30
1 files changed, 15 insertions, 15 deletions
diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass
index d38b60f519..8878573f6f 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -341,6 +341,21 @@ do_kernel_checkout() {
341 fi 341 fi
342 fi 342 fi
343 cd ${S} 343 cd ${S}
344
345 # convert any remote branches to local tracking ones
346 for i in `git branch -a --no-color | grep remotes | grep -v HEAD`; do
347 b=`echo $i | cut -d' ' -f2 | sed 's%remotes/origin/%%'`;
348 git show-ref --quiet --verify -- "refs/heads/$b"
349 if [ $? -ne 0 ]; then
350 git branch $b $i > /dev/null
351 fi
352 done
353
354 # Create a working tree copy of the kernel by checking out a branch
355 machine_branch="${@ get_machine_branch(d, "${KBRANCH}" )}"
356
357 # checkout and clobber any unimportant files
358 git checkout -f ${machine_branch}
344 else 359 else
345 # case: we have no git repository at all. 360 # case: we have no git repository at all.
346 # To support low bandwidth options for building the kernel, we'll just 361 # To support low bandwidth options for building the kernel, we'll just
@@ -362,21 +377,6 @@ do_kernel_checkout() {
362 git commit -q -m "baseline commit: creating repo for ${PN}-${PV}" 377 git commit -q -m "baseline commit: creating repo for ${PN}-${PV}"
363 git clean -d -f 378 git clean -d -f
364 fi 379 fi
365
366 # convert any remote branches to local tracking ones
367 for i in `git branch -a --no-color | grep remotes | grep -v HEAD`; do
368 b=`echo $i | cut -d' ' -f2 | sed 's%remotes/origin/%%'`;
369 git show-ref --quiet --verify -- "refs/heads/$b"
370 if [ $? -ne 0 ]; then
371 git branch $b $i > /dev/null
372 fi
373 done
374
375 # Create a working tree copy of the kernel by checking out a branch
376 machine_branch="${@ get_machine_branch(d, "${KBRANCH}" )}"
377
378 # checkout and clobber any unimportant files
379 git checkout -f ${machine_branch}
380} 380}
381do_kernel_checkout[dirs] = "${S} ${WORKDIR}" 381do_kernel_checkout[dirs] = "${S} ${WORKDIR}"
382 382