diff options
author | Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org> | 2018-12-22 08:19:25 +0100 |
---|---|---|
committer | Lars Wendler <polynomial-c@gentoo.org> | 2018-12-23 14:15:22 +0100 |
commit | d9d822b5a8cb5c982247fb6871eef8b8467a05cb (patch) | |
tree | c41698a2a6691399591b3ef1f6a8e4631fe27cf5 /sys-kernel | |
parent | sys-auth/pam_skey: Fix README.gentoo message. (diff) | |
download | gentoo-d9d822b5a8cb5c982247fb6871eef8b8467a05cb.tar.gz gentoo-d9d822b5a8cb5c982247fb6871eef8b8467a05cb.tar.bz2 gentoo-d9d822b5a8cb5c982247fb6871eef8b8467a05cb.zip |
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 <Arfrever@Apache.Org>
Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
Diffstat (limited to 'sys-kernel')
-rw-r--r-- | sys-kernel/linux-firmware/linux-firmware-20181218.ebuild | 29 | ||||
-rw-r--r-- | sys-kernel/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 ae8305a2c901..d7eafdff4cd9 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 e7b169ebe516..c158759fb1da 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 |