summaryrefslogtreecommitdiff
path: root/meta
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@windriver.com>2012-02-28 16:09:58 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-03-02 14:01:05 +0000
commitf937977f241e786c5a7438449ed4c9da4c55829b (patch)
tree9ec2981d562b9dfcb5eb5d19a5cb64d3a277ea51 /meta
parent7147a569758414467c9d022e4c11fbc303e050aa (diff)
downloadopenembedded-core-f937977f241e786c5a7438449ed4c9da4c55829b.tar.gz
openembedded-core-f937977f241e786c5a7438449ed4c9da4c55829b.tar.bz2
openembedded-core-f937977f241e786c5a7438449ed4c9da4c55829b.zip
linux-yocto: make kernel_checkout reentrant
The steps in do_kernel_checkout modify the source tree in WORKDIR. If it is called multiple times, or interrupted, the tree is left in an inconsistent state. This change adds protections around branch names, and around the manipulations of directories to ensure that it is safe to call at any point. Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/kernel-yocto.bbclass33
1 files changed, 20 insertions, 13 deletions
diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass
index 5f3cb63fb4..187e3cc07c 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -139,17 +139,17 @@ do_patch() {
}
do_kernel_checkout() {
- # we build out of {S}, so ensure that ${S} is clean and present
- rm -rf ${S}
- mkdir -p ${S}/.git
-
set +e
# A linux yocto SRC_URI should use the bareclone option. That
# ensures that all the branches are available in the WORKDIR version
# of the repository. If it wasn't passed, we should detect it, and put
# out a useful error message
- if [ -d "${WORKDIR}/git/.git" ]; then
+ if [ -d "${WORKDIR}/git/" ] && [ -d "${WORKDIR}/git/.git" ]; then
+ # we build out of {S}, so ensure that ${S} is clean and present
+ rm -rf ${S}
+ mkdir -p ${S}/.git
+
echo "WARNING. ${WORKDIR}/git is not a bare clone."
echo "Ensure that the SRC_URI includes the 'bareclone=1' option."
@@ -158,12 +158,14 @@ do_kernel_checkout() {
mv ${WORKDIR}/git/.git ${S}
rm -rf ${WORKDIR}/git/
cd ${S}
- git branch -a | grep -q ${KMETA}
- if [ $? -ne 0 ]; then
- echo "ERROR. The branch '${KMETA}' is required and was not"
- echo "found. Ensure that the SRC_URI points to a valid linux-yocto"
- echo "kernel repository"
- exit 1
+ if [ -n "${YOCTO_KERNEL_META_DATA}" ] && [ -n "${KMETA}" ]; then
+ git branch -a | grep -q ${KMETA}
+ if [ $? -ne 0 ]; then
+ echo "ERROR. The branch '${KMETA}' is required and was not"
+ echo "found. Ensure that the SRC_URI points to a valid linux-yocto"
+ echo "kernel repository"
+ exit 1
+ fi
fi
if [ -z "${YOCTO_KERNEL_EXTERNAL_BRANCH}" ] && [ -n "${KBRANCH}" ] ; then
git branch -a | grep -q ${KBRANCH}
@@ -174,10 +176,15 @@ do_kernel_checkout() {
exit 1
fi
fi
- else
+ fi
+ if [ -d "${WORKDIR}/git/" ] && [ ! -d "${WORKDIR}/git/.git" ]; then
+ # we build out of {S}, so ensure that ${S} is clean and present
+ rm -rf ${S}
+ mkdir -p ${S}/.git
+
mv ${WORKDIR}/git/* ${S}/.git
rm -rf ${WORKDIR}/git/
- cd ${S}
+ cd ${S}
git config core.bare false
fi
# end debare