diff options
Diffstat (limited to 'meta/classes/package_deb.bbclass')
-rw-r--r-- | meta/classes/package_deb.bbclass | 18 |
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 | ||
63 | python do_package_deb () { | 63 | python 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 | ||
249 | python () { | 261 | python () { |