commit:     91b1222f17bb1f28e3151b1e00d2ddb22645e00a
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 12 12:29:36 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Aug 12 12:32:26 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=91b1222f

sci-geosciences/gpsd: fix USE=python install

* Add missing `assert` which reveals one problem where the directory
is trashed after one impl, which is a problem given the package
is multi impl.

* grep for the known-bad shebang before fixing so we don't try to touch ELF.

Closes: https://bugs.gentoo.org/937612
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../gpsd/{gpsd-3.25-r1.ebuild => gpsd-3.25-r2.ebuild}   | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/sci-geosciences/gpsd/gpsd-3.25-r1.ebuild 
b/sci-geosciences/gpsd/gpsd-3.25-r2.ebuild
similarity index 94%
rename from sci-geosciences/gpsd/gpsd-3.25-r1.ebuild
rename to sci-geosciences/gpsd/gpsd-3.25-r2.ebuild
index f7f785b3ea35..615d6bafd6f9 100644
--- a/sci-geosciences/gpsd/gpsd-3.25-r1.ebuild
+++ b/sci-geosciences/gpsd/gpsd-3.25-r2.ebuild
@@ -213,10 +213,11 @@ python_test() {
        :;
 }
 
-python_install(){
-       mkdir -p "${T}/scripts" || die
-       grep -Rl "${D}/usr/bin" -e "/usr/bin/env python" | xargs mv -t 
"${T}/scripts"
-       python_doscript "${T}"/scripts/*
+python_install() {
+       while read -d '' -r file ; do
+               grep -q "#!/usr/bin/env python" "${file}" && python_doscript 
"${file}"
+       done < <(find "${T}"/scripts -type f -print0)
+
        distutils-r1_python_install
 }
 
@@ -231,7 +232,13 @@ src_install() {
        find "${D}"/python-discard/ -type d -delete
        # Install correct multi-python copy
        pushd "${P}" || die
-       use python && distutils-r1_src_install
+       if use python ; then
+               mkdir -p "${T}/scripts" || die
+               grep -Rl "${D}/usr/bin" -e "/usr/bin/env python" | xargs cp -t 
"${T}/scripts"
+               assert "Moving Python scripts failed"
+
+               distutils-r1_src_install
+       fi
        popd || die
 }
 

Reply via email to