All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bruce Ashfield <bruce.ashfield@windriver.com>
To: <richard.purdie@linuxfoundation.org>
Cc: openembedded-core@lists.openembedded.org
Subject: [PATCH 08/18] kernel-yocto: use show-ref instead of branch -a
Date: Sat, 30 Aug 2014 00:38:11 -0400	[thread overview]
Message-ID: <a5f1e8e402e65fbceb8b3085d9c73b8bd28f7bb0.1409345003.git.bruce.ashfield@windriver.com> (raw)
In-Reply-To: <cover.1409345003.git.bruce.ashfield@windriver.com>

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.

Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
---
 meta/classes/kernel-yocto.bbclass | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass
index 0ac1572471bc..9209f423cff1 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -200,11 +200,20 @@ do_kernel_checkout() {
 	fi
 	# end debare
 
+	# 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 KMETA is defined, the branch must exist, but a machine branch
 	# can be missing since it may be created later by the tools.
 	if [ -n "${KMETA}" ]; then
-		git branch -a --no-color | grep -q ${KMETA}
-		if [ $? -ne 0 ]; then
+		git show-ref --quiet --verify -- "refs/heads/${KMETA}"
+		if [ $? -eq 1 ]; then
 			echo "ERROR. The branch '${KMETA}' is required and was not"
 			echo "found. Ensure that the SRC_URI points to a valid linux-yocto"
 			echo "kernel repository"
@@ -214,15 +223,6 @@ do_kernel_checkout() {
 	
 	machine_branch="${@ get_machine_branch(d, "${KBRANCH}" )}"
 
-	# 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
-
 	# Create a working tree copy of the kernel by checking out a branch
 	git show-ref --quiet --verify -- "refs/heads/${machine_branch}"
 	if [ $? -eq 0 ]; then
-- 
1.8.1.2



  parent reply	other threads:[~2014-08-30  4:38 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-30  4:38 [PATCH 00/18] kernel-yocto: consolidated pull request Bruce Ashfield
2014-08-30  4:38 ` [PATCH 01/18] kernel-yocto: use cat-file instead of git-show Bruce Ashfield
2014-08-30  4:38 ` [PATCH 02/18] kernel-yocto: move SRCREV validation to patching phase Bruce Ashfield
2014-08-30 13:55   ` Richard Purdie
2014-08-31  0:52     ` Bruce Ashfield
2014-08-31  5:25     ` Bruce Ashfield
2014-08-30  4:38 ` [PATCH 03/18] kernel-yocto: remove containing branch check Bruce Ashfield
2014-08-30  4:38 ` [PATCH 04/18] kernel-yocto: remove SRC_URI kbranch validation Bruce Ashfield
2014-08-30  4:38 ` [PATCH 05/18] kernel-yocto: remove branch existence checking in do_validate_branches Bruce Ashfield
2014-08-30  4:38 ` [PATCH 06/18] kernel-yocto: remove KBRANCH_DEFAULT Bruce Ashfield
2014-08-30  4:38 ` [PATCH 07/18] kernel-yocto: simplify branch SRCREV validation Bruce Ashfield
2014-08-30  4:38 ` Bruce Ashfield [this message]
2014-08-30  4:38 ` [PATCH 09/18] kernel-yocto: clean overly complex branch checkout Bruce Ashfield
2014-08-30  4:38 ` [PATCH 10/18] kernel-yocto: allow custom non-meta, SRCREV format builds Bruce Ashfield
2014-08-30  4:38 ` [PATCH 11/18] kernel-yocto: remove KBRANCH_DEFAULT Bruce Ashfield
2014-08-30  4:38 ` [PATCH 12/18] kernel-yocto: convert echo statements to bb* equivalents Bruce Ashfield
2014-08-30  4:38 ` [PATCH 13/18] kern-tools: allow meta branch and meta data directory to differ Bruce Ashfield
2014-08-30  4:38 ` [PATCH 14/18] images: introduce core-image-kernel-dev Bruce Ashfield
2014-08-30  4:38 ` [PATCH 15/18] linux-yocto/3.14: vhost, vxland, openvswitch and block/bfq updates Bruce Ashfield
2014-08-30  4:38 ` [PATCH 16/18] linux-yocto/3.14: update to v3.14.17 Bruce Ashfield
2014-08-30  4:38 ` [PATCH 17/18] linux-yocto/3.4: remove 3.4 name recipes Bruce Ashfield
2014-08-30  4:38 ` [PATCH 18/18] linux-libc-headers: update to 3.16 Bruce Ashfield
2014-08-31 10:07 ` [PATCH 00/18] kernel-yocto: consolidated pull request Richard Purdie
2014-08-31 13:57   ` Bruce Ashfield
2014-09-01  1:53   ` Bruce Ashfield
2014-09-01  2:39   ` Bruce Ashfield
2014-09-01 16:12     ` Richard Purdie
2014-09-02 12:11       ` Bruce Ashfield
2014-08-31 23:41 ` Otavio Salvador
2014-09-01  1:18   ` Bruce Ashfield

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a5f1e8e402e65fbceb8b3085d9c73b8bd28f7bb0.1409345003.git.bruce.ashfield@windriver.com \
    --to=bruce.ashfield@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=richard.purdie@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.