aboutsummaryrefslogtreecommitdiffstats
path: root/classes/package_ipk.bbclass
diff options
context:
space:
mode:
authorKoen Kooi <koen@openembedded.org>2007-12-07 16:44:04 +0000
committerKoen Kooi <koen@openembedded.org>2007-12-07 16:44:04 +0000
commit0f76d287853dfed4aa309b8006f756f07e758d0c (patch)
tree4d56c4b04d7dc44d10dcaeabd6ac3c695c0a0bc6 /classes/package_ipk.bbclass
parent46c78def93e1fc4adcc4af96aaeda288f8be4d55 (diff)
parentcc09c532e73687d83e742bb2c51fdb3a7a5319dc (diff)
downloadopenembedded-0f76d287853dfed4aa309b8006f756f07e758d0c.tar.gz
merge of '60155ceff0e3c21add064d22518f08c6b3c5a304'
and 'b0dc261f9674aecabb4a43c73a328aaba4ec338a'
Diffstat (limited to 'classes/package_ipk.bbclass')
-rw-r--r--classes/package_ipk.bbclass26
1 files changed, 18 insertions, 8 deletions
diff --git a/classes/package_ipk.bbclass b/classes/package_ipk.bbclass
index de7f0fe0c4..fd6ddbc3f8 100644
--- a/classes/package_ipk.bbclass
+++ b/classes/package_ipk.bbclass
@@ -114,7 +114,7 @@ package_generate_ipkg_conf () {
}
python do_package_ipk () {
- import sys, re, copy
+ import sys, re, copy, fcntl
workdir = bb.data.getVar('WORKDIR', d, 1)
if not workdir:
@@ -147,6 +147,16 @@ 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)
pkgdest = bb.data.getVar('PKGDEST', d, 1)
@@ -183,7 +193,7 @@ python do_package_ipk () {
if not g and bb.data.getVar('ALLOW_EMPTY', localdata) != "1":
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)))
- bb.utils.unlockfile(lf)
+ unlockfile(lf)
continue
controldir = os.path.join(root, 'CONTROL')
@@ -191,7 +201,7 @@ python do_package_ipk () {
try:
ctrlfile = file(os.path.join(controldir, 'control'), 'w')
except OSError:
- bb.utils.unlockfile(lf)
+ unlockfile(lf)
raise bb.build.FuncFailed("unable to open control file for writing.")
fields = []
@@ -225,7 +235,7 @@ python do_package_ipk () {
except KeyError:
(type, value, traceback) = sys.exc_info()
ctrlfile.close()
- bb.utils.unlockfile(lf)
+ unlockfile(lf)
raise bb.build.FuncFailed("Missing field for ipk generation: %s" % value)
# more fields
@@ -262,7 +272,7 @@ python do_package_ipk () {
try:
scriptfile = file(os.path.join(controldir, script), 'w')
except OSError:
- bb.utils.unlockfile(lf)
+ unlockfile(lf)
raise bb.build.FuncFailed("unable to open %s script file for writing." % script)
scriptfile.write(scriptvar)
scriptfile.close()
@@ -273,7 +283,7 @@ python do_package_ipk () {
try:
conffiles = file(os.path.join(controldir, 'conffiles'), 'w')
except OSError:
- bb.utils.unlockfile(lf)
+ unlockfile(lf)
raise bb.build.FuncFailed("unable to open conffiles for writing.")
for f in conffiles_str.split():
conffiles.write('%s\n' % f)
@@ -283,7 +293,7 @@ python do_package_ipk () {
ret = os.system("PATH=\"%s\" %s %s %s" % (bb.data.getVar("PATH", localdata, 1),
bb.data.getVar("IPKGBUILDCMD",d,1), pkg, pkgoutdir))
if ret != 0:
- bb.utils.unlockfile(lf)
+ unlockfile(lf)
raise bb.build.FuncFailed("ipkg-build execution failed")
for script in ["preinst", "postinst", "prerm", "postrm", "control" ]:
@@ -296,7 +306,7 @@ python do_package_ipk () {
os.rmdir(controldir)
except OSError:
pass
- bb.utils.unlockfile(lf)
+ unlockfile(lf)
}
python () {