commit:     1df2365983e9304c6482ba69d81b8675457a4566
Author:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 21 20:27:06 2024 +0000
Commit:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Sat Dec 21 20:27:06 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1df23659

sys-kernel/linux-firmware: savedconfig fixes inline with non-git version

Closes: https://bugs.gentoo.org/943848

Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>

 .../linux-firmware/linux-firmware-99999999.ebuild  | 36 ++++++++--------------
 1 file changed, 13 insertions(+), 23 deletions(-)

diff --git a/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild 
b/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild
index f49e8118b8be..a563075cac21 100644
--- a/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild
+++ b/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild
@@ -72,6 +72,9 @@ IDEPEND="
 "
 
 QA_PREBUILT="*"
+PATCHES=(
+    "${FILESDIR}"/${PN}-copy-firmware-r7.patch
+)
 
 pkg_pretend() {
        if use initramfs; then
@@ -231,6 +234,16 @@ src_install() {
 
        local FW_OPTIONS=( "-v" )
        git config --global --add safe.directory "${S}" || die
+       local files_to_keep=
+
+       if use savedconfig; then
+        if [[ -s "${S}/${PN}.conf" ]]; then
+            files_to_keep="${T}/files_to_keep.lst"
+            grep -v '^#' "${S}/${PN}.conf" 2>/dev/null > "${files_to_keep}" || 
die
+            [[ -s "${files_to_keep}" ]] || die "grep failed, empty config 
file?"
+            FW_OPTIONS+=( "--firmware-list" "${files_to_keep}" )
+        fi
+    fi
 
        if use compress-xz; then
                FW_OPTIONS+=( "--xz" )
@@ -296,29 +309,6 @@ src_install() {
        einfo "Removing broken symlinks ..."
        find * -xtype l -print -delete || die
 
-       if use savedconfig; then
-               if [[ -s "${S}/${PN}.conf" ]]; then
-                       local files_to_keep="${T}/files_to_keep.lst"
-                       grep -v '^#' "${S}/${PN}.conf" 2>/dev/null > 
"${files_to_keep}" || die
-                       [[ -s "${files_to_keep}" ]] || die "grep failed, empty 
config file?"
-
-                       einfo "Applying USE=savedconfig; Removing all files not 
listed in config ..."
-                       find ! -type d -printf "%P\n" \
-                               | grep -Fvx -f "${files_to_keep}" \
-                               | xargs -d '\n' --no-run-if-empty rm -v
-
-                       if [[ ${PIPESTATUS[0]} -ne 0 ]]; then
-                               die "Find failed to print installed files"
-                       elif [[ ${PIPESTATUS[1]} -eq 2 ]]; then
-                               # grep returns exit status 1 if no lines were 
selected
-                               # which is the case when we want to keep all 
files
-                               die "Grep failed to select files to keep"
-                       elif [[ ${PIPESTATUS[2]} -ne 0 ]]; then
-                               die "Failed to remove files not listed in 
config"
-                       fi
-               fi
-       fi
-
        # remove empty directories, bug #396073
        find -type d -empty -delete || die
 

Reply via email to