summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2021-03-06 14:06:07 -0800
committerZac Medico <zmedico@gentoo.org>2021-03-06 14:10:07 -0800
commitba6bc7e9a747ff24e4f45957ffd8c7a2de70d96b (patch)
tree2d50ee39500c2dc19582264bd930c281f22f2552 /sys-apps
parentdev-python/pyxattr: Remove old (diff)
downloadgentoo-ba6bc7e9a747ff24e4f45957ffd8c7a2de70d96b.tar.gz
gentoo-ba6bc7e9a747ff24e4f45957ffd8c7a2de70d96b.tar.bz2
gentoo-ba6bc7e9a747ff24e4f45957ffd8c7a2de70d96b.zip
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@gentoo.org>
Diffstat (limited to 'sys-apps')
-rw-r--r--sys-apps/portage/portage-9999.ebuild10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys-apps/portage/portage-9999.ebuild b/sys-apps/portage/portage-9999.ebuild
index f229af539a23..feff21265f7a 100644
--- a/sys-apps/portage/portage-9999.ebuild
+++ b/sys-apps/portage/portage-9999.ebuild
@@ -128,13 +128,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