summaryrefslogtreecommitdiffstats
path: root/meta/classes/package_deb.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_deb.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_deb.bbclass')
-rw-r--r--meta/classes/package_deb.bbclass18
1 files changed, 15 insertions, 3 deletions
diff --git a/meta/classes/package_deb.bbclass b/meta/classes/package_deb.bbclass
index 241bb67e8d..550436a5eb 100644
--- a/meta/classes/package_deb.bbclass
+++ b/meta/classes/package_deb.bbclass
@@ -61,9 +61,7 @@ python do_package_deb_install () {
61} 61}
62 62
63python do_package_deb () { 63python do_package_deb () {
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:
@@ -96,10 +94,21 @@ python do_package_deb () {
96 bb.debug(1, "No packages; nothing to do") 94 bb.debug(1, "No packages; nothing to do")
97 return 95 return
98 96
97 def lockfile(name):
98 lf = open(name, "a+")
99 fcntl.flock(lf.fileno(), fcntl.LOCK_EX)
100 return lf
101
102 def unlockfile(lf):
103 fcntl.flock(lf.fileno(), fcntl.LOCK_UN)
104 lf.close
105
99 for pkg in packages.split(): 106 for pkg in packages.split():
100 localdata = bb.data.createCopy(d) 107 localdata = bb.data.createCopy(d)
101 root = "%s/install/%s" % (workdir, pkg) 108 root = "%s/install/%s" % (workdir, pkg)
102 109
110 lf = lockfile(root + ".lock")
111
103 bb.data.setVar('ROOT', '', localdata) 112 bb.data.setVar('ROOT', '', localdata)
104 bb.data.setVar('ROOT_%s' % pkg, root, localdata) 113 bb.data.setVar('ROOT_%s' % pkg, root, localdata)
105 pkgname = bb.data.getVar('PKG_%s' % pkg, localdata, 1) 114 pkgname = bb.data.getVar('PKG_%s' % pkg, localdata, 1)
@@ -130,6 +139,7 @@ python do_package_deb () {
130 if not g and not bb.data.getVar('ALLOW_EMPTY', localdata): 139 if not g and not bb.data.getVar('ALLOW_EMPTY', localdata):
131 from bb import note 140 from bb import note
132 note("Not creating empty archive for %s-%s-%s" % (pkg, bb.data.getVar('PV', localdata, 1), bb.data.getVar('PR', localdata, 1))) 141 note("Not creating empty archive for %s-%s-%s" % (pkg, bb.data.getVar('PV', localdata, 1), bb.data.getVar('PR', localdata, 1)))
142 unlockfile(lf)
133 continue 143 continue
134 controldir = os.path.join(root, 'DEBIAN') 144 controldir = os.path.join(root, 'DEBIAN')
135 bb.mkdirhier(controldir) 145 bb.mkdirhier(controldir)
@@ -244,6 +254,8 @@ python do_package_deb () {
244 except OSError: 254 except OSError:
245 pass 255 pass
246 del localdata 256 del localdata
257
258 unlockfile(lf)
247} 259}
248 260
249python () { 261python () {