summaryrefslogtreecommitdiffstats
path: root/meta/classes/package_deb.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-31 15:28:07 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-05-12 08:45:36 +0100
commitaee1b575395d09227028c6a999d29f613086287c (patch)
tree40384643ee93cadcad62ec391b89e5f080b4b62b /meta/classes/package_deb.bbclass
parent086e0db58289fbded898eccb46cf0141444ace97 (diff)
downloadpoky-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_deb.bbclass')
-rw-r--r--meta/classes/package_deb.bbclass33
1 files changed, 17 insertions, 16 deletions
diff --git a/meta/classes/package_deb.bbclass b/meta/classes/package_deb.bbclass
index 636647d6ff..04b91970c7 100644
--- a/meta/classes/package_deb.bbclass
+++ b/meta/classes/package_deb.bbclass
@@ -69,25 +69,26 @@ python do_package_deb () {
69} 69}
70 70
71def deb_write_pkg(pkg, d): 71def deb_write_pkg(pkg, d):
72 import re, copy 72 import re, copy
73 import textwrap 73 import textwrap
74 import subprocess 74 import subprocess
75 import collections 75 import collections
76 import codecs 76 import codecs
77 77
78 outdir = d.getVar('PKGWRITEDIRDEB') 78 outdir = d.getVar('PKGWRITEDIRDEB')
79 pkgdest = d.getVar('PKGDEST') 79 pkgdest = d.getVar('PKGDEST')
80 80
81 def cleanupcontrol(root): 81 def cleanupcontrol(root):
82 for p in ['CONTROL', 'DEBIAN']: 82 for p in ['CONTROL', 'DEBIAN']:
83 p = os.path.join(root, p) 83 p = os.path.join(root, p)
84 if os.path.exists(p): 84 if os.path.exists(p):
85 bb.utils.prunedir(p) 85 bb.utils.prunedir(p)
86 86
87 localdata = bb.data.createCopy(d) 87 localdata = bb.data.createCopy(d)
88 root = "%s/%s" % (pkgdest, pkg) 88 root = "%s/%s" % (pkgdest, pkg)
89 89
90 lf = bb.utils.lockfile(root + ".lock") 90 lf = bb.utils.lockfile(root + ".lock")
91 try:
91 92
92 localdata.setVar('ROOT', '') 93 localdata.setVar('ROOT', '')
93 localdata.setVar('ROOT_%s' % pkg, root) 94 localdata.setVar('ROOT_%s' % pkg, root)
@@ -109,7 +110,6 @@ def deb_write_pkg(pkg, d):
109 g = glob('*') 110 g = glob('*')
110 if not g and localdata.getVar('ALLOW_EMPTY', False) != "1": 111 if not g and localdata.getVar('ALLOW_EMPTY', False) != "1":
111 bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV'), localdata.getVar('PKGR'))) 112 bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV'), localdata.getVar('PKGR')))
112 bb.utils.unlockfile(lf)
113 return 113 return
114 114
115 controldir = os.path.join(root, 'DEBIAN') 115 controldir = os.path.join(root, 'DEBIAN')
@@ -283,6 +283,7 @@ def deb_write_pkg(pkg, d):
283 os.chdir(basedir) 283 os.chdir(basedir)
284 subprocess.check_output("PATH=\"%s\" dpkg-deb -b %s %s" % (localdata.getVar("PATH"), root, pkgoutdir), shell=True) 284 subprocess.check_output("PATH=\"%s\" dpkg-deb -b %s %s" % (localdata.getVar("PATH"), root, pkgoutdir), shell=True)
285 285
286 finally:
286 cleanupcontrol(root) 287 cleanupcontrol(root)
287 bb.utils.unlockfile(lf) 288 bb.utils.unlockfile(lf)
288 289