diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-31 15:28:07 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-05-12 08:45:36 +0100 |
commit | aee1b575395d09227028c6a999d29f613086287c (patch) | |
tree | 40384643ee93cadcad62ec391b89e5f080b4b62b /meta/classes/package_ipk.bbclass | |
parent | 086e0db58289fbded898eccb46cf0141444ace97 (diff) | |
download | poky-aee1b575395d09227028c6a999d29f613086287c.tar.gz |
package_ipk/deb: Tweak functions for better cleanup and layout
This uses more modern formatting to handle the lockfiles and control
file cleanup with try/finally, taking advantage of the previous
extra indentation.
(From OE-Core rev: 9cd7c2631b0840a57b9ed6c201bcb4fc80094f71)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/package_ipk.bbclass')
-rw-r--r-- | meta/classes/package_ipk.bbclass | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/meta/classes/package_ipk.bbclass b/meta/classes/package_ipk.bbclass index 16ee761537..5cc7e0a7b2 100644 --- a/meta/classes/package_ipk.bbclass +++ b/meta/classes/package_ipk.bbclass | |||
@@ -44,25 +44,25 @@ python do_package_ipk () { | |||
44 | } | 44 | } |
45 | 45 | ||
46 | def ipk_write_pkg(pkg, d): | 46 | def ipk_write_pkg(pkg, d): |
47 | import re, copy | 47 | import re, copy |
48 | import subprocess | 48 | import subprocess |
49 | import textwrap | 49 | import textwrap |
50 | import collections | 50 | import collections |
51 | 51 | ||
52 | def cleanupcontrol(root): | 52 | def cleanupcontrol(root): |
53 | for p in ['CONTROL', 'DEBIAN']: | 53 | for p in ['CONTROL', 'DEBIAN']: |
54 | p = os.path.join(root, p) | 54 | p = os.path.join(root, p) |
55 | if os.path.exists(p): | 55 | if os.path.exists(p): |
56 | bb.utils.prunedir(p) | 56 | bb.utils.prunedir(p) |
57 | 57 | ||
58 | outdir = d.getVar('PKGWRITEDIRIPK') | 58 | outdir = d.getVar('PKGWRITEDIRIPK') |
59 | pkgdest = d.getVar('PKGDEST') | 59 | pkgdest = d.getVar('PKGDEST') |
60 | |||
61 | localdata = bb.data.createCopy(d) | ||
62 | root = "%s/%s" % (pkgdest, pkg) | ||
63 | 60 | ||
64 | lf = bb.utils.lockfile(root + ".lock") | 61 | localdata = bb.data.createCopy(d) |
62 | root = "%s/%s" % (pkgdest, pkg) | ||
65 | 63 | ||
64 | lf = bb.utils.lockfile(root + ".lock") | ||
65 | try: | ||
66 | localdata.setVar('ROOT', '') | 66 | localdata.setVar('ROOT', '') |
67 | localdata.setVar('ROOT_%s' % pkg, root) | 67 | localdata.setVar('ROOT_%s' % pkg, root) |
68 | pkgname = localdata.getVar('PKG_%s' % pkg) | 68 | pkgname = localdata.getVar('PKG_%s' % pkg) |
@@ -107,7 +107,6 @@ def ipk_write_pkg(pkg, d): | |||
107 | g = glob('*') | 107 | g = glob('*') |
108 | if not g and localdata.getVar('ALLOW_EMPTY', False) != "1": | 108 | if not g and localdata.getVar('ALLOW_EMPTY', False) != "1": |
109 | bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV'), localdata.getVar('PKGR'))) | 109 | bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV'), localdata.getVar('PKGR'))) |
110 | bb.utils.unlockfile(lf) | ||
111 | return | 110 | return |
112 | 111 | ||
113 | controldir = os.path.join(root, 'CONTROL') | 112 | controldir = os.path.join(root, 'CONTROL') |
@@ -245,6 +244,7 @@ def ipk_write_pkg(pkg, d): | |||
245 | ipk_to_sign = "%s/%s_%s_%s.ipk" % (pkgoutdir, pkgname, ipkver, d.getVar('PACKAGE_ARCH')) | 244 | ipk_to_sign = "%s/%s_%s_%s.ipk" % (pkgoutdir, pkgname, ipkver, d.getVar('PACKAGE_ARCH')) |
246 | sign_ipk(d, ipk_to_sign) | 245 | sign_ipk(d, ipk_to_sign) |
247 | 246 | ||
247 | finally: | ||
248 | cleanupcontrol(root) | 248 | cleanupcontrol(root) |
249 | bb.utils.unlockfile(lf) | 249 | bb.utils.unlockfile(lf) |
250 | 250 | ||