diff options
author | Bruce Ashfield <bruce.ashfield@windriver.com> | 2010-09-25 01:39:02 -0400 |
---|---|---|
committer | Saul Wold <Saul.Wold@intel.com> | 2010-09-30 10:08:55 -0700 |
commit | 8d5b2224bd042940769ebffd521d68ec3eefbb55 (patch) | |
tree | 37b6a8eba47eea29c0d893aa817ad6916bcc05f9 /meta | |
parent | 06c19f0cd0c71bb721084294a2a3cb60d1855dfd (diff) | |
download | openembedded-core-8d5b2224bd042940769ebffd521d68ec3eefbb55.tar.gz openembedded-core-8d5b2224bd042940769ebffd521d68ec3eefbb55.tar.bz2 openembedded-core-8d5b2224bd042940769ebffd521d68ec3eefbb55.zip |
linux-wrs: validate commits when forcing branches
Fixes [BUGID #372]
If for some unknown reason, the kernel git repository hasn't been properly
updated and is *older* than the revisions listed in default-revisions the
branch sanity checking kicks in and tries to force branches to the right
revs. The problem is, the revisions it is looking for don't exist in the
tree. As a result, error messages are thrown about invalid commit IDs.
These aren't helpful, and are simply confusing for the user.
Instead we can test for the commit ID, and if it isn't valid, indicate
that the commit ID isn't valid and that the tree is potentially out
of sync.
This situation is not common, but it is an easy test and the extra
sanity checking is useful.
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/recipes-kernel/linux/linux-wrs_git.bb | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/meta/recipes-kernel/linux/linux-wrs_git.bb b/meta/recipes-kernel/linux/linux-wrs_git.bb index cf910e0a6b..0e27890a94 100644 --- a/meta/recipes-kernel/linux/linux-wrs_git.bb +++ b/meta/recipes-kernel/linux/linux-wrs_git.bb @@ -38,18 +38,21 @@ do_patch() { defconfig=${WORKDIR}/defconfig fi + # simply ensures that a branch of the right name has been created createme ${ARCH} ${WRMACHINE}-${LINUX_KERNEL_TYPE} ${defconfig} if [ $? -ne 0 ]; then echo "ERROR. Could not create ${WRMACHINE}-${LINUX_KERNEL_TYPE}" exit 1 fi + # updates or generates the target description updateme ${WORKDIR} if [ $? -ne 0 ]; then echo "ERROR. Could not update ${WRMACHINE}-${LINUX_KERNEL_TYPE}" exit 1 fi + # executes and modifies the source tree as required patchme ${WRMACHINE}-${LINUX_KERNEL_TYPE} if [ $? -ne 0 ]; then echo "ERROR. Could not modify ${WRMACHINE}-${LINUX_KERNEL_TYPE}" @@ -65,17 +68,31 @@ validate_branches() { if [ -n "$target_branch_head" ] && [ "$branch_head" != "$target_branch_head" ]; then if [ -n "${force_revisions}" ]; then - echo "Forcing branch ${WRMACHINE}-${LINUX_KERNEL_TYPE} to ${target_branch_head}" - git branch -m ${WRMACHINE}-${LINUX_KERNEL_TYPE} ${WRMACHINE}-${LINUX_KERNEL_TYPE}-orig - git checkout -b ${WRMACHINE}-${LINUX_KERNEL_TYPE} ${target_branch_head} + git show ${target_branch_head} > /dev/null 2>&1 + if [ $? -eq 0 ]; then + echo "Forcing branch ${WRMACHINE}-${LINUX_KERNEL_TYPE} to ${target_branch_head}" + git branch -m ${WRMACHINE}-${LINUX_KERNEL_TYPE} ${WRMACHINE}-${LINUX_KERNEL_TYPE}-orig + git checkout -b ${WRMACHINE}-${LINUX_KERNEL_TYPE} ${target_branch_head} + else + echo "ERROR ${target_branch_head} is not a valid commit ID." + echo "The kernel source tree may be out of sync" + exit 1 + fi fi fi if [ "$meta_head" != "$target_meta_head" ]; then if [ -n "${force_revisions}" ]; then - echo "Forcing branch wrs_meta to ${target_meta_head}" - git branch -m wrs_meta wrs_meta-orig - git checkout -b wrs_meta ${target_meta_head} + git show ${target_meta_head} > /dev/null 2>&1 + if [ $? -eq 0 ]; then + echo "Forcing branch wrs_meta to ${target_meta_head}" + git branch -m wrs_meta wrs_meta-orig + git checkout -b wrs_meta ${target_meta_head} + else + echo "ERROR ${target_meta_head} is not a valid commit ID" + echo "The kernel source tree may be out of sync" + exit 1 + fi fi fi } |