aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@windriver.com>2014-03-18 21:34:40 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-09-01 14:34:27 +0100
commite272cfbba87a98393d6c22bd96c7f1cb6902170a (patch)
tree19cde56c3a8db04b66e47f0eb44ec7c8ec6d2bbc
parentfbacbb0ca79cdae33803fdd3158671488b9bbcbe (diff)
downloadopenembedded-core-contrib-e272cfbba87a98393d6c22bd96c7f1cb6902170a.tar.gz
kernel-yocto: simplify branch SRCREV validation
The checking of machine and meta branch SRCREVs was inconsistent and didn't allow a mixed AUTOREV machine/meta branch combination. By simplifying the checks and changing the logic, we can now allow this combination. Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
-rw-r--r--meta/classes/kernel-yocto.bbclass49
1 files changed, 24 insertions, 25 deletions
diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass
index 087fbb0c37..0ac1572471 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -311,37 +311,36 @@ do_validate_branches() {
if [ "${machine_srcrev}" = "AUTOINC" ] || [ "${machine_srcrev}" = "INVALID" ] ||
[ "${machine_srcrev}" = "" ]; then
bbnote "INFO: SRCREV validation is not required for AUTOREV or empty/invalid settings, returning"
- return
- fi
-
-
- git cat-file -t ${machine_srcrev} > /dev/null
- if [ if $? -ne 0 ]; then
- echo "ERROR ${machine_srcrev} is not a valid commit ID."
- echo "The kernel source tree may be out of sync"
- exit 1
+ else
+ git cat-file -t ${machine_srcrev} > /dev/null
+ if [ if $? -ne 0 ]; then
+ echo "ERROR ${machine_srcrev} is not a valid commit ID."
+ echo "The kernel source tree may be out of sync"
+ exit 1
+ fi
fi
## KMETA branch validation.
## We do validation if the meta branch exists, and AUTOREV hasn't been set
- meta_head=`git show-ref -s --heads ${KMETA}`
- target_meta_head="${SRCREV_meta}"
- git show-ref --quiet --verify -- "refs/heads/${KMETA}"
- if [ $? -eq 0 ] && [ "${target_meta_head}" != "AUTOINC" ]; then
+ target_meta_head="${SRCREV_meta}"
+ if [ "${target_meta_head}" = "AUTOINC" ] || [ "${target_meta_head}" = "" ]; then
+ bbnote "INFO: SRCREV validation skipped for AUTOREV or empty meta branch"
+ else
+ meta_head=`git show-ref -s --heads ${KMETA}`
+
+ git cat-file -t ${target_meta_head} > /dev/null
+ if [ $? -ne 0 ]; then
+ echo "ERROR ${target_meta_head} is not a valid commit ID"
+ echo "The kernel source tree may be out of sync"
+ exit 1
+ fi
if [ "$meta_head" != "$target_meta_head" ]; then
- git cat-file -t ${target_meta_head} > /dev/null
- if [ $? -ne 0 ]; then
- echo "ERROR ${target_meta_head} is not a valid commit ID"
- echo "The kernel source tree may be out of sync"
+ echo "[INFO] Setting branch ${KMETA} to ${target_meta_head}"
+ git branch -m ${KMETA} ${KMETA}-orig
+ git checkout -q -b ${KMETA} ${target_meta_head}
+ if [ $? -ne 0 ];then
+ echo "ERROR: could not checkout ${KMETA} branch from known hash ${target_meta_head}"
exit 1
- else
- echo "[INFO] Setting branch ${KMETA} to ${target_meta_head}"
- git branch -m ${KMETA} ${KMETA}-orig
- git checkout -q -b ${KMETA} ${target_meta_head}
- if [ $? -ne 0 ];then
- echo "ERROR: could not checkout ${KMETA} branch from known hash ${target_meta_head}"
- exit 1
- fi
fi
fi
fi