diff options
author | Bruce Ashfield <bruce.ashfield@windriver.com> | 2014-03-17 22:28:03 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-09-01 14:35:39 +0100 |
commit | 7097cdf14a1ca06a5e1de8c97db9638b70bc56fd (patch) | |
tree | 5b048725b37f25376df88df9acda89c5ae9edb3e | |
parent | 4e96983a3a49e26a1b33ad2a548e2d10bd8fa7df (diff) | |
download | poky-7097cdf14a1ca06a5e1de8c97db9638b70bc56fd.tar.gz |
kernel-yocto: move SRCREV validation to patching phase
Rather than attempting to condition the entire tree to machine SRCREV (since
we don't know what branch will be built), we can instead wait until patching
has completed and then confirm that we are indeed building a decendant of the
specified SRCREV. The result is a much simpler check, and no mangling of the
tree.
(From OE-Core rev: 97075af9e9a691276cd417f1181ca73223f52d1c)
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/kernel-yocto.bbclass | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass index 38c886b21b..4938712c7c 100644 --- a/meta/classes/kernel-yocto.bbclass +++ b/meta/classes/kernel-yocto.bbclass | |||
@@ -71,6 +71,7 @@ do_patch() { | |||
71 | fi | 71 | fi |
72 | 72 | ||
73 | machine_branch="${@ get_machine_branch(d, "${KBRANCH}" )}" | 73 | machine_branch="${@ get_machine_branch(d, "${KBRANCH}" )}" |
74 | machine_srcrev="${SRCREV_machine}" | ||
74 | 75 | ||
75 | # if we have a defined/set meta branch we should not be generating | 76 | # if we have a defined/set meta branch we should not be generating |
76 | # any meta data. The passed branch has what we need. | 77 | # any meta data. The passed branch has what we need. |
@@ -122,6 +123,17 @@ do_patch() { | |||
122 | exit 1 | 123 | exit 1 |
123 | fi | 124 | fi |
124 | 125 | ||
126 | # see if the branch we are about to patch has been properly reset to the defined | ||
127 | # SRCREV .. if not, we reset it. | ||
128 | branch_head=`git rev-parse HEAD` | ||
129 | if [ "${machine_srcrev}" != "AUTOINC" ]; then | ||
130 | if [ "${machine_srcrev}" != "${branch_head}" ]; then | ||
131 | current_branch=`git rev-parse --abbrev-ref HEAD` | ||
132 | git branch "$current_branch-orig" | ||
133 | git reset --hard ${machine_srcrev} | ||
134 | fi | ||
135 | fi | ||
136 | |||
125 | # executes and modifies the source tree as required | 137 | # executes and modifies the source tree as required |
126 | patchme ${KMACHINE} | 138 | patchme ${KMACHINE} |
127 | if [ $? -ne 0 ]; then | 139 | if [ $? -ne 0 ]; then |
@@ -130,6 +142,17 @@ do_patch() { | |||
130 | exit 1 | 142 | exit 1 |
131 | fi | 143 | fi |
132 | 144 | ||
145 | # check to see if the specified SRCREV is reachable from the final branch. | ||
146 | # if it wasn't something wrong has happened, and we should error. | ||
147 | if [ "${machine_srcrev}" != "AUTOINC" ]; then | ||
148 | git merge-base --is-ancestor ${machine_srcrev} HEAD | ||
149 | if [ $? -ne 0 ]; then | ||
150 | bbnote "ERROR: SRCREV ${machine_srcrev} was specified, but is not reachable" | ||
151 | bbnote " Check the BSP description for incorrect branch selection, or other errors." | ||
152 | exit 1 | ||
153 | fi | ||
154 | fi | ||
155 | |||
133 | # Perform a final check. If something other than the default kernel | 156 | # Perform a final check. If something other than the default kernel |
134 | # branch was requested, and that's not where we ended up, then we | 157 | # branch was requested, and that's not where we ended up, then we |
135 | # should thrown an error, since we aren't building what was expected | 158 | # should thrown an error, since we aren't building what was expected |
@@ -335,22 +358,6 @@ do_validate_branches() { | |||
335 | exit 1 | 358 | exit 1 |
336 | fi | 359 | fi |
337 | 360 | ||
338 | # force the SRCREV in each branch that contains the specified | ||
339 | # SRCREV (if it isn't the current HEAD of that branch) | ||
340 | git checkout -q master | ||
341 | for b in $containing_branches; do | ||
342 | branch_head=`git show-ref -s --heads ${b}` | ||
343 | if [ "$branch_head" != "$machine_srcrev" ]; then | ||
344 | echo "[INFO] Setting branch $b to ${machine_srcrev}" | ||
345 | if [ "$b" = "master" ]; then | ||
346 | git reset --hard $machine_srcrev > /dev/null | ||
347 | else | ||
348 | git branch -D $b > /dev/null | ||
349 | git branch $b $machine_srcrev > /dev/null | ||
350 | fi | ||
351 | fi | ||
352 | done | ||
353 | |||
354 | ## KMETA branch validation. | 361 | ## KMETA branch validation. |
355 | ## We do validation if the meta branch exists, and AUTOREV hasn't been set | 362 | ## We do validation if the meta branch exists, and AUTOREV hasn't been set |
356 | meta_head=`git show-ref -s --heads ${KMETA}` | 363 | meta_head=`git show-ref -s --heads ${KMETA}` |