summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYu Ke <ke.yu@intel.com>2011-01-04 15:55:33 +0800
committerSaul Wold <sgw@linux.intel.com>2011-01-04 09:46:37 -0800
commit30d27115ec38b8191d81504858d105b0d91277d8 (patch)
treebb27f8b59ba45a137f3012f2c1ac2db759705196
parentca148f4627ed7e1b4858a9d0950b5e720df17e09 (diff)
downloadpoky-30d27115ec38b8191d81504858d105b0d91277d8.tar.gz
base.bbclass: add lock file for do_unpack task
This patch intend to fix the random unpack failure of linux-libc-headers-yocto and linux-yocto. The root cause of the unpack failure is that: these two recpies has the same URL, thus has the same dest file during the fetch and unpack phase: do_fetch : create tar ball ${DL_DIR}/git_git.pokylinux.org.linux-yocto-2.6.37.tar.gz do_unpack : extract tar ball ${DL_DIR}/git_git.pokylinux.org.linux-yocto-2.6.37.tar.gz fetch phase is protected by lockfile, so it works fine. but unpack phase is not lock protected, thus there is race condition like: when linux-yocto do_unpack is extracting the tar ball, linux-libc-headers-yocto do_fetch starts to create tar ball thus overwrite linux-yocto's tar ball and cause linux-yocto do_unpack failure To fix this issue, do_unpack also need to be protected by lock Signed-off-by: Yu Ke <ke.yu@intel.com>
-rw-r--r--meta/classes/base.bbclass4
1 files changed, 4 insertions, 0 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 54a1dcd013..f8ce1232cd 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -242,6 +242,8 @@ python base_do_unpack() {
242 localdata = bb.data.createCopy(d) 242 localdata = bb.data.createCopy(d)
243 bb.data.update_data(localdata) 243 bb.data.update_data(localdata)
244 244
245 urldata = bb.fetch.init([], localdata, True)
246
245 src_uri = bb.data.getVar('SRC_URI', localdata, True) 247 src_uri = bb.data.getVar('SRC_URI', localdata, True)
246 if not src_uri: 248 if not src_uri:
247 return 249 return
@@ -253,7 +255,9 @@ python base_do_unpack() {
253 if local is None: 255 if local is None:
254 continue 256 continue
255 local = os.path.realpath(local) 257 local = os.path.realpath(local)
258 lf = bb.utils.lockfile(urldata[url].lockfile)
256 ret = oe_unpack_file(local, localdata, url) 259 ret = oe_unpack_file(local, localdata, url)
260 bb.utils.unlockfile(lf)
257 if not ret: 261 if not ret:
258 raise bb.build.FuncFailed("oe_unpack_file failed with return value %s" % ret) 262 raise bb.build.FuncFailed("oe_unpack_file failed with return value %s" % ret)
259} 263}