summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@windriver.com>2010-09-08 23:18:59 -0400
committerRichard Purdie <rpurdie@linux.intel.com>2010-09-09 15:18:30 +0100
commit8fe347a851b6c22cd84532622effc3fa237efe89 (patch)
treea068e716821a166c5ff860deaab138169ac7baaa /meta/recipes-kernel
parentbe74657ced5d9f31ac503b2bb846d3386fd5cb4f (diff)
downloadpoky-8fe347a851b6c22cd84532622effc3fa237efe89.tar.gz
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.bb35
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"
29S = "${WORKDIR}/linux" 29S = "${WORKDIR}/linux"
30B = "${WORKDIR}/linux-${WRMACHINE}-${LINUX_KERNEL_TYPE}-build" 30B = "${WORKDIR}/linux-${WRMACHINE}-${LINUX_KERNEL_TYPE}-build"
31 31
32# functionality flags
33force_revisions = "t"
34
32do_patch() { 35do_patch() {
33 cd ${S} 36 cd ${S}
34 if [ -f ${WORKDIR}/defconfig ]; then 37 if [ -f ${WORKDIR}/defconfig ]; then
@@ -54,6 +57,29 @@ do_patch() {
54 fi 57 fi
55} 58}
56 59
60validate_branches() {
61 branch_head=`git show-ref -s --heads ${WRMACHINE}-${LINUX_KERNEL_TYPE}`
62 meta_head=`git show-ref -s --heads wrs_meta`
63 target_branch_head="${SRCREV_pn-linux-wrs_machine}"
64 target_meta_head="${SRCREV_pn-linux-wrs_meta}"
65
66 if [ -n "$target_branch_head" ] && [ "$branch_head" != "$target_branch_head" ]; then
67 if [ -n "${force_revisions}" ]; then
68 echo "Forcing branch ${WRMACHINE}-${LINUX_KERNEL_TYPE} to ${target_branch_head}"
69 git branch -m ${WRMACHINE}-${LINUX_KERNEL_TYPE} ${WRMACHINE}-${LINUX_KERNEL_TYPE}-orig
70 git checkout -b ${WRMACHINE}-${LINUX_KERNEL_TYPE} ${target_branch_head}
71 fi
72 fi
73
74 if [ "$meta_head" != "$target_meta_head" ]; then
75 if [ -n "${force_revisions}" ]; then
76 echo "Forcing branch wrs_meta to ${target_meta_head}"
77 git branch -m wrs_meta wrs_meta-orig
78 git checkout -b wrs_meta ${target_meta_head}
79 fi
80 fi
81}
82
57do_wrlinux_checkout() { 83do_wrlinux_checkout() {
58 if [ -d ${WORKDIR}/.git/refs/remotes/origin ]; then 84 if [ -d ${WORKDIR}/.git/refs/remotes/origin ]; then
59 echo "Fixing up git directory for ${WRMACHINE}-${LINUX_KERNEL_TYPE}" 85 echo "Fixing up git directory for ${WRMACHINE}-${LINUX_KERNEL_TYPE}"
@@ -79,6 +105,15 @@ IFS='
79 fi 105 fi
80 fi 106 fi
81 cd ${S} 107 cd ${S}
108
109 # checkout and clobber and unimportant files
110 git checkout -f ${WRMACHINE}-${LINUX_KERNEL_TYPE}
111
112 validate_branches
113
114 # this second checkout is intentional, we want to leave ourselves
115 # on the branch to be built, but validate_branches could have changed
116 # our initial checkout. So we do it a second time to be sure
82 git checkout -f ${WRMACHINE}-${LINUX_KERNEL_TYPE} 117 git checkout -f ${WRMACHINE}-${LINUX_KERNEL_TYPE}
83} 118}
84do_wrlinux_checkout[dirs] = "${S}" 119do_wrlinux_checkout[dirs] = "${S}"