Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: bin/install-qa-check.d/
Date: Sat, 28 Jul 2018 06:41:35
Message-Id: 1532759516.50283f1abb77f0785ab86d41ad70d76df4e399be.zmedico@gentoo
1 commit: 50283f1abb77f0785ab86d41ad70d76df4e399be
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jul 25 19:43:24 2018 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Sat Jul 28 06:31:56 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=50283f1a
7
8 install-qa-check.d/60pngfix: parallel support (bug 630292)
9
10 If xargs supports the --max-procs option then use the makeopts_jobs
11 function from helper-functions.sh to generate a --max-procs argument.
12 Use xargs -L 1 to limit the number of png files per pngfix process,
13 in order to ensure that enough processes are spawned, since otherwise
14 xargs minimizes the number of processes spawned. A benchmark with
15 flightgear-data-2018.2.1 shows that larger values of -L only decrease
16 performance.
17
18 Bug: https://bugs.gentoo.org/630292
19 Reviewed-by: Lars Wendler <polynomial-c <AT> gentoo.org>
20 Reviewed-by: Mike Gilbert <floppym <AT> gentoo.org>
21
22 bin/install-qa-check.d/60pngfix | 14 ++++++++++++--
23 1 file changed, 12 insertions(+), 2 deletions(-)
24
25 diff --git a/bin/install-qa-check.d/60pngfix b/bin/install-qa-check.d/60pngfix
26 index 8d53040b6..b69c55614 100644
27 --- a/bin/install-qa-check.d/60pngfix
28 +++ b/bin/install-qa-check.d/60pngfix
29 @@ -1,7 +1,17 @@
30 # Check for issues with PNG files
31
32 +source "${PORTAGE_BIN_PATH}/helper-functions.sh" || exit 1
33 +
34 pngfix_check() {
35 - local pngfix=$(type -P pngfix)
36 + local chunksize=1 jobs pngfix=$(type -P pngfix) xargs=(${XARGS})
37 +
38 + if "${xargs[@]}" --help | grep -q -- --max-procs=; then
39 + jobs=$(makeopts_jobs)
40 + if [[ ${jobs} -gt 1 ]]; then
41 + xargs+=("--max-procs=${jobs}" -L "${chunksize}")
42 + fi
43 + fi
44 +
45 if [[ -n ${pngfix} ]] ; then
46 local pngout=()
47 local next
48 @@ -25,7 +35,7 @@ pngfix_check() {
49 fi
50 eqawarn " ${pngout[@]:7}: ${error}"
51 fi
52 - done < <(find "${ED}" -type f -name '*.png' -exec "${pngfix}" {} +)
53 + done < <(find "${ED}" -type f -name '*.png' -print0 | "${xargs[@]}" -0 "${pngfix}")
54 fi
55 }