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 3BD26138334 for ; Sun, 23 Dec 2018 13:15:36 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0EA4EE0863; Sun, 23 Dec 2018 13:15:35 +0000 (UTC) Received: from smtp.gentoo.org (dev.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 C2667E0863 for ; Sun, 23 Dec 2018 13:15:34 +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 B9256335C5D for ; Sun, 23 Dec 2018 13:15:32 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id D270B2A7 for ; Sun, 23 Dec 2018 13:15:30 +0000 (UTC) From: "Lars Wendler" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Lars Wendler" Message-ID: <1545570922.d9d822b5a8cb5c982247fb6871eef8b8467a05cb.polynomial-c@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-20181218.ebuild sys-kernel/linux-firmware/linux-firmware-99999999.ebuild X-VCS-Directories: sys-kernel/linux-firmware/ X-VCS-Committer: polynomial-c X-VCS-Committer-Name: Lars Wendler X-VCS-Revision: d9d822b5a8cb5c982247fb6871eef8b8467a05cb X-VCS-Branch: master Date: Sun, 23 Dec 2018 13:15:30 +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: 0053fb08-fc6d-4a50-b56e-3fe89469e669 X-Archives-Hash: 9ec0f2ce09a4105e94641adf5563ecc1 commit: d9d822b5a8cb5c982247fb6871eef8b8467a05cb Author: Arfrever Frehtes Taifersar Arahesis Apache Org> AuthorDate: Sat Dec 22 07:19:25 2018 +0000 Commit: Lars Wendler gentoo org> CommitDate: Sun Dec 23 13:15:22 2018 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d9d822b5 sys-kernel/linux-firmware: Fix building with USE="savedconfig". Replace 'sort' + 'uniq -u' hack with BASH loops. Fixes: https://bugs.gentoo.org/673494 Signed-off-by: Arfrever Frehtes Taifersar Arahesis Apache.Org> Signed-off-by: Lars Wendler gentoo.org> .../linux-firmware/linux-firmware-20181218.ebuild | 29 +++++++++++++++++--- .../linux-firmware/linux-firmware-99999999.ebuild | 31 ++++++++++++++++++---- 2 files changed, 51 insertions(+), 9 deletions(-) diff --git a/sys-kernel/linux-firmware/linux-firmware-20181218.ebuild b/sys-kernel/linux-firmware/linux-firmware-20181218.ebuild index ae8305a2c90..d7eafdff4cd 100644 --- a/sys-kernel/linux-firmware/linux-firmware-20181218.ebuild +++ b/sys-kernel/linux-firmware/linux-firmware-20181218.ebuild @@ -84,10 +84,31 @@ src_prepare() { if use savedconfig; then restore_config ${PN}.conf ebegin "Removing all files not listed in config" - find * \( \! -type d -and \! -name ${PN}.conf \) \ - | sort ${PN}.conf ${PN}.conf - \ - | uniq -u | xargs -r rm - eend $? || die + + local file delete_file preserved_file preserved_files=() + + 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 + delete_file=true + for preserved_file in "${preserved_files[@]}"; do + if [[ "${file}" == "${preserved_file}" ]]; then + delete_file=false + fi + done + + if ${delete_file}; then + rm "${file}" || die + fi + done < <(find * \( \! -type d -and \! -name ${PN}.conf \) -print0 || die) + + eend || die + # remove empty directories, bug #396073 find -type d -empty -delete || die fi diff --git a/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild b/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild index e7b169ebe51..c158759fb1d 100644 --- a/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild +++ b/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2018 Gentoo Foundation +# Copyright 1999-2018 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI="6" @@ -84,10 +84,31 @@ src_prepare() { if use savedconfig; then restore_config ${PN}.conf ebegin "Removing all files not listed in config" - find * \( \! -type d -and \! -name ${PN}.conf \) \ - | sort ${PN}.conf ${PN}.conf - \ - | uniq -u | xargs -r rm - eend $? || die + + local file delete_file preserved_file preserved_files=() + + 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 + delete_file=true + for preserved_file in "${preserved_files[@]}"; do + if [[ "${file}" == "${preserved_file}" ]]; then + delete_file=false + fi + done + + if ${delete_file}; then + rm "${file}" || die + fi + done < <(find * \( \! -type d -and \! -name ${PN}.conf \) -print0 || die) + + eend || die + # remove empty directories, bug #396073 find -type d -empty -delete || die fi