sys-apps/portage: fix etc-update shebang for prefix
authorZac Medico <zmedico@gentoo.org>
Wed, 29 May 2019 19:36:02 +0000 (12:36 -0700)
committerZac Medico <zmedico@gentoo.org>
Wed, 29 May 2019 19:37:31 +0000 (12:37 -0700)
Reported-by: dingyuc@126.com
Closes: https://bugs.gentoo.org/686940
Package-Manager: Portage-2.3.67, Repoman-2.3.13
Signed-off-by: Zac Medico <zmedico@gentoo.org>
sys-apps/portage/portage-2.3.62-r2.ebuild
sys-apps/portage/portage-2.3.66-r1.ebuild
sys-apps/portage/portage-2.3.67.ebuild
sys-apps/portage/portage-9999.ebuild

index 17b1506e277da10997236fec8ec1bd93a4ae1ec2..6774b1d55632d461959ee3861bfed659ded53e1b 100644 (file)
@@ -150,7 +150,7 @@ python_prepare_all() {
                                sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \
                                        die "sed failed"
                        fi
-               done < <(find . -type f -print0)
+               done < <(find . -type f ! -name etc-update -print0)
 
                einfo "Adjusting make.globals, repos.conf and etc-update ..."
                hprefixify cnf/{make.globals,repos.conf} bin/etc-update
index de238f425d5624af2df554cd71e893c9b560ebbe..1a381bdcdbc744fdb1372d6b1d4166963cd1a43d 100644 (file)
@@ -150,7 +150,7 @@ python_prepare_all() {
                                sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \
                                        die "sed failed"
                        fi
-               done < <(find . -type f -print0)
+               done < <(find . -type f ! -name etc-update -print0)
 
                einfo "Adjusting make.globals, repos.conf and etc-update ..."
                hprefixify cnf/{make.globals,repos.conf} bin/etc-update
index f186a1acf1272c6a48453aac8f050eedc4c3e669..841947dcfff768bd4d6d5014f23e6b45173a2033 100644 (file)
@@ -148,7 +148,7 @@ python_prepare_all() {
                                sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \
                                        die "sed failed"
                        fi
-               done < <(find . -type f -print0)
+               done < <(find . -type f ! -name etc-update -print0)
 
                einfo "Adjusting make.globals, repos.conf and etc-update ..."
                hprefixify cnf/{make.globals,repos.conf} bin/etc-update
index aa44b4b671c1661f06b7bb17ffae8806527f87d3..e7c1e8c638fea4f244ddbc99aba470078a8aeed9 100644 (file)
@@ -10,7 +10,7 @@ PYTHON_COMPAT=(
 )
 PYTHON_REQ_USE='bzip2(+),threads(+)'
 
-inherit distutils-r1 git-r3 linux-info systemd
+inherit distutils-r1 git-r3 linux-info systemd prefix
 
 DESCRIPTION="Portage is the package management and distribution system for Gentoo"
 HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Portage"
@@ -136,14 +136,8 @@ python_prepare_all() {
 
        if [[ -n ${EPREFIX} ]] ; then
                einfo "Setting portage.const.EPREFIX ..."
-               sed -e "s|^\(SANDBOX_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/sandbox\"\)|\\1${EPREFIX}\\2|" \
-                       -e "s|^\(FAKEROOT_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/fakeroot\"\)|\\1${EPREFIX}\\2|" \
-                       -e "s|^\(BASH_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/bash\"\)|\\1${EPREFIX}\\2|" \
-                       -e "s|^\(MOVE_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/mv\"\)|\\1${EPREFIX}\\2|" \
-                       -e "s|^\(PRELINK_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/sbin/prelink\"\)|\\1${EPREFIX}\\2|" \
-                       -e "s|^\(EPREFIX[[:space:]]*=[[:space:]]*\"\).*|\\1${EPREFIX}\"|" \
-                       -i lib/portage/const.py || \
-                       die "Failed to patch portage.const.EPREFIX"
+               hprefixify -e "s|^(EPREFIX[[:space:]]*=[[:space:]]*\").*|\1${EPREFIX}\"|" \
+                       -w "/_BINARY/" lib/portage/const.py
 
                einfo "Prefixing shebangs ..."
                while read -r -d $'\0' ; do
@@ -152,17 +146,11 @@ python_prepare_all() {
                                sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \
                                        die "sed failed"
                        fi
-               done < <(find . -type f -print0)
+               done < <(find . -type f ! -name etc-update -print0)
 
-               einfo "Adjusting make.globals ..."
-               sed -e "s|\(/usr/portage\)|${EPREFIX}\\1|" \
-                       -e "s|^\(PORTAGE_TMPDIR=\"\)\(/var/tmp\"\)|\\1${EPREFIX}\\2|" \
-                       -i cnf/make.globals || die "sed failed"
+               einfo "Adjusting make.globals, repos.conf and etc-update ..."
+               hprefixify cnf/{make.globals,repos.conf} bin/etc-update
 
-               einfo "Adjusting repos.conf ..."
-               sed -e "s|^\(location = \)\(/usr/portage\)|\\1${EPREFIX}\\2|" \
-                       -e "s|^\(sync-openpgp-key-path = \)\(.*\)|\\1${EPREFIX}\\2|" \
-                       -i cnf/repos.conf || die "sed failed"
                if prefix-guest ; then
                        sed -e "s|^\(main-repo = \).*|\\1gentoo_prefix|" \
                                -e "s|^\\[gentoo\\]|[gentoo_prefix]|" \