diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-31 13:34:24 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-05-12 08:45:36 +0100 |
commit | 086e0db58289fbded898eccb46cf0141444ace97 (patch) | |
tree | edd3a618e5c44fcd74a61a154859587129e1bca7 /meta/classes | |
parent | 8454756453789060be677d9ea1402a92b269d779 (diff) | |
download | poky-086e0db58289fbded898eccb46cf0141444ace97.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.
(From OE-Core rev: 5054f66f8fbaaa422f74a4b5d0e61e68de6ffe91)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/package_deb.bbclass | 57 |
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): | |||
51 | # INSTALL_TASK_DEB - task name | 51 | # INSTALL_TASK_DEB - task name |
52 | 52 | ||
53 | python do_package_deb () { | 53 | python do_package_deb () { |
54 | import re, copy | ||
55 | import textwrap | ||
56 | import subprocess | ||
57 | import collections | ||
58 | import codecs | ||
59 | |||
60 | oldcwd = os.getcwd() | 54 | oldcwd = os.getcwd() |
61 | 55 | ||
62 | workdir = d.getVar('WORKDIR') | ||
63 | if not workdir: | ||
64 | bb.error("WORKDIR not defined, unable to package") | ||
65 | return | ||
66 | |||
67 | outdir = d.getVar('PKGWRITEDIRDEB') | ||
68 | if not outdir: | ||
69 | bb.error("PKGWRITEDIRDEB not defined, unable to package") | ||
70 | return | ||
71 | |||
72 | packages = d.getVar('PACKAGES') | 56 | packages = d.getVar('PACKAGES') |
73 | if not packages: | 57 | if not packages: |
74 | bb.debug(1, "PACKAGES not defined, nothing to package") | 58 | bb.debug(1, "PACKAGES not defined, nothing to package") |
75 | return | 59 | return |
76 | 60 | ||
77 | tmpdir = d.getVar('TMPDIR') | 61 | tmpdir = d.getVar('TMPDIR') |
78 | |||
79 | if os.access(os.path.join(tmpdir, "stamps", "DEB_PACKAGE_INDEX_CLEAN"),os.R_OK): | 62 | if os.access(os.path.join(tmpdir, "stamps", "DEB_PACKAGE_INDEX_CLEAN"),os.R_OK): |
80 | os.unlink(os.path.join(tmpdir, "stamps", "DEB_PACKAGE_INDEX_CLEAN")) | 63 | os.unlink(os.path.join(tmpdir, "stamps", "DEB_PACKAGE_INDEX_CLEAN")) |
81 | 64 | ||
82 | if packages == []: | 65 | for pkg in packages.split(): |
83 | bb.debug(1, "No packages; nothing to do") | 66 | deb_write_pkg(pkg, d) |
84 | return | 67 | |
68 | os.chdir(oldcwd) | ||
69 | } | ||
85 | 70 | ||
86 | pkgdest = d.getVar('PKGDEST') | 71 | def deb_write_pkg(pkg, d): |
72 | import re, copy | ||
73 | import textwrap | ||
74 | import subprocess | ||
75 | import collections | ||
76 | import codecs | ||
87 | 77 | ||
88 | def cleanupcontrol(root): | 78 | outdir = d.getVar('PKGWRITEDIRDEB') |
89 | for p in ['CONTROL', 'DEBIAN']: | 79 | pkgdest = d.getVar('PKGDEST') |
90 | p = os.path.join(root, p) | 80 | |
91 | if os.path.exists(p): | 81 | def cleanupcontrol(root): |
92 | bb.utils.prunedir(p) | 82 | for p in ['CONTROL', 'DEBIAN']: |
83 | p = os.path.join(root, p) | ||
84 | if os.path.exists(p): | ||
85 | bb.utils.prunedir(p) | ||
93 | 86 | ||
94 | for pkg in packages.split(): | ||
95 | localdata = bb.data.createCopy(d) | 87 | localdata = bb.data.createCopy(d) |
96 | root = "%s/%s" % (pkgdest, pkg) | 88 | root = "%s/%s" % (pkgdest, pkg) |
97 | 89 | ||
@@ -118,7 +110,7 @@ python do_package_deb () { | |||
118 | if not g and localdata.getVar('ALLOW_EMPTY', False) != "1": | 110 | if not g and localdata.getVar('ALLOW_EMPTY', False) != "1": |
119 | bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV'), localdata.getVar('PKGR'))) | 111 | bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV'), localdata.getVar('PKGR'))) |
120 | bb.utils.unlockfile(lf) | 112 | bb.utils.unlockfile(lf) |
121 | continue | 113 | return |
122 | 114 | ||
123 | controldir = os.path.join(root, 'DEBIAN') | 115 | controldir = os.path.join(root, 'DEBIAN') |
124 | bb.utils.mkdirhier(controldir) | 116 | bb.utils.mkdirhier(controldir) |
@@ -293,13 +285,12 @@ python do_package_deb () { | |||
293 | 285 | ||
294 | cleanupcontrol(root) | 286 | cleanupcontrol(root) |
295 | bb.utils.unlockfile(lf) | 287 | bb.utils.unlockfile(lf) |
296 | os.chdir(oldcwd) | 288 | |
297 | } | ||
298 | # Indirect references to these vars | ||
299 | do_package_write_deb[vardeps] += "PKGV PKGR PKGV DESCRIPTION SECTION PRIORITY MAINTAINER DPKG_ARCH PN HOMEPAGE" | ||
300 | # Otherwise allarch packages may change depending on override configuration | 289 | # Otherwise allarch packages may change depending on override configuration |
301 | do_package_deb[vardepsexclude] = "OVERRIDES" | 290 | deb_write_pkg[vardepsexclude] = "OVERRIDES" |
302 | 291 | ||
292 | # Indirect references to these vars | ||
293 | do_package_write_deb[vardeps] += "PKGV PKGR PKGV DESCRIPTION SECTION PRIORITY MAINTAINER DPKG_ARCH PN HOMEPAGE" | ||
303 | 294 | ||
304 | SSTATETASKS += "do_package_write_deb" | 295 | SSTATETASKS += "do_package_write_deb" |
305 | do_package_write_deb[sstate-inputdirs] = "${PKGWRITEDIRDEB}" | 296 | do_package_write_deb[sstate-inputdirs] = "${PKGWRITEDIRDEB}" |