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 40D21138334 for ; Mon, 20 May 2019 21:37:00 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 2825EE0878; Mon, 20 May 2019 21:36:59 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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 F08A3E0878 for ; Mon, 20 May 2019 21:36:58 +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 15FB9344C61 for ; Mon, 20 May 2019 21:36:57 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 089FA5DC for ; Mon, 20 May 2019 21:36:55 +0000 (UTC) From: "Ulrich Müller" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Ulrich Müller" Message-ID: <1558387875.83510840c1dfde65e806e405c64abec44b9095f4.ulm@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: sys-kernel/linux-firmware/ X-VCS-Repository: repo/gentoo X-VCS-Files: sys-kernel/linux-firmware/linux-firmware-99999999.ebuild X-VCS-Directories: sys-kernel/linux-firmware/ X-VCS-Committer: ulm X-VCS-Committer-Name: Ulrich Müller X-VCS-Revision: 83510840c1dfde65e806e405c64abec44b9095f4 X-VCS-Branch: master Date: Mon, 20 May 2019 21:36:55 +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-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: bc3ac70c-d70e-4cd6-a029-f84075950d9f X-Archives-Hash: f7348a3ae07f86511592674ca801913a commit: 83510840c1dfde65e806e405c64abec44b9095f4 Author: Ulrich Müller kph uni-mainz de> AuthorDate: Mon May 20 08:53:39 2019 +0000 Commit: Ulrich Müller gentoo org> CommitDate: Mon May 20 21:31:15 2019 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=83510840 sys-kernel/linux-firmware: Speed up src_prepare code. Building the list of files to remove could take up to one minute on recent hardware, because it used a quadratic algorithm in bash. Call grep instead, which is way faster. Acked-by: Chí-Thanh Christopher Nguyễn gentoo.org> Closes: https://bugs.gentoo.org/686376 Package-Manager: Portage-2.3.66, Repoman-2.3.12 Signed-off-by: Ulrich Müller gentoo.org> .../linux-firmware/linux-firmware-99999999.ebuild | 33 ++++++++-------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild b/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild index 398592afd42..f439b40eab4 100644 --- a/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild +++ b/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild @@ -226,6 +226,7 @@ src_prepare() { # remove sources and documentation (wildcards are expanded) rm -r ${source_files[@]} || die + rm -rf .git if use !unknown-license; then # remove files in unknown_license @@ -236,12 +237,11 @@ src_prepare() { # remove files _not_ in the free_software or unknown_license lists # everything else is confirmed (or assumed) to be redistributable # based on upstream acceptance policy - local file remove=() - while IFS= read -d "" -r file; do - has "${file#./}" "${free_software[@]}" "${unknown_license[@]}" \ - || remove+=("${file}") - done < <(find * ! -type d -print0 || die) - printf "%s\0" "${remove[@]}" | xargs -0 rm || die + local IFS=$'\n' + find ! -type d -printf "%P\n" \ + | grep -Fvx -e "${free_software[*]}" -e "${unknown_license[*]}" \ + | xargs -d '\n' rm || die + IFS=$' \t\n' fi echo "# Remove files that shall not be installed from this list." > ${PN}.conf @@ -250,23 +250,12 @@ src_prepare() { if use savedconfig; then restore_config ${PN}.conf - local file preserved_files=() remove=() - ebegin "Removing all files not listed in config" - while IFS= read -r file; do - # Ignore comments. - if [[ ${file} != "#"* ]]; then - preserved_files+=("${file}") - fi - done < ${PN}.conf || die - - while IFS= read -d "" -r file; do - has "${file}" "${preserved_files[@]}" || remove+=("${file}") - done < <(find * ! -type d ! -name ${PN}.conf -print0 || die) - if [[ ${#remove[@]} -gt 0 ]]; then - printf "%s\0" "${remove[@]}" | xargs -0 rm || die - fi - eend 0 + find ! -type d ! -name ${PN}.conf -printf "%P\n" \ + | grep -Fvx -f <(grep -v '^#' ${PN}.conf \ + || die "grep failed, empty config file?") \ + | xargs -d '\n' --no-run-if-empty rm + eend $? || die fi # remove empty directories, bug #396073