aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-31 13:34:24 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-05-11 17:41:05 +0100
commit5054f66f8fbaaa422f74a4b5d0e61e68de6ffe91 (patch)
tree5206503fa7926f7f9fd45f3b4b0f975065140ee1
parentf190d8456c7e135164d3073acfb3319e75c9de76 (diff)
downloadopenembedded-core-contrib-5054f66f8fbaaa422f74a4b5d0e61e68de6ffe91.tar.gz
package_deb: Split do_package_write_deb into two functions
This prepares the way to parallelise deb generation and splits the iteration over packages and the package generation into separate functions. Whitespace indentation is unchanged deliberately and is fixed in a followup patch. There should be no functional change. Some checks on variables are removed as they were pointless when you looked at the code. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/package_deb.bbclass57
1 files changed, 24 insertions, 33 deletions
diff --git a/meta/classes/package_deb.bbclass b/meta/classes/package_deb.bbclass
index eacabcdb61..636647d6ff 100644
--- a/meta/classes/package_deb.bbclass
+++ b/meta/classes/package_deb.bbclass
@@ -51,47 +51,39 @@ def debian_arch_map(arch, tune):
# INSTALL_TASK_DEB - task name
python do_package_deb () {
- import re, copy
- import textwrap
- import subprocess
- import collections
- import codecs
-
oldcwd = os.getcwd()
- workdir = d.getVar('WORKDIR')
- if not workdir:
- bb.error("WORKDIR not defined, unable to package")
- return
-
- outdir = d.getVar('PKGWRITEDIRDEB')
- if not outdir:
- bb.error("PKGWRITEDIRDEB not defined, unable to package")
- return
-
packages = d.getVar('PACKAGES')
if not packages:
bb.debug(1, "PACKAGES not defined, nothing to package")
return
tmpdir = d.getVar('TMPDIR')
-
if os.access(os.path.join(tmpdir, "stamps", "DEB_PACKAGE_INDEX_CLEAN"),os.R_OK):
os.unlink(os.path.join(tmpdir, "stamps", "DEB_PACKAGE_INDEX_CLEAN"))
- if packages == []:
- bb.debug(1, "No packages; nothing to do")
- return
+ for pkg in packages.split():
+ deb_write_pkg(pkg, d)
+
+ os.chdir(oldcwd)
+}
- pkgdest = d.getVar('PKGDEST')
+def deb_write_pkg(pkg, d):
+ import re, copy
+ import textwrap
+ import subprocess
+ import collections
+ import codecs
- 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('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)
- for pkg in packages.split():
localdata = bb.data.createCopy(d)
root = "%s/%s" % (pkgdest, pkg)
@@ -118,7 +110,7 @@ python do_package_deb () {
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)
- continue
+ return
controldir = os.path.join(root, 'DEBIAN')
bb.utils.mkdirhier(controldir)
@@ -293,13 +285,12 @@ python do_package_deb () {
cleanupcontrol(root)
bb.utils.unlockfile(lf)
- os.chdir(oldcwd)
-}
-# Indirect references to these vars
-do_package_write_deb[vardeps] += "PKGV PKGR PKGV DESCRIPTION SECTION PRIORITY MAINTAINER DPKG_ARCH PN HOMEPAGE"
+
# Otherwise allarch packages may change depending on override configuration
-do_package_deb[vardepsexclude] = "OVERRIDES"
+deb_write_pkg[vardepsexclude] = "OVERRIDES"
+# Indirect references to these vars
+do_package_write_deb[vardeps] += "PKGV PKGR PKGV DESCRIPTION SECTION PRIORITY MAINTAINER DPKG_ARCH PN HOMEPAGE"
SSTATETASKS += "do_package_write_deb"
do_package_write_deb[sstate-inputdirs] = "${PKGWRITEDIRDEB}"