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 /meta/classes | |
parent | 4e96983a3a49e26a1b33ad2a548e2d10bd8fa7df (diff) | |
download | openembedded-core-contrib-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>
Diffstat (limited to 'meta/classes')
-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 38c886b21b0..4938712c7cf 100644 --- a/meta/classes/kernel-yocto.bbclass +++ b/meta/classes/kernel-yocto.bbclass @@ -71,6 +71,7 @@ do_patch() { fi machine_branch="${@ get_machine_branch(d, "${KBRANCH}" )}" + machine_srcrev="${SRCREV_machine}" # if we have a defined/set meta branch we should not be generating # any meta data. The passed branch has what we need. @@ -122,6 +123,17 @@ do_patch() { exit 1 fi + # see if the branch we are about to patch has been properly reset to the defined + # SRCREV .. if not, we reset it. + branch_head=`git rev-parse HEAD` + if [ "${machine_srcrev}" != "AUTOINC" ]; then + if [ "${machine_srcrev}" != "${branch_head}" ]; then + current_branch=`git rev-parse --abbrev-ref HEAD` + git branch "$current_branch-orig" + git reset --hard ${machine_srcrev} + fi + fi + # executes and modifies the source tree as required patchme ${KMACHINE} if [ $? -ne 0 ]; then @@ -130,6 +142,17 @@ do_patch() { exit 1 fi + # check to see if the specified SRCREV is reachable from the final branch. + # if it wasn't something wrong has happened, and we should error. + if [ "${machine_srcrev}" != "AUTOINC" ]; then + git merge-base --is-ancestor ${machine_srcrev} HEAD + if [ $? -ne 0 ]; then + bbnote "ERROR: SRCREV ${machine_srcrev} was specified, but is not reachable" + bbnote " Check the BSP description for incorrect branch selection, or other errors." + exit 1 + fi + fi + # Perform a final check. If something other than the default kernel # branch was requested, and that's not where we ended up, then we # should thrown an error, since we aren't building what was expected @@ -335,22 +358,6 @@ do_validate_branches() { exit 1 fi - # force the SRCREV in each branch that contains the specified - # SRCREV (if it isn't the current HEAD of that branch) - git checkout -q master - for b in $containing_branches; do - branch_head=`git show-ref -s --heads ${b}` - if [ "$branch_head" != "$machine_srcrev" ]; then - echo "[INFO] Setting branch $b to ${machine_srcrev}" - if [ "$b" = "master" ]; then - git reset --hard $machine_srcrev > /dev/null - else - git branch -D $b > /dev/null - git branch $b $machine_srcrev > /dev/null - fi - fi - done - ## KMETA branch validation. ## We do validation if the meta branch exists, and AUTOREV hasn't been set meta_head=`git show-ref -s --heads ${KMETA}` |