From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id A2917138334 for ; Sat, 28 Jul 2018 06:41:35 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 398F5E0831; Sat, 28 Jul 2018 06:41:32 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 11A35E0831 for ; Sat, 28 Jul 2018 06:41:32 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 52076335C96 for ; Sat, 28 Jul 2018 06:41:28 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 9DB33373 for ; Sat, 28 Jul 2018 06:41:26 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1532759516.50283f1abb77f0785ab86d41ad70d76df4e399be.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/install-qa-check.d/ X-VCS-Repository: proj/portage X-VCS-Files: bin/install-qa-check.d/60pngfix X-VCS-Directories: bin/install-qa-check.d/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 50283f1abb77f0785ab86d41ad70d76df4e399be X-VCS-Branch: master Date: Sat, 28 Jul 2018 06:41:26 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 30088754-cd3d-4db4-8d0d-d1c34eaa5099 X-Archives-Hash: c02abe684df2f99d19c772eb141c488b commit: 50283f1abb77f0785ab86d41ad70d76df4e399be Author: Zac Medico gentoo org> AuthorDate: Wed Jul 25 19:43:24 2018 +0000 Commit: Zac Medico gentoo org> CommitDate: Sat Jul 28 06:31:56 2018 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=50283f1a install-qa-check.d/60pngfix: parallel support (bug 630292) If xargs supports the --max-procs option then use the makeopts_jobs function from helper-functions.sh to generate a --max-procs argument. Use xargs -L 1 to limit the number of png files per pngfix process, in order to ensure that enough processes are spawned, since otherwise xargs minimizes the number of processes spawned. A benchmark with flightgear-data-2018.2.1 shows that larger values of -L only decrease performance. Bug: https://bugs.gentoo.org/630292 Reviewed-by: Lars Wendler gentoo.org> Reviewed-by: Mike Gilbert gentoo.org> bin/install-qa-check.d/60pngfix | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/bin/install-qa-check.d/60pngfix b/bin/install-qa-check.d/60pngfix index 8d53040b6..b69c55614 100644 --- a/bin/install-qa-check.d/60pngfix +++ b/bin/install-qa-check.d/60pngfix @@ -1,7 +1,17 @@ # Check for issues with PNG files +source "${PORTAGE_BIN_PATH}/helper-functions.sh" || exit 1 + pngfix_check() { - local pngfix=$(type -P pngfix) + local chunksize=1 jobs pngfix=$(type -P pngfix) xargs=(${XARGS}) + + if "${xargs[@]}" --help | grep -q -- --max-procs=; then + jobs=$(makeopts_jobs) + if [[ ${jobs} -gt 1 ]]; then + xargs+=("--max-procs=${jobs}" -L "${chunksize}") + fi + fi + if [[ -n ${pngfix} ]] ; then local pngout=() local next @@ -25,7 +35,7 @@ pngfix_check() { fi eqawarn " ${pngout[@]:7}: ${error}" fi - done < <(find "${ED}" -type f -name '*.png' -exec "${pngfix}" {} +) + done < <(find "${ED}" -type f -name '*.png' -print0 | "${xargs[@]}" -0 "${pngfix}") fi }