diff options
author | Bruce Ashfield <bruce.ashfield@windriver.com> | 2010-09-08 23:18:59 -0400 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-09-09 15:18:30 +0100 |
commit | 8fe347a851b6c22cd84532622effc3fa237efe89 (patch) | |
tree | a068e716821a166c5ff860deaab138169ac7baaa /meta/recipes-kernel | |
parent | be74657ced5d9f31ac503b2bb846d3386fd5cb4f (diff) | |
download | openembedded-core-8fe347a851b6c22cd84532622effc3fa237efe89.tar.gz openembedded-core-8fe347a851b6c22cd84532622effc3fa237efe89.tar.bz2 openembedded-core-8fe347a851b6c22cd84532622effc3fa237efe89.zip |
linux-wrs: validate branches against known revisions
It is possible for the git repository to have commits on branches
that are ahead of the SRCREVs for those branches. Since the
kern tools will simply checkout and build, we can end up building
a different kernel than what is expected.
It is up to the recipe to ensure that the branches are at the
correct commits. To do this, we simply check the current machine
branch against the SRCREV and if they don't match we move the
existing branch and do a checkout at the desired commit.
Note: This probably needs to be disabled with AUTOREV.
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'meta/recipes-kernel')
-rw-r--r-- | meta/recipes-kernel/linux/linux-wrs_git.bb | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/meta/recipes-kernel/linux/linux-wrs_git.bb b/meta/recipes-kernel/linux/linux-wrs_git.bb index 2978ed95cb..696b7d407a 100644 --- a/meta/recipes-kernel/linux/linux-wrs_git.bb +++ b/meta/recipes-kernel/linux/linux-wrs_git.bb @@ -29,6 +29,9 @@ PR = "r6" S = "${WORKDIR}/linux" B = "${WORKDIR}/linux-${WRMACHINE}-${LINUX_KERNEL_TYPE}-build" +# functionality flags +force_revisions = "t" + do_patch() { cd ${S} if [ -f ${WORKDIR}/defconfig ]; then @@ -54,6 +57,29 @@ do_patch() { fi } +validate_branches() { + branch_head=`git show-ref -s --heads ${WRMACHINE}-${LINUX_KERNEL_TYPE}` + meta_head=`git show-ref -s --heads wrs_meta` + target_branch_head="${SRCREV_pn-linux-wrs_machine}" + target_meta_head="${SRCREV_pn-linux-wrs_meta}" + + 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} + 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} + fi + fi +} + do_wrlinux_checkout() { if [ -d ${WORKDIR}/.git/refs/remotes/origin ]; then echo "Fixing up git directory for ${WRMACHINE}-${LINUX_KERNEL_TYPE}" @@ -79,6 +105,15 @@ IFS=' fi fi cd ${S} + + # checkout and clobber and unimportant files + git checkout -f ${WRMACHINE}-${LINUX_KERNEL_TYPE} + + validate_branches + + # this second checkout is intentional, we want to leave ourselves + # on the branch to be built, but validate_branches could have changed + # our initial checkout. So we do it a second time to be sure git checkout -f ${WRMACHINE}-${LINUX_KERNEL_TYPE} } do_wrlinux_checkout[dirs] = "${S}" |