summaryrefslogtreecommitdiffstats
path: root/meta/classes/package_ipk.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2007-08-24 16:50:56 +0000
committerRichard Purdie <richard@openedhand.com>2007-08-24 16:50:56 +0000
commite93df891ad1f6a27a7f181203675e9a7158b35b1 (patch)
tree69fc5b06b3d2468550e82632147e64f6d9a6006a /meta/classes/package_ipk.bbclass
parentbc8fdf047246c6d73dea83c1053dba697fa6953f (diff)
downloadpoky-e93df891ad1f6a27a7f181203675e9a7158b35b1.tar.gz
package_ipk/deb.bbclass: Add locking for package creation to stop conflicts
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@2557 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/classes/package_ipk.bbclass')
-rw-r--r--meta/classes/package_ipk.bbclass17
1 files changed, 14 insertions, 3 deletions
diff --git a/meta/classes/package_ipk.bbclass b/meta/classes/package_ipk.bbclass
index afe70005d9..d88d11b994 100644
--- a/meta/classes/package_ipk.bbclass
+++ b/meta/classes/package_ipk.bbclass
@@ -61,9 +61,7 @@ python package_ipk_install () {
61} 61}
62 62
63python do_package_ipk () { 63python do_package_ipk () {
64 import copy # to back up env data 64 import sys, re, fcntl, copy
65 import sys
66 import re
67 65
68 workdir = bb.data.getVar('WORKDIR', d, 1) 66 workdir = bb.data.getVar('WORKDIR', d, 1)
69 if not workdir: 67 if not workdir:
@@ -97,10 +95,21 @@ python do_package_ipk () {
97 bb.debug(1, "No packages; nothing to do") 95 bb.debug(1, "No packages; nothing to do")
98 return 96 return
99 97
98 def lockfile(name):
99 lf = open(name, "a+")
100 fcntl.flock(lf.fileno(), fcntl.LOCK_EX)
101 return lf
102
103 def unlockfile(lf):
104 fcntl.flock(lf.fileno(), fcntl.LOCK_UN)
105 lf.close
106
100 for pkg in packages.split(): 107 for pkg in packages.split():
101 localdata = bb.data.createCopy(d) 108 localdata = bb.data.createCopy(d)
102 root = "%s/install/%s" % (workdir, pkg) 109 root = "%s/install/%s" % (workdir, pkg)
103 110
111 lf = lockfile(root + ".lock")
112
104 bb.data.setVar('ROOT', '', localdata) 113 bb.data.setVar('ROOT', '', localdata)
105 bb.data.setVar('ROOT_%s' % pkg, root, localdata) 114 bb.data.setVar('ROOT_%s' % pkg, root, localdata)
106 pkgname = bb.data.getVar('PKG_%s' % pkg, localdata, 1) 115 pkgname = bb.data.getVar('PKG_%s' % pkg, localdata, 1)
@@ -129,6 +138,7 @@ python do_package_ipk () {
129 if not g and not bb.data.getVar('ALLOW_EMPTY', localdata): 138 if not g and not bb.data.getVar('ALLOW_EMPTY', localdata):
130 from bb import note 139 from bb import note
131 note("Not creating empty archive for %s-%s-%s" % (pkg, bb.data.getVar('PV', localdata, 1), bb.data.getVar('PR', localdata, 1))) 140 note("Not creating empty archive for %s-%s-%s" % (pkg, bb.data.getVar('PV', localdata, 1), bb.data.getVar('PR', localdata, 1)))
141 unlockfile(lf)
132 continue 142 continue
133 controldir = os.path.join(root, 'CONTROL') 143 controldir = os.path.join(root, 'CONTROL')
134 bb.mkdirhier(controldir) 144 bb.mkdirhier(controldir)
@@ -236,6 +246,7 @@ python do_package_ipk () {
236 except OSError: 246 except OSError:
237 pass 247 pass
238 del localdata 248 del localdata
249 unlockfile(lf)
239} 250}
240 251
241python () { 252python () {