diff options
author | Bruce Ashfield <bruce.ashfield@windriver.com> | 2014-03-18 21:38:33 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-09-01 14:35:40 +0100 |
commit | 2aa75224b5a03cc115db37b46409b3faaa305423 (patch) | |
tree | 0d3c51cb8cc8fc291723e2b63f2a17da19afac5a /meta/classes | |
parent | 4ee454d3569cb7a9556f41b770d9fbe8823d5a01 (diff) | |
download | poky-2aa75224b5a03cc115db37b46409b3faaa305423.tar.gz |
kernel-yocto: use show-ref instead of branch -a
It's better to check a branches existence via show-ref versus the end
user branch commands. So we make the switch.
Also as part of this change, we move the conversion of remote branches
to local branches above the meta branch checking. This is required to
ensure that the branch is local for the show-ref check.
(From OE-Core rev: 04bd4cee625574cfa67679b6b2a150a21106c5bf)
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/kernel-yocto.bbclass | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass index 0ac1572471..9209f423cf 100644 --- a/meta/classes/kernel-yocto.bbclass +++ b/meta/classes/kernel-yocto.bbclass | |||
@@ -200,11 +200,20 @@ do_kernel_checkout() { | |||
200 | fi | 200 | fi |
201 | # end debare | 201 | # end debare |
202 | 202 | ||
203 | # convert any remote branches to local tracking ones | ||
204 | for i in `git branch -a --no-color | grep remotes | grep -v HEAD`; do | ||
205 | b=`echo $i | cut -d' ' -f2 | sed 's%remotes/origin/%%'`; | ||
206 | git show-ref --quiet --verify -- "refs/heads/$b" | ||
207 | if [ $? -ne 0 ]; then | ||
208 | git branch $b $i > /dev/null | ||
209 | fi | ||
210 | done | ||
211 | |||
203 | # If KMETA is defined, the branch must exist, but a machine branch | 212 | # If KMETA is defined, the branch must exist, but a machine branch |
204 | # can be missing since it may be created later by the tools. | 213 | # can be missing since it may be created later by the tools. |
205 | if [ -n "${KMETA}" ]; then | 214 | if [ -n "${KMETA}" ]; then |
206 | git branch -a --no-color | grep -q ${KMETA} | 215 | git show-ref --quiet --verify -- "refs/heads/${KMETA}" |
207 | if [ $? -ne 0 ]; then | 216 | if [ $? -eq 1 ]; then |
208 | echo "ERROR. The branch '${KMETA}' is required and was not" | 217 | echo "ERROR. The branch '${KMETA}' is required and was not" |
209 | echo "found. Ensure that the SRC_URI points to a valid linux-yocto" | 218 | echo "found. Ensure that the SRC_URI points to a valid linux-yocto" |
210 | echo "kernel repository" | 219 | echo "kernel repository" |
@@ -214,15 +223,6 @@ do_kernel_checkout() { | |||
214 | 223 | ||
215 | machine_branch="${@ get_machine_branch(d, "${KBRANCH}" )}" | 224 | machine_branch="${@ get_machine_branch(d, "${KBRANCH}" )}" |
216 | 225 | ||
217 | # convert any remote branches to local tracking ones | ||
218 | for i in `git branch -a --no-color | grep remotes | grep -v HEAD`; do | ||
219 | b=`echo $i | cut -d' ' -f2 | sed 's%remotes/origin/%%'`; | ||
220 | git show-ref --quiet --verify -- "refs/heads/$b" | ||
221 | if [ $? -ne 0 ]; then | ||
222 | git branch $b $i > /dev/null | ||
223 | fi | ||
224 | done | ||
225 | |||
226 | # Create a working tree copy of the kernel by checking out a branch | 226 | # Create a working tree copy of the kernel by checking out a branch |
227 | git show-ref --quiet --verify -- "refs/heads/${machine_branch}" | 227 | git show-ref --quiet --verify -- "refs/heads/${machine_branch}" |
228 | if [ $? -eq 0 ]; then | 228 | if [ $? -eq 0 ]; then |