summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@windriver.com>2011-01-17 16:34:58 -0500
committerSaul Wold <sgw@linux.intel.com>2011-01-19 11:36:27 -0800
commit8f23c1413ad12e60e98f9887cafa4315db7b62a2 (patch)
tree943a3430ff1e582ceeca836dd798b884447f685f /meta/classes
parent432e7619a7bd0c6a2075a618e5b17100fe459085 (diff)
downloadast2050-yocto-poky-8f23c1413ad12e60e98f9887cafa4315db7b62a2.zip
ast2050-yocto-poky-8f23c1413ad12e60e98f9887cafa4315db7b62a2.tar.gz
linux-yocto: update validate_branches to detected invalid commit IDs
The previous implementation of invalid commit ID checks would error early when a bad object was detected. Rather than changing to set +e for the entire routine, we'll capture the output and do an explicit check for a bad object and throw a useful error message when it is detected. Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/kernel-yocto.bbclass26
1 files changed, 13 insertions, 13 deletions
diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass
index 88dcf32..32d2e20 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -161,30 +161,30 @@ do_validate_branches() {
current=`git branch |grep \*|sed 's/^\* //'`
if [ -n "$target_branch_head" ] && [ "$branch_head" != "$target_branch_head" ]; then
if [ -n "${KERNEL_REVISION_CHECKING}" ]; then
- git show ${target_branch_head} > /dev/null 2>&1
- if [ $? -eq 0 ]; then
- echo "Forcing branch $current to ${target_branch_head}"
- git branch -m $current $current-orig
- git checkout -b $current ${target_branch_head}
- else
+ ref=`git show ${target_meta_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."
echo "The kernel source tree may be out of sync"
exit 1
- fi
+ else
+ echo "Forcing branch $current to ${target_branch_head}"
+ git branch -m $current $current-orig
+ git checkout -b $current ${target_branch_head}
+ fi
fi
fi
if [ "$meta_head" != "$target_meta_head" ]; then
if [ -n "${KERNEL_REVISION_CHECKING}" ]; then
- git show ${target_meta_head} > /dev/null 2>&1
- if [ $? -eq 0 ]; then
- echo "Forcing branch meta to ${target_meta_head}"
- git branch -m ${KMETA} ${KMETA}-orig
- git checkout -b ${KMETA} ${target_meta_head}
- else
+ ref=`git show ${target_meta_head} 2>&1 | head -n1 || true`
+ if [ "$ref" = "fatal: bad object ${target_meta_head}" ]; then
echo "ERROR ${target_meta_head} is not a valid commit ID"
echo "The kernel source tree may be out of sync"
exit 1
+ else
+ echo "Forcing branch meta to ${target_meta_head}"
+ git branch -m ${KMETA} ${KMETA}-orig
+ git checkout -b ${KMETA} ${target_meta_head}
fi
fi
fi
OpenPOWER on IntegriCloud