diff options
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/package_ipk.bbclass | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/meta/classes/package_ipk.bbclass b/meta/classes/package_ipk.bbclass index 8e69b5da36..d58b824d3a 100644 --- a/meta/classes/package_ipk.bbclass +++ b/meta/classes/package_ipk.bbclass | |||
@@ -17,6 +17,8 @@ OPKG_ARGS += "${@['', '--add-exclude ' + ' --add-exclude '.join((d.getVar('PACKA | |||
17 | OPKGLIBDIR = "${localstatedir}/lib" | 17 | OPKGLIBDIR = "${localstatedir}/lib" |
18 | 18 | ||
19 | python do_package_ipk () { | 19 | python do_package_ipk () { |
20 | from multiprocessing import Process | ||
21 | |||
20 | oldcwd = os.getcwd() | 22 | oldcwd = os.getcwd() |
21 | 23 | ||
22 | workdir = d.getVar('WORKDIR') | 24 | workdir = d.getVar('WORKDIR') |
@@ -37,11 +39,25 @@ python do_package_ipk () { | |||
37 | if os.access(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN"), os.R_OK): | 39 | if os.access(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN"), os.R_OK): |
38 | os.unlink(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN")) | 40 | os.unlink(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN")) |
39 | 41 | ||
40 | for pkg in packages.split(): | 42 | max_process = int(d.getVar("BB_NUMBER_THREADS") or os.cpu_count() or 1) |
41 | ipk_write_pkg(pkg, d) | 43 | launched = [] |
44 | pkgs = packages.split() | ||
45 | while pkgs: | ||
46 | if len(launched) < max_process: | ||
47 | p = Process(target=ipk_write_pkg, args=(pkgs.pop(), d)) | ||
48 | p.start() | ||
49 | launched.append(p) | ||
50 | for q in launched: | ||
51 | # The finished processes are joined when calling is_alive() | ||
52 | if not q.is_alive(): | ||
53 | launched.remove(q) | ||
54 | for p in launched: | ||
55 | p.join() | ||
42 | 56 | ||
43 | os.chdir(oldcwd) | 57 | os.chdir(oldcwd) |
44 | } | 58 | } |
59 | do_package_ipk[vardeps] += "ipk_write_pkg" | ||
60 | do_package_ipk[vardepsexclude] = "BB_NUMBER_THREADS" | ||
45 | 61 | ||
46 | def ipk_write_pkg(pkg, d): | 62 | def ipk_write_pkg(pkg, d): |
47 | import re, copy | 63 | import re, copy |