mirror of
https://git.yoctoproject.org/poky
synced 2026-01-29 21:08:42 +01:00
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>
This commit is contained in:
committed by
Saul Wold
parent
06c19f0cd0
commit
8d5b2224bd
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user