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:27:28 -0800
commitca1b7b3d12cfe74d5a0238d138094cd404b12ad0 (patch)
tree7af91dfef6c16cc0a8bc8b17b5a162e496e58b3e /sys-apps
parentsys-apps/portage: batch EPREFIX shebang sed calls with xargs (diff)
downloadgentoo-ca1b7b3d12cfe74d5a0238d138094cd404b12ad0.tar.gz
gentoo-ca1b7b3d12cfe74d5a0238d138094cd404b12ad0.tar.bz2
gentoo-ca1b7b3d12cfe74d5a0238d138094cd404b12ad0.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-3.0.16.ebuild10
1 files 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 0c20c5376262..0a278512cacb 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