[oe-commits] Bruce Ashfield : linux-yocto: check for bad SRCREV before branch checks

git at git.openembedded.org git at git.openembedded.org
Tue Sep 4 13:52:00 UTC 2012


Module: openembedded-core.git
Branch: master
Commit: 7e4518bf88af53b09536a3bafcd4c392a094023f
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=7e4518bf88af53b09536a3bafcd4c392a094023f

Author: Bruce Ashfield <bruce.ashfield at windriver.com>
Date:   Tue Sep  4 08:40:34 2012 -0400

linux-yocto: check for bad SRCREV before branch checks

do_validate_branches ensures that the desired SRCREV is at
the tip of every branch that contains the revision. To do this,
it looks for containing branches and processes them.

This processing was mistakenly placed before the check for an
invalid SRCREV, hence a git error message is seen in the log
if a bad SRCREV is used, rather than a clear message.

reordering the checks, and fixing a check for master, ensures
that clear messages are generated in all cases.

Signed-off-by: Bruce Ashfield <bruce.ashfield at windriver.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 meta/classes/kernel-yocto.bbclass |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass
index 45918d6..724e5cd 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -258,12 +258,6 @@ do_validate_branches() {
 		return
 	fi
 
-	containing_branches=`git branch --contains $target_branch_head | sed 's/^..//'`
-	if [ -z "$containing_branches" ]; then
-		echo "ERROR: SRCREV was set to \"$target_branch_head\", but no branches"
-		echo "       contain this commit"
-		exit 1
-	fi
 	ref=`git show ${target_branch_head} 2>&1 | head -n1 || true`
 	if [ "$ref" = "fatal: bad object ${target_meta_head}" ]; then
 	    echo "ERROR ${target_branch_head} is not a valid commit ID."
@@ -271,6 +265,13 @@ do_validate_branches() {
 	    exit 1
 	fi
 
+	containing_branches=`git branch --contains $target_branch_head | sed 's/^..//'`
+	if [ -z "$containing_branches" ]; then
+		echo "ERROR: SRCREV was set to \"$target_branch_head\", but no branches"
+		echo "       contain this commit"
+		exit 1
+	fi
+
 	# force the SRCREV in each branch that contains the specified
 	# SRCREV (if it isn't the current HEAD of that branch)
 	git checkout -q master
@@ -278,7 +279,7 @@ do_validate_branches() {
 		branch_head=`git show-ref -s --heads ${b}`		
 		if [ "$branch_head" != "$target_branch_head" ]; then
 			echo "[INFO] Setting branch $b to ${target_branch_head}"
-			if [ "$b" == "master" ]; then
+			if [ "$b" = "master" ]; then
 				git reset --hard $target_branch_head > /dev/null
 			else
 				git branch -D $b > /dev/null





More information about the Openembedded-commits mailing list