commit: ca1b7b3d12cfe74d5a0238d138094cd404b12ad0
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 6 22:06:07 2021 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Mar 6 22:27:28 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ca1b7b3d
sys-apps/portage: batch EPREFIX shebang sed calls with xargs
Batch EPREFIX shebang sed calls with xargs, and also use
find -executable since we only care about executables.
Package-Manager: Portage-3.0.16, Repoman-3.0.2
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
sys-apps/portage/portage-3.0.16.ebuild | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/sys-apps/portage/portage-3.0.16.ebuild
b/sys-apps/portage/portage-3.0.16.ebuild
index 0c20c537626..0a278512cac 100644
--- a/sys-apps/portage/portage-3.0.16.ebuild
+++ b/sys-apps/portage/portage-3.0.16.ebuild
@@ -137,13 +137,17 @@ python_prepare_all() {
-w "/_BINARY/" lib/portage/const.py
einfo "Prefixing shebangs ..."
+ > "${T}/shebangs" || die
while read -r -d $'\0' ; do
local shebang=$(head -n1 "$REPLY")
if [[ ${shebang} == "#!"* && ! ${shebang} ==
"#!${EPREFIX}/"* ]] ; then
- sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:"
"$REPLY" || \
- die "sed failed"
+ echo "${REPLY}" >> "${T}/shebangs" || die
fi
- done < <(find . -type f ! -name etc-update -print0)
+ done < <(find . -type f -executable ! -name etc-update -print0)
+
+ if [[ -s ${T}/shebangs ]]; then
+ xargs sed -i -e "1s:^#!:#!${EPREFIX}:" <
"${T}/shebangs" || die "sed failed"
+ fi
einfo "Adjusting make.globals, repos.conf and etc-update ..."
hprefixify cnf/{make.globals,repos.conf} bin/etc-update