summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Barker <paul@pbarker.dev>2021-08-02 11:44:30 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-08-04 10:38:26 +0100
commita185e98371bb63950f4549319b9a3cdf7272d0f7 (patch)
treeab2999a42f28355f9ba17a3ded535923b90f0e96
parent103b9f442bb2b9cd1994a75a5d9bfbbdd9b2f1f3 (diff)
downloadpoky-a185e98371bb63950f4549319b9a3cdf7272d0f7.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: af2a9c92d4498492ca23388c7b4bbed48abdc4d7) Signed-off-by: Paul Barker <paul@pbarker.dev> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-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 7deadcaedb..549dfd97a4 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -358,6 +358,21 @@ do_kernel_checkout() {
358 fi 358 fi
359 fi 359 fi
360 cd ${S} 360 cd ${S}
361
362 # convert any remote branches to local tracking ones
363 for i in `git branch -a --no-color | grep remotes | grep -v HEAD`; do
364 b=`echo $i | cut -d' ' -f2 | sed 's%remotes/origin/%%'`;
365 git show-ref --quiet --verify -- "refs/heads/$b"
366 if [ $? -ne 0 ]; then
367 git branch $b $i > /dev/null
368 fi
369 done
370
371 # Create a working tree copy of the kernel by checking out a branch
372 machine_branch="${@ get_machine_branch(d, "${KBRANCH}" )}"
373
374 # checkout and clobber any unimportant files
375 git checkout -f ${machine_branch}
361 else 376 else
362 # case: we have no git repository at all. 377 # case: we have no git repository at all.
363 # To support low bandwidth options for building the kernel, we'll just 378 # To support low bandwidth options for building the kernel, we'll just
@@ -379,21 +394,6 @@ do_kernel_checkout() {
379 git commit -q -m "baseline commit: creating repo for ${PN}-${PV}" 394 git commit -q -m "baseline commit: creating repo for ${PN}-${PV}"
380 git clean -d -f 395 git clean -d -f
381 fi 396 fi
382
383 # convert any remote branches to local tracking ones
384 for i in `git branch -a --no-color | grep remotes | grep -v HEAD`; do
385 b=`echo $i | cut -d' ' -f2 | sed 's%remotes/origin/%%'`;
386 git show-ref --quiet --verify -- "refs/heads/$b"
387 if [ $? -ne 0 ]; then
388 git branch $b $i > /dev/null
389 fi
390 done
391
392 # Create a working tree copy of the kernel by checking out a branch
393 machine_branch="${@ get_machine_branch(d, "${KBRANCH}" )}"
394
395 # checkout and clobber any unimportant files
396 git checkout -f ${machine_branch}
397} 397}
398do_kernel_checkout[dirs] = "${S} ${WORKDIR}" 398do_kernel_checkout[dirs] = "${S} ${WORKDIR}"
399 399