summaryrefslogtreecommitdiffstats
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 15:22:53 +0000
commit54d1f5fc3ed614115385b540b03698dea3544df2 (patch)
tree3ac558c7df1d1395df440f2c9890dc0fb7c72bb1 /meta
parent60eed3195cadf001ef683e96a5e65be5c1a2dde5 (diff)
downloadpoky-54d1f5fc3ed614115385b540b03698dea3544df2.tar.gz
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. (From OE-Core rev: f937977f241e786c5a7438449ed4c9da4c55829b) 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() {
139} 139}
140 140
141do_kernel_checkout() { 141do_kernel_checkout() {
142 # we build out of {S}, so ensure that ${S} is clean and present
143 rm -rf ${S}
144 mkdir -p ${S}/.git
145
146 set +e 142 set +e
147 143
148 # A linux yocto SRC_URI should use the bareclone option. That 144 # A linux yocto SRC_URI should use the bareclone option. That
149 # ensures that all the branches are available in the WORKDIR version 145 # ensures that all the branches are available in the WORKDIR version
150 # of the repository. If it wasn't passed, we should detect it, and put 146 # of the repository. If it wasn't passed, we should detect it, and put
151 # out a useful error message 147 # out a useful error message
152 if [ -d "${WORKDIR}/git/.git" ]; then 148 if [ -d "${WORKDIR}/git/" ] && [ -d "${WORKDIR}/git/.git" ]; then
149 # we build out of {S}, so ensure that ${S} is clean and present
150 rm -rf ${S}
151 mkdir -p ${S}/.git
152
153 echo "WARNING. ${WORKDIR}/git is not a bare clone." 153 echo "WARNING. ${WORKDIR}/git is not a bare clone."
154 echo "Ensure that the SRC_URI includes the 'bareclone=1' option." 154 echo "Ensure that the SRC_URI includes the 'bareclone=1' option."
155 155
@@ -158,12 +158,14 @@ do_kernel_checkout() {
158 mv ${WORKDIR}/git/.git ${S} 158 mv ${WORKDIR}/git/.git ${S}
159 rm -rf ${WORKDIR}/git/ 159 rm -rf ${WORKDIR}/git/
160 cd ${S} 160 cd ${S}
161 git branch -a | grep -q ${KMETA} 161 if [ -n "${YOCTO_KERNEL_META_DATA}" ] && [ -n "${KMETA}" ]; then
162 if [ $? -ne 0 ]; then 162 git branch -a | grep -q ${KMETA}
163 echo "ERROR. The branch '${KMETA}' is required and was not" 163 if [ $? -ne 0 ]; then
164 echo "found. Ensure that the SRC_URI points to a valid linux-yocto" 164 echo "ERROR. The branch '${KMETA}' is required and was not"
165 echo "kernel repository" 165 echo "found. Ensure that the SRC_URI points to a valid linux-yocto"
166 exit 1 166 echo "kernel repository"
167 exit 1
168 fi
167 fi 169 fi
168 if [ -z "${YOCTO_KERNEL_EXTERNAL_BRANCH}" ] && [ -n "${KBRANCH}" ] ; then 170 if [ -z "${YOCTO_KERNEL_EXTERNAL_BRANCH}" ] && [ -n "${KBRANCH}" ] ; then
169 git branch -a | grep -q ${KBRANCH} 171 git branch -a | grep -q ${KBRANCH}
@@ -174,10 +176,15 @@ do_kernel_checkout() {
174 exit 1 176 exit 1
175 fi 177 fi
176 fi 178 fi
177 else 179 fi
180 if [ -d "${WORKDIR}/git/" ] && [ ! -d "${WORKDIR}/git/.git" ]; then
181 # we build out of {S}, so ensure that ${S} is clean and present
182 rm -rf ${S}
183 mkdir -p ${S}/.git
184
178 mv ${WORKDIR}/git/* ${S}/.git 185 mv ${WORKDIR}/git/* ${S}/.git
179 rm -rf ${WORKDIR}/git/ 186 rm -rf ${WORKDIR}/git/
180 cd ${S} 187 cd ${S}
181 git config core.bare false 188 git config core.bare false
182 fi 189 fi
183 # end debare 190 # end debare