summaryrefslogtreecommitdiffstats
path: root/meta/classes
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-18 18:00:19 +0100
commit922fe187e1914410faa4d78482b05c6ed7870b1a (patch)
treef54e8e42335c96418240f45aeaf8c693306b777a /meta/classes
parent6f4b2ce8a4d5ff374d5d839edb1d3c4afd426f37 (diff)
downloadpoky-922fe187e1914410faa4d78482b05c6ed7870b1a.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: 3a16f312e5942e8a3d6f77a550c5374da81eed37) 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: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-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 66cce92362..a1a073b738 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -320,6 +320,21 @@ do_kernel_checkout() {
320 fi 320 fi
321 fi 321 fi
322 cd ${S} 322 cd ${S}
323
324 # convert any remote branches to local tracking ones
325 for i in `git branch -a --no-color | grep remotes | grep -v HEAD`; do
326 b=`echo $i | cut -d' ' -f2 | sed 's%remotes/origin/%%'`;
327 git show-ref --quiet --verify -- "refs/heads/$b"
328 if [ $? -ne 0 ]; then
329 git branch $b $i > /dev/null
330 fi
331 done
332
333 # Create a working tree copy of the kernel by checking out a branch
334 machine_branch="${@ get_machine_branch(d, "${KBRANCH}" )}"
335
336 # checkout and clobber any unimportant files
337 git checkout -f ${machine_branch}
323 else 338 else
324 # case: we have no git repository at all. 339 # case: we have no git repository at all.
325 # To support low bandwidth options for building the kernel, we'll just 340 # To support low bandwidth options for building the kernel, we'll just
@@ -341,21 +356,6 @@ do_kernel_checkout() {
341 git commit -q -m "baseline commit: creating repo for ${PN}-${PV}" 356 git commit -q -m "baseline commit: creating repo for ${PN}-${PV}"
342 git clean -d -f 357 git clean -d -f
343 fi 358 fi
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}
359} 359}
360do_kernel_checkout[dirs] = "${S}" 360do_kernel_checkout[dirs] = "${S}"
361 361