summaryrefslogtreecommitdiff
path: root/meta
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
parentbc8fdf047246c6d73dea83c1053dba697fa6953f (diff)
downloadopenembedded-core-e93df891ad1f6a27a7f181203675e9a7158b35b1.tar.gz
openembedded-core-e93df891ad1f6a27a7f181203675e9a7158b35b1.tar.bz2
openembedded-core-e93df891ad1f6a27a7f181203675e9a7158b35b1.zip
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')
-rw-r--r--meta/classes/package_deb.bbclass18
-rw-r--r--meta/classes/package_ipk.bbclass17
2 files changed, 29 insertions, 6 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 () {
}
python do_package_deb () {
- import copy # to back up env data
- import sys
- import re
+ import sys, re, fcntl, copy
workdir = bb.data.getVar('WORKDIR', d, 1)
if not workdir:
@@ -96,10 +94,21 @@ python do_package_deb () {
bb.debug(1, "No packages; nothing to do")
return
+ def lockfile(name):
+ lf = open(name, "a+")
+ fcntl.flock(lf.fileno(), fcntl.LOCK_EX)
+ return lf
+
+ def unlockfile(lf):
+ fcntl.flock(lf.fileno(), fcntl.LOCK_UN)
+ lf.close
+
for pkg in packages.split():
localdata = bb.data.createCopy(d)
root = "%s/install/%s" % (workdir, pkg)
+ lf = lockfile(root + ".lock")
+
bb.data.setVar('ROOT', '', localdata)
bb.data.setVar('ROOT_%s' % pkg, root, localdata)
pkgname = bb.data.getVar('PKG_%s' % pkg, localdata, 1)
@@ -130,6 +139,7 @@ python do_package_deb () {
if not g and not bb.data.getVar('ALLOW_EMPTY', localdata):
from bb import note
note("Not creating empty archive for %s-%s-%s" % (pkg, bb.data.getVar('PV', localdata, 1), bb.data.getVar('PR', localdata, 1)))
+ unlockfile(lf)
continue
controldir = os.path.join(root, 'DEBIAN')
bb.mkdirhier(controldir)
@@ -244,6 +254,8 @@ python do_package_deb () {
except OSError:
pass
del localdata
+
+ unlockfile(lf)
}
python () {
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 () {
}
python do_package_ipk () {
- import copy # to back up env data
- import sys
- import re
+ import sys, re, fcntl, copy
workdir = bb.data.getVar('WORKDIR', d, 1)
if not workdir:
@@ -97,10 +95,21 @@ python do_package_ipk () {
bb.debug(1, "No packages; nothing to do")
return
+ def lockfile(name):
+ lf = open(name, "a+")
+ fcntl.flock(lf.fileno(), fcntl.LOCK_EX)
+ return lf
+
+ def unlockfile(lf):
+ fcntl.flock(lf.fileno(), fcntl.LOCK_UN)
+ lf.close
+
for pkg in packages.split():
localdata = bb.data.createCopy(d)
root = "%s/install/%s" % (workdir, pkg)
+ lf = lockfile(root + ".lock")
+
bb.data.setVar('ROOT', '', localdata)
bb.data.setVar('ROOT_%s' % pkg, root, localdata)
pkgname = bb.data.getVar('PKG_%s' % pkg, localdata, 1)
@@ -129,6 +138,7 @@ python do_package_ipk () {
if not g and not bb.data.getVar('ALLOW_EMPTY', localdata):
from bb import note
note("Not creating empty archive for %s-%s-%s" % (pkg, bb.data.getVar('PV', localdata, 1), bb.data.getVar('PR', localdata, 1)))
+ unlockfile(lf)
continue
controldir = os.path.join(root, 'CONTROL')
bb.mkdirhier(controldir)
@@ -236,6 +246,7 @@ python do_package_ipk () {
except OSError:
pass
del localdata
+ unlockfile(lf)
}
python () {