diff options
author | Bruce Ashfield <bruce.ashfield@windriver.com> | 2014-03-18 21:34:40 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-09-01 14:35:40 +0100 |
commit | 4ee454d3569cb7a9556f41b770d9fbe8823d5a01 (patch) | |
tree | 9e83dd1b9f14d724678306f0003ee7abb4ba9b62 | |
parent | 3b3fe047a497baa51e7ef6ebe90d09644501bff8 (diff) | |
download | poky-4ee454d3569cb7a9556f41b770d9fbe8823d5a01.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.
(From OE-Core rev: e272cfbba87a98393d6c22bd96c7f1cb6902170a)
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/kernel-yocto.bbclass | 49 |
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() { | |||
311 | if [ "${machine_srcrev}" = "AUTOINC" ] || [ "${machine_srcrev}" = "INVALID" ] || | 311 | if [ "${machine_srcrev}" = "AUTOINC" ] || [ "${machine_srcrev}" = "INVALID" ] || |
312 | [ "${machine_srcrev}" = "" ]; then | 312 | [ "${machine_srcrev}" = "" ]; then |
313 | bbnote "INFO: SRCREV validation is not required for AUTOREV or empty/invalid settings, returning" | 313 | bbnote "INFO: SRCREV validation is not required for AUTOREV or empty/invalid settings, returning" |
314 | return | 314 | else |
315 | fi | 315 | git cat-file -t ${machine_srcrev} > /dev/null |
316 | 316 | if [ if $? -ne 0 ]; then | |
317 | 317 | echo "ERROR ${machine_srcrev} is not a valid commit ID." | |
318 | git cat-file -t ${machine_srcrev} > /dev/null | 318 | echo "The kernel source tree may be out of sync" |
319 | if [ if $? -ne 0 ]; then | 319 | exit 1 |
320 | echo "ERROR ${machine_srcrev} is not a valid commit ID." | 320 | fi |
321 | echo "The kernel source tree may be out of sync" | ||
322 | exit 1 | ||
323 | fi | 321 | fi |
324 | 322 | ||
325 | ## KMETA branch validation. | 323 | ## KMETA branch validation. |
326 | ## We do validation if the meta branch exists, and AUTOREV hasn't been set | 324 | ## We do validation if the meta branch exists, and AUTOREV hasn't been set |
327 | meta_head=`git show-ref -s --heads ${KMETA}` | 325 | target_meta_head="${SRCREV_meta}" |
328 | target_meta_head="${SRCREV_meta}" | 326 | if [ "${target_meta_head}" = "AUTOINC" ] || [ "${target_meta_head}" = "" ]; then |
329 | git show-ref --quiet --verify -- "refs/heads/${KMETA}" | 327 | bbnote "INFO: SRCREV validation skipped for AUTOREV or empty meta branch" |
330 | if [ $? -eq 0 ] && [ "${target_meta_head}" != "AUTOINC" ]; then | 328 | else |
329 | meta_head=`git show-ref -s --heads ${KMETA}` | ||
330 | |||
331 | git cat-file -t ${target_meta_head} > /dev/null | ||
332 | if [ $? -ne 0 ]; then | ||
333 | echo "ERROR ${target_meta_head} is not a valid commit ID" | ||
334 | echo "The kernel source tree may be out of sync" | ||
335 | exit 1 | ||
336 | fi | ||
331 | if [ "$meta_head" != "$target_meta_head" ]; then | 337 | if [ "$meta_head" != "$target_meta_head" ]; then |
332 | git cat-file -t ${target_meta_head} > /dev/null | 338 | echo "[INFO] Setting branch ${KMETA} to ${target_meta_head}" |
333 | if [ $? -ne 0 ]; then | 339 | git branch -m ${KMETA} ${KMETA}-orig |
334 | echo "ERROR ${target_meta_head} is not a valid commit ID" | 340 | git checkout -q -b ${KMETA} ${target_meta_head} |
335 | echo "The kernel source tree may be out of sync" | 341 | if [ $? -ne 0 ];then |
342 | echo "ERROR: could not checkout ${KMETA} branch from known hash ${target_meta_head}" | ||
336 | exit 1 | 343 | exit 1 |
337 | else | ||
338 | echo "[INFO] Setting branch ${KMETA} to ${target_meta_head}" | ||
339 | git branch -m ${KMETA} ${KMETA}-orig | ||
340 | git checkout -q -b ${KMETA} ${target_meta_head} | ||
341 | if [ $? -ne 0 ];then | ||
342 | echo "ERROR: could not checkout ${KMETA} branch from known hash ${target_meta_head}" | ||
343 | exit 1 | ||
344 | fi | ||
345 | fi | 344 | fi |
346 | fi | 345 | fi |
347 | fi | 346 | fi |