summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@windriver.com>2013-01-28 13:07:06 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-03-01 13:03:27 +0000
commit61001aa702441c17cab444c281953b2945c34216 (patch)
tree9cb5f6688bd643eefe9685523ff48055219514b7 /meta/classes
parent2af25458fcabd62c96574c9ff2eed033cf09001e (diff)
downloadpoky-61001aa702441c17cab444c281953b2945c34216.tar.gz
kernel-yocto: respect SRC_URI modified branch selection
Although the setting of KBRANCH is the suggested/primary way to interact with the yocto kern-tools and the fetcher, some users may be more comfortable modifying the SRC_URI branch parameter directly. If they do, the tools will not force their branch and build output will be different then they expect, in non obvious ways. It's easy enough to detect this scenario, but checking the SRC_URI in the same way that the git fetcher checks for the branch (and SRCREV). If we take the value from the SRC_URI and use it directly in the patch/validate/update routines, we'll stay consistent with KBRANCH if it is used, and also automatically adapt to a manually changed branch parameter on the SRC_URI. For all other users, there are no visible or behavioural changes as a result of this change (From OE-Core rev: cfce8643ed166b51d7178be173677ea6f527d453) Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/kernel-yocto.bbclass70
1 files changed, 38 insertions, 32 deletions
diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass
index 8494c16787..368f91e43e 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -27,21 +27,6 @@ def find_sccs(d):
27 27
28 return sources_list 28 return sources_list
29 29
30# this is different from find_patches, in that it returns a colon separated
31# list of <patches>:<subdir> instead of just a list of patches
32def find_urls(d):
33 patches=src_patches(d)
34 fetch = bb.fetch2.Fetch([], d)
35 patch_list=[]
36 for p in patches:
37 _, _, local, _, _, _ = bb.decodeurl(p)
38 for url in fetch.urls:
39 urldata = fetch.ud[url]
40 if urldata.localpath == local:
41 patch_list.append(local+':'+urldata.path)
42
43 return patch_list
44
45# check the SRC_URI for "kmeta" type'd git repositories. Return the name of 30# check the SRC_URI for "kmeta" type'd git repositories. Return the name of
46# the repository as it will be found in WORKDIR 31# the repository as it will be found in WORKDIR
47def find_kernel_feature_dirs(d): 32def find_kernel_feature_dirs(d):
@@ -59,6 +44,18 @@ def find_kernel_feature_dirs(d):
59 44
60 return feature_dirs 45 return feature_dirs
61 46
47# find the master/machine source branch. In the same way that the fetcher proceses
48# git repositories in the SRC_URI we take the first repo found, first branch.
49def get_machine_branch(d):
50 fetch = bb.fetch2.Fetch([], d)
51 for url in fetch.urls:
52 urldata = fetch.ud[url]
53 parm = urldata.parm
54 if "branch" in parm:
55 branches = urldata.parm.get("branch").split(',')
56 return branches[0]
57
58 return "master"
62 59
63do_patch() { 60do_patch() {
64 cd ${S} 61 cd ${S}
@@ -73,7 +70,7 @@ do_patch() {
73 fi 70 fi
74 fi 71 fi
75 72
76 kbranch=${KBRANCH} 73 machine_branch="${@ get_machine_branch(d)}"
77 74
78 # if we have a defined/set meta branch we should not be generating 75 # if we have a defined/set meta branch we should not be generating
79 # any meta data. The passed branch has what we need. 76 # any meta data. The passed branch has what we need.
@@ -81,9 +78,9 @@ do_patch() {
81 createme_flags="--disable-meta-gen --meta ${KMETA}" 78 createme_flags="--disable-meta-gen --meta ${KMETA}"
82 fi 79 fi
83 80
84 createme ${createme_flags} ${ARCH} ${kbranch} 81 createme ${createme_flags} ${ARCH} ${machine_branch}
85 if [ $? -ne 0 ]; then 82 if [ $? -ne 0 ]; then
86 echo "ERROR. Could not create ${kbranch}" 83 echo "ERROR. Could not create ${machine_branch}"
87 exit 1 84 exit 1
88 fi 85 fi
89 86
@@ -113,15 +110,15 @@ do_patch() {
113 done 110 done
114 fi 111 fi
115 112
116 if [ "${kbranch}" != "${KBRANCH_DEFAULT}" ]; then 113 if [ "${machine_branch}" != "${KBRANCH_DEFAULT}" ]; then
117 updateme_flags="--branch ${kbranch}" 114 updateme_flags="--branch ${machine_branch}"
118 fi 115 fi
119 116
120 # updates or generates the target description 117 # updates or generates the target description
121 updateme ${updateme_flags} -DKDESC=${KMACHINE}:${LINUX_KERNEL_TYPE} \ 118 updateme ${updateme_flags} -DKDESC=${KMACHINE}:${LINUX_KERNEL_TYPE} \
122 ${includes} ${addon_features} ${ARCH} ${KMACHINE} ${sccs} ${patches} 119 ${includes} ${addon_features} ${ARCH} ${KMACHINE} ${sccs} ${patches}
123 if [ $? -ne 0 ]; then 120 if [ $? -ne 0 ]; then
124 echo "ERROR. Could not update ${kbranch}" 121 echo "ERROR. Could not update ${machine_branch}"
125 exit 1 122 exit 1
126 fi 123 fi
127 124
@@ -138,9 +135,9 @@ do_patch() {
138 # should thrown an error, since we aren't building what was expected 135 # should thrown an error, since we aren't building what was expected
139 final_branch="$(git symbolic-ref HEAD 2>/dev/null)" 136 final_branch="$(git symbolic-ref HEAD 2>/dev/null)"
140 final_branch=${final_branch##refs/heads/} 137 final_branch=${final_branch##refs/heads/}
141 if [ "${kbranch}" != "${KBRANCH_DEFAULT}" ] && 138 if [ "${machine_branch}" != "${KBRANCH_DEFAULT}" ] &&
142 [ "${final_branch}" != "${kbranch}" ]; then 139 [ "${final_branch}" != "${machine_branch}" ]; then
143 echo "ERROR: branch ${kbranch} was requested, but was not properly" 140 echo "ERROR: branch ${machine_branch} was requested, but was not properly"
144 echo " configured to be built. The current branch is ${final_branch}" 141 echo " configured to be built. The current branch is ${final_branch}"
145 exit 1 142 exit 1
146 fi 143 fi
@@ -192,6 +189,13 @@ do_kernel_checkout() {
192 exit 1 189 exit 1
193 fi 190 fi
194 fi 191 fi
192
193 machine_branch="${@ get_machine_branch(d)}"
194 if [ "${KBRANCH}" != "${machine_branch}" ]; then
195 echo "WARNING: The SRC_URI machine branch and KBRANCH are not the same."
196 echo " KBRANCH will be adjusted to match, but this typically is a"
197 echo " misconfiguration and should be checked."
198 fi
195 199
196 # convert any remote branches to local tracking ones 200 # convert any remote branches to local tracking ones
197 for i in `git branch -a | grep remotes | grep -v HEAD`; do 201 for i in `git branch -a | grep remotes | grep -v HEAD`; do
@@ -203,12 +207,12 @@ do_kernel_checkout() {
203 done 207 done
204 208
205 # Create a working tree copy of the kernel by checking out a branch 209 # Create a working tree copy of the kernel by checking out a branch
206 git show-ref --quiet --verify -- "refs/heads/${KBRANCH}" 210 git show-ref --quiet --verify -- "refs/heads/${machine_branch}"
207 if [ $? -eq 0 ]; then 211 if [ $? -eq 0 ]; then
208 # checkout and clobber any unimportant files 212 # checkout and clobber any unimportant files
209 git checkout -f ${KBRANCH} 213 git checkout -f ${machine_branch}
210 else 214 else
211 echo "Not checking out ${KBRANCH}, it will be created later" 215 echo "Not checking out ${machine_branch}, it will be created later"
212 git checkout -f master 216 git checkout -f master
213 fi 217 fi
214} 218}
@@ -271,6 +275,8 @@ do_validate_branches() {
271 cd ${S} 275 cd ${S}
272 export KMETA=${KMETA} 276 export KMETA=${KMETA}
273 277
278 machine_branch="${@ get_machine_branch(d)}"
279
274 set +e 280 set +e
275 # if SRCREV is AUTOREV it shows up as AUTOINC there's nothing to 281 # if SRCREV is AUTOREV it shows up as AUTOINC there's nothing to
276 # check and we can exit early 282 # check and we can exit early
@@ -280,11 +286,11 @@ do_validate_branches() {
280 286
281 # If something other than the default branch was requested, it must 287 # If something other than the default branch was requested, it must
282 # exist in the tree, and it's a hard error if it wasn't 288 # exist in the tree, and it's a hard error if it wasn't
283 git show-ref --quiet --verify -- "refs/heads/${KBRANCH}" 289 git show-ref --quiet --verify -- "refs/heads/${machine_branch}"
284 if [ $? -eq 1 ]; then 290 if [ $? -eq 1 ]; then
285 if [ -n "${KBRANCH_DEFAULT}" ] && 291 if [ -n "${KBRANCH_DEFAULT}" ] &&
286 [ "${KBRANCH}" != "${KBRANCH_DEFAULT}" ]; then 292 [ "${machine_branch}" != "${KBRANCH_DEFAULT}" ]; then
287 echo "ERROR: branch ${KBRANCH} was set for kernel compilation, " 293 echo "ERROR: branch ${machine_branch} was set for kernel compilation, "
288 echo " but it does not exist in the kernel repository." 294 echo " but it does not exist in the kernel repository."
289 echo " Check the value of KBRANCH and ensure that it describes" 295 echo " Check the value of KBRANCH and ensure that it describes"
290 echo " a valid banch in the source kernel repository" 296 echo " a valid banch in the source kernel repository"
@@ -362,10 +368,10 @@ do_validate_branches() {
362 fi 368 fi
363 fi 369 fi
364 370
365 git show-ref --quiet --verify -- "refs/heads/${KBRANCH}" 371 git show-ref --quiet --verify -- "refs/heads/${machine_branch}"
366 if [ $? -eq 0 ]; then 372 if [ $? -eq 0 ]; then
367 # restore the branch for builds 373 # restore the branch for builds
368 git checkout -q -f ${KBRANCH} 374 git checkout -q -f ${machine_branch}
369 else 375 else
370 git checkout -q master 376 git checkout -q master
371 fi 377 fi