mirror of
https://git.yoctoproject.org/poky
synced 2026-04-21 21:32:12 +02:00
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>
This commit is contained in:
@@ -69,25 +69,26 @@ python do_package_deb () {
|
||||
}
|
||||
|
||||
def deb_write_pkg(pkg, d):
|
||||
import re, copy
|
||||
import textwrap
|
||||
import subprocess
|
||||
import collections
|
||||
import codecs
|
||||
import re, copy
|
||||
import textwrap
|
||||
import subprocess
|
||||
import collections
|
||||
import codecs
|
||||
|
||||
outdir = d.getVar('PKGWRITEDIRDEB')
|
||||
pkgdest = d.getVar('PKGDEST')
|
||||
outdir = d.getVar('PKGWRITEDIRDEB')
|
||||
pkgdest = d.getVar('PKGDEST')
|
||||
|
||||
def cleanupcontrol(root):
|
||||
for p in ['CONTROL', 'DEBIAN']:
|
||||
p = os.path.join(root, p)
|
||||
if os.path.exists(p):
|
||||
bb.utils.prunedir(p)
|
||||
def cleanupcontrol(root):
|
||||
for p in ['CONTROL', 'DEBIAN']:
|
||||
p = os.path.join(root, p)
|
||||
if os.path.exists(p):
|
||||
bb.utils.prunedir(p)
|
||||
|
||||
localdata = bb.data.createCopy(d)
|
||||
root = "%s/%s" % (pkgdest, pkg)
|
||||
localdata = bb.data.createCopy(d)
|
||||
root = "%s/%s" % (pkgdest, pkg)
|
||||
|
||||
lf = bb.utils.lockfile(root + ".lock")
|
||||
lf = bb.utils.lockfile(root + ".lock")
|
||||
try:
|
||||
|
||||
localdata.setVar('ROOT', '')
|
||||
localdata.setVar('ROOT_%s' % pkg, root)
|
||||
@@ -109,7 +110,6 @@ def deb_write_pkg(pkg, d):
|
||||
g = glob('*')
|
||||
if not g and localdata.getVar('ALLOW_EMPTY', False) != "1":
|
||||
bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV'), localdata.getVar('PKGR')))
|
||||
bb.utils.unlockfile(lf)
|
||||
return
|
||||
|
||||
controldir = os.path.join(root, 'DEBIAN')
|
||||
@@ -283,6 +283,7 @@ def deb_write_pkg(pkg, d):
|
||||
os.chdir(basedir)
|
||||
subprocess.check_output("PATH=\"%s\" dpkg-deb -b %s %s" % (localdata.getVar("PATH"), root, pkgoutdir), shell=True)
|
||||
|
||||
finally:
|
||||
cleanupcontrol(root)
|
||||
bb.utils.unlockfile(lf)
|
||||
|
||||
|
||||
@@ -44,25 +44,25 @@ python do_package_ipk () {
|
||||
}
|
||||
|
||||
def ipk_write_pkg(pkg, d):
|
||||
import re, copy
|
||||
import subprocess
|
||||
import textwrap
|
||||
import collections
|
||||
import re, copy
|
||||
import subprocess
|
||||
import textwrap
|
||||
import collections
|
||||
|
||||
def cleanupcontrol(root):
|
||||
for p in ['CONTROL', 'DEBIAN']:
|
||||
p = os.path.join(root, p)
|
||||
if os.path.exists(p):
|
||||
bb.utils.prunedir(p)
|
||||
def cleanupcontrol(root):
|
||||
for p in ['CONTROL', 'DEBIAN']:
|
||||
p = os.path.join(root, p)
|
||||
if os.path.exists(p):
|
||||
bb.utils.prunedir(p)
|
||||
|
||||
outdir = d.getVar('PKGWRITEDIRIPK')
|
||||
pkgdest = d.getVar('PKGDEST')
|
||||
outdir = d.getVar('PKGWRITEDIRIPK')
|
||||
pkgdest = d.getVar('PKGDEST')
|
||||
|
||||
localdata = bb.data.createCopy(d)
|
||||
root = "%s/%s" % (pkgdest, pkg)
|
||||
|
||||
lf = bb.utils.lockfile(root + ".lock")
|
||||
localdata = bb.data.createCopy(d)
|
||||
root = "%s/%s" % (pkgdest, pkg)
|
||||
|
||||
lf = bb.utils.lockfile(root + ".lock")
|
||||
try:
|
||||
localdata.setVar('ROOT', '')
|
||||
localdata.setVar('ROOT_%s' % pkg, root)
|
||||
pkgname = localdata.getVar('PKG_%s' % pkg)
|
||||
@@ -107,7 +107,6 @@ def ipk_write_pkg(pkg, d):
|
||||
g = glob('*')
|
||||
if not g and localdata.getVar('ALLOW_EMPTY', False) != "1":
|
||||
bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV'), localdata.getVar('PKGR')))
|
||||
bb.utils.unlockfile(lf)
|
||||
return
|
||||
|
||||
controldir = os.path.join(root, 'CONTROL')
|
||||
@@ -245,6 +244,7 @@ def ipk_write_pkg(pkg, d):
|
||||
ipk_to_sign = "%s/%s_%s_%s.ipk" % (pkgoutdir, pkgname, ipkver, d.getVar('PACKAGE_ARCH'))
|
||||
sign_ipk(d, ipk_to_sign)
|
||||
|
||||
finally:
|
||||
cleanupcontrol(root)
|
||||
bb.utils.unlockfile(lf)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user