Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH] install-qa-check.d/60pngfix: parallel support (bug 630292)
Date: Wed, 25 Jul 2018 20:02:44
Message-Id: 20180725195958.6406-1-zmedico@gentoo.org
1 If xargs supports the --max-procs option then use the makeopts_jobs
2 function from helper-functions.sh to generate a --max-procs argument.
3
4 Bug: https://bugs.gentoo.org/630292
5 ---
6 bin/install-qa-check.d/60pngfix | 14 ++++++++++++--
7 1 file changed, 12 insertions(+), 2 deletions(-)
8
9 diff --git a/bin/install-qa-check.d/60pngfix b/bin/install-qa-check.d/60pngfix
10 index 8d53040b6..2bf020079 100644
11 --- a/bin/install-qa-check.d/60pngfix
12 +++ b/bin/install-qa-check.d/60pngfix
13 @@ -1,7 +1,17 @@
14 # Check for issues with PNG files
15
16 +source "${PORTAGE_BIN_PATH}/helper-functions.sh" || exit 1
17 +
18 pngfix_check() {
19 - local pngfix=$(type -P pngfix)
20 + local jobs pngfix=$(type -P pngfix) xargs=(${XARGS})
21 +
22 + if xargs --help | grep -q -- --max-procs=; then
23 + jobs=$(makeopts_jobs)
24 + if [[ ${jobs} -gt 1 ]]; then
25 + xargs+=(--max-procs=${jobs})
26 + fi
27 + fi
28 +
29 if [[ -n ${pngfix} ]] ; then
30 local pngout=()
31 local next
32 @@ -25,7 +35,7 @@ pngfix_check() {
33 fi
34 eqawarn " ${pngout[@]:7}: ${error}"
35 fi
36 - done < <(find "${ED}" -type f -name '*.png' -exec "${pngfix}" {} +)
37 + done < <(find "${ED}" -type f -name '*.png' -print0 | "${xargs[@]}" -0 "${pngfix}")
38 fi
39 }
40
41 --
42 2.16.4

Replies