Hey folks,

I would like to introduce locking in do_package_tar. I had a case here were do_package_tar and do_package_ipk where running parallel. Because of this "tar: .: file changed as we read it" occurs. I fixed it by introduce locking in do_package_tar. What do you think about it?



--
------- ROAD ...the handyPC Company - - -  ) ) )

Jens Erdmann
Software Development

ROAD GmbH
Bennigsenstr. 14 | 12159 Berlin | Germany
fon: +49 (30) 230069 - 64 | fax: +49 (30) 230069 - 69
url: www.road.de

Amtsgericht Charlottenburg: HRB 96688 B
Managing director: Hans-Peter Constien

diff --git a/classes/package_tar.bbclass b/classes/package_tar.bbclass
index b905e17..47bf2cc 100644
--- a/classes/package_tar.bbclass
+++ b/classes/package_tar.bbclass
@@ -58,6 +58,7 @@ python do_package_tar () {
 		localdata = bb.data.createCopy(d)
 		pkgdest = bb.data.getVar('PKGDEST', d, 1)
 		root = "%s/%s" % (pkgdest, pkg)
+		lf = bb.utils.lockfile(root + ".lock")
 
 		bb.data.setVar('ROOT', '', localdata)
 		bb.data.setVar('ROOT_%s' % pkg, root, localdata)
@@ -65,6 +66,7 @@ python do_package_tar () {
 
 		overrides = bb.data.getVar('OVERRIDES', localdata)
 		if not overrides:
+			bb.utils.unlockfile(lf)
 			raise bb.build.FuncFailed('OVERRIDES not defined')
 		overrides = bb.data.expand(overrides, localdata)
 		bb.data.setVar('OVERRIDES', '%s:%s' % (overrides, pkg), localdata)
@@ -82,10 +84,12 @@ python do_package_tar () {
 		from glob import glob
 		if not glob('*') + glob('.[!.]*'):
 			bb.note("Not creating empty archive for %s-%s" % (pkg, bb.data.expand('${PV}-${PR}${DISTRO_PR}', d, True)))
+			bb.utils.unlockfile(lf)
 			continue
 		ret = os.system("tar -czf %s %s" % (tarfn, '.'))
 		if ret != 0:
 			bb.error("Creation of tar %s failed." % tarfn)
+		bb.utils.unlockfile(lf)
 }
 
 python () {
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel

Reply via email to