public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:prefix commit in: lib/portage/package/ebuild/_config/, bin/ebuild-helpers/xattr/, ...
@ 2022-07-24 19:27 Fabian Groffen
  0 siblings, 0 replies; only message in thread
From: Fabian Groffen @ 2022-07-24 19:27 UTC (permalink / raw
  To: gentoo-commits

commit:     5773e5e7ec9281ca84286465f6627765d0b08ed6
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 24 19:18:54 2022 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Jul 24 19:18:54 2022 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=5773e5e7

*: attempt to reduce differences with master

- use /usr/bin/env python shebang with py files
- use /usr/bin/env bash with shell files (contrast to /bin/bash
  hardcoding in master)
- tag all diff blocks with PREFIX LOCAL

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 bin/archive-conf                                   |  2 +-
 bin/bashrc-functions.sh                            |  2 +-
 bin/binhost-snapshot                               |  2 +-
 bin/check-implicit-pointer-usage.py                |  2 +-
 bin/chmod-lite.py                                  |  2 +-
 bin/chpathtool.py                                  |  2 +-
 bin/clean_locks                                    |  2 +-
 bin/dispatch-conf                                  |  2 +-
 bin/dohtml.py                                      |  2 +-
 bin/eapi.sh                                        |  2 +-
 bin/ebuild                                         |  2 +-
 bin/ebuild-helpers/bsd/sed                         |  2 +-
 bin/ebuild-helpers/die                             |  2 +-
 bin/ebuild-helpers/dobin                           |  2 +-
 bin/ebuild-helpers/doconfd                         |  2 +-
 bin/ebuild-helpers/dodir                           |  2 +-
 bin/ebuild-helpers/dodoc                           |  2 +-
 bin/ebuild-helpers/doenvd                          |  2 +-
 bin/ebuild-helpers/doexe                           |  2 +-
 bin/ebuild-helpers/dohard                          |  2 +-
 bin/ebuild-helpers/doheader                        |  2 +-
 bin/ebuild-helpers/dohtml                          |  4 ++-
 bin/ebuild-helpers/doinfo                          |  2 +-
 bin/ebuild-helpers/doinitd                         |  2 +-
 bin/ebuild-helpers/doins                           |  2 +-
 bin/ebuild-helpers/dolib                           |  2 +-
 bin/ebuild-helpers/dolib.a                         |  2 +-
 bin/ebuild-helpers/dolib.so                        |  2 +-
 bin/ebuild-helpers/doman                           |  2 +-
 bin/ebuild-helpers/domo                            |  2 +-
 bin/ebuild-helpers/dosbin                          |  2 +-
 bin/ebuild-helpers/dosed                           |  2 +-
 bin/ebuild-helpers/dosym                           |  2 +-
 bin/ebuild-helpers/elog                            |  2 +-
 bin/ebuild-helpers/emake                           |  3 +-
 bin/ebuild-helpers/fowners                         |  2 +-
 bin/ebuild-helpers/fperms                          |  2 +-
 bin/ebuild-helpers/keepdir                         |  2 +-
 bin/ebuild-helpers/newins                          |  2 +-
 bin/ebuild-helpers/portageq                        |  4 ++-
 bin/ebuild-helpers/prepall                         |  2 +-
 bin/ebuild-helpers/prepalldocs                     |  2 +-
 bin/ebuild-helpers/prepallinfo                     |  2 +-
 bin/ebuild-helpers/prepallman                      |  2 +-
 bin/ebuild-helpers/prepallstrip                    |  2 +-
 bin/ebuild-helpers/prepinfo                        |  2 +-
 bin/ebuild-helpers/prepman                         |  2 +-
 bin/ebuild-helpers/prepstrip                       |  2 +-
 bin/ebuild-helpers/unprivileged/chown              |  2 +-
 bin/ebuild-helpers/xattr/install                   |  2 +-
 bin/ebuild-ipc.py                                  |  2 +-
 bin/ebuild-pyhelper                                |  6 ++--
 bin/ebuild.sh                                      |  2 +-
 bin/emaint                                         |  2 +-
 bin/emerge                                         |  2 +-
 bin/emerge-webrsync                                |  3 +-
 bin/emirrordist                                    |  2 +-
 bin/env-update                                     |  2 +-
 bin/etc-update                                     |  3 +-
 bin/filter-bash-environment.py                     |  2 +-
 bin/fixpackages                                    |  2 +-
 bin/glsa-check                                     |  2 +-
 bin/helper-functions.sh                            |  2 +-
 bin/install-qa-check.d/05prefix                    | 37 +++++++++++++---------
 bin/install-qa-check.d/80multilib-strict           |  1 +
 bin/install-qa-check.d/90gcc-warnings              |  1 +
 bin/install.py                                     |  2 +-
 bin/isolated-functions.sh                          |  5 ++-
 bin/lock-helper.py                                 |  2 +-
 bin/misc-functions.sh                              |  5 +--
 bin/phase-functions.sh                             |  6 +++-
 bin/phase-helpers.sh                               |  2 +-
 bin/portageq                                       |  2 +-
 bin/quickpkg                                       |  2 +-
 bin/readpecoff                                     |  2 +-
 bin/regenworld                                     |  2 +-
 bin/save-ebuild-env.sh                             |  2 +-
 bin/xattr-helper.py                                |  2 +-
 bin/xpak-helper.py                                 |  2 +-
 cnf/make.conf.example                              | 10 +++---
 lib/_emerge/actions.py                             | 18 +++++++----
 lib/_emerge/depgraph.py                            |  2 ++
 lib/_emerge/emergelog.py                           |  2 ++
 lib/_emerge/getloadavg.py                          |  1 -
 lib/portage/const.py                               | 10 +++---
 lib/portage/data.py                                | 13 ++++----
 lib/portage/dbapi/vartree.py                       |  6 ++++
 .../package/ebuild/_config/special_env_vars.py     |  3 +-
 lib/portage/package/ebuild/config.py               |  5 +--
 lib/portage/package/ebuild/doebuild.py             |  5 ++-
 lib/portage/process.py                             |  7 +++-
 .../test_lazy_import_portage_baseline.py           |  2 +-
 lib/portage/tests/runTests.py                      |  4 ++-
 lib/portage/util/__init__.py                       |  1 +
 lib/portage/util/_info_files.py                    |  1 +
 lib/portage/util/_pty.py                           |  2 ++
 lib/portage/util/futures/retry.py                  |  2 +-
 misc/emerge-delta-webrsync                         |  2 +-
 98 files changed, 183 insertions(+), 125 deletions(-)

diff --git a/bin/archive-conf b/bin/archive-conf
index ecc8d8a1c..3f7d186fe 100755
--- a/bin/archive-conf
+++ b/bin/archive-conf
@@ -1,4 +1,4 @@
-#!@PREFIX_PORTAGE_PYTHON@
+#!/usr/bin/env python
 # Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/bashrc-functions.sh b/bin/bashrc-functions.sh
index f01f5c5d0..a45587b28 100644
--- a/bin/bashrc-functions.sh
+++ b/bin/bashrc-functions.sh
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/binhost-snapshot b/bin/binhost-snapshot
index 0788e2704..4022cb32c 100755
--- a/bin/binhost-snapshot
+++ b/bin/binhost-snapshot
@@ -1,4 +1,4 @@
-#!@PREFIX_PORTAGE_PYTHON@
+#!/usr/bin/env python
 # Copyright 2010-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/check-implicit-pointer-usage.py b/bin/check-implicit-pointer-usage.py
index 1457a3c9f..06b666c88 100755
--- a/bin/check-implicit-pointer-usage.py
+++ b/bin/check-implicit-pointer-usage.py
@@ -1,4 +1,4 @@
-#!@PREFIX_PORTAGE_PYTHON@
+#!/usr/bin/env python
 
 # Ripped from HP and updated from Debian
 # Update by Gentoo to support unicode output

diff --git a/bin/chmod-lite.py b/bin/chmod-lite.py
index baec75c40..517a55bd9 100755
--- a/bin/chmod-lite.py
+++ b/bin/chmod-lite.py
@@ -1,4 +1,4 @@
-#!@PREFIX_PORTAGE_PYTHON@
+#!/usr/bin/env python
 # Copyright 2015 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/chpathtool.py b/bin/chpathtool.py
index 1b30bc272..d658e5012 100755
--- a/bin/chpathtool.py
+++ b/bin/chpathtool.py
@@ -1,4 +1,4 @@
-#!@PREFIX_PORTAGE_PYTHON@
+#!/usr/bin/env python
 # Copyright 2011-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/clean_locks b/bin/clean_locks
index 4ff410aa3..b80213911 100755
--- a/bin/clean_locks
+++ b/bin/clean_locks
@@ -1,4 +1,4 @@
-#!@PREFIX_PORTAGE_PYTHON@
+#!/usr/bin/env python
 # Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/dispatch-conf b/bin/dispatch-conf
index 52f065b91..9490197d3 100755
--- a/bin/dispatch-conf
+++ b/bin/dispatch-conf
@@ -1,4 +1,4 @@
-#!@PREFIX_PORTAGE_PYTHON@
+#!/usr/bin/env python
 # Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/dohtml.py b/bin/dohtml.py
index 198d63799..7aebd2af7 100755
--- a/bin/dohtml.py
+++ b/bin/dohtml.py
@@ -1,4 +1,4 @@
-#!@PREFIX_PORTAGE_PYTHON@
+#!/usr/bin/env python
 # Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/eapi.sh b/bin/eapi.sh
index 59ce6d9de..d90c3cd2e 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 2012-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild b/bin/ebuild
index 9cf4afd5a..546ab9d1c 100755
--- a/bin/ebuild
+++ b/bin/ebuild
@@ -1,4 +1,4 @@
-#!@PREFIX_PORTAGE_PYTHON@
+#!/usr/bin/env python
 # Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/bsd/sed b/bin/ebuild-helpers/bsd/sed
index fd8dc2183..4bc70f3a8 100755
--- a/bin/ebuild-helpers/bsd/sed
+++ b/bin/ebuild-helpers/bsd/sed
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 2007-2015 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/die b/bin/ebuild-helpers/die
index 00b67901f..5348acbd3 100755
--- a/bin/ebuild-helpers/die
+++ b/bin/ebuild-helpers/die
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 2010 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/dobin b/bin/ebuild-helpers/dobin
index 0f0518aba..8abcc713c 100755
--- a/bin/ebuild-helpers/dobin
+++ b/bin/ebuild-helpers/dobin
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/doconfd b/bin/ebuild-helpers/doconfd
index a1b8146f7..761fd7309 100755
--- a/bin/ebuild-helpers/doconfd
+++ b/bin/ebuild-helpers/doconfd
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/dodir b/bin/ebuild-helpers/dodir
index 4d309e4b1..4fb113819 100755
--- a/bin/ebuild-helpers/dodir
+++ b/bin/ebuild-helpers/dodir
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/dodoc b/bin/ebuild-helpers/dodoc
index 9fdb6495a..af3764b7e 100755
--- a/bin/ebuild-helpers/dodoc
+++ b/bin/ebuild-helpers/dodoc
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/doenvd b/bin/ebuild-helpers/doenvd
index 1d2c90b8c..d801646e3 100755
--- a/bin/ebuild-helpers/doenvd
+++ b/bin/ebuild-helpers/doenvd
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/doexe b/bin/ebuild-helpers/doexe
index 5fa8f058d..154f5daca 100755
--- a/bin/ebuild-helpers/doexe
+++ b/bin/ebuild-helpers/doexe
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/dohard b/bin/ebuild-helpers/dohard
index 1dd2eb582..4ee1ba258 100755
--- a/bin/ebuild-helpers/dohard
+++ b/bin/ebuild-helpers/dohard
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/doheader b/bin/ebuild-helpers/doheader
index bf11ecdb0..6ca423d6d 100755
--- a/bin/ebuild-helpers/doheader
+++ b/bin/ebuild-helpers/doheader
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/dohtml b/bin/ebuild-helpers/dohtml
index a60dbdab8..e061bc173 100755
--- a/bin/ebuild-helpers/dohtml
+++ b/bin/ebuild-helpers/dohtml
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 2009-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
@@ -16,8 +16,10 @@ fi
 # Use safe cwd, avoiding unsafe import for bug #469338.
 export __PORTAGE_HELPER_CWD=${PWD}
 cd "${PORTAGE_PYM_PATH}" || die
+# BEGIN PREFIX LOCAL: use Prefix Python fallback
 PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
 	"${PORTAGE_PYTHON:-@PREFIX_PORTAGE_PYTHON@}" "$PORTAGE_BIN_PATH/dohtml.py" "$@"
+# END PREFIX LOCAL
 
 ret=$?
 # Restore cwd for display by __helpers_die

diff --git a/bin/ebuild-helpers/doinfo b/bin/ebuild-helpers/doinfo
index e261e9e74..cf4d42b1a 100755
--- a/bin/ebuild-helpers/doinfo
+++ b/bin/ebuild-helpers/doinfo
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/doinitd b/bin/ebuild-helpers/doinitd
index ad8bb0347..fbb94d1f6 100755
--- a/bin/ebuild-helpers/doinitd
+++ b/bin/ebuild-helpers/doinitd
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/doins b/bin/ebuild-helpers/doins
index 825a421af..8dbbe774a 100755
--- a/bin/ebuild-helpers/doins
+++ b/bin/ebuild-helpers/doins
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/dolib b/bin/ebuild-helpers/dolib
index 049088de7..c31442a8e 100755
--- a/bin/ebuild-helpers/dolib
+++ b/bin/ebuild-helpers/dolib
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/dolib.a b/bin/ebuild-helpers/dolib.a
index f45aed3e6..00fd53804 100755
--- a/bin/ebuild-helpers/dolib.a
+++ b/bin/ebuild-helpers/dolib.a
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/dolib.so b/bin/ebuild-helpers/dolib.so
index 2272679c8..5e53a85e7 100755
--- a/bin/ebuild-helpers/dolib.so
+++ b/bin/ebuild-helpers/dolib.so
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/doman b/bin/ebuild-helpers/doman
index bfd7356a0..c2418ce40 100755
--- a/bin/ebuild-helpers/doman
+++ b/bin/ebuild-helpers/doman
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/domo b/bin/ebuild-helpers/domo
index fb1475470..474bb7e1d 100755
--- a/bin/ebuild-helpers/domo
+++ b/bin/ebuild-helpers/domo
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/dosbin b/bin/ebuild-helpers/dosbin
index e92286088..1ff253bb1 100755
--- a/bin/ebuild-helpers/dosbin
+++ b/bin/ebuild-helpers/dosbin
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/dosed b/bin/ebuild-helpers/dosed
index 44752f54e..d3c249352 100755
--- a/bin/ebuild-helpers/dosed
+++ b/bin/ebuild-helpers/dosed
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/dosym b/bin/ebuild-helpers/dosym
index d8b340723..69a4a1ebe 100755
--- a/bin/ebuild-helpers/dosym
+++ b/bin/ebuild-helpers/dosym
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/elog b/bin/ebuild-helpers/elog
index f57fce4bd..e878a3da2 100755
--- a/bin/ebuild-helpers/elog
+++ b/bin/ebuild-helpers/elog
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2009 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/emake b/bin/ebuild-helpers/emake
index cca9cb63b..21da85845 100755
--- a/bin/ebuild-helpers/emake
+++ b/bin/ebuild-helpers/emake
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2015 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 #
@@ -12,6 +12,7 @@
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
 
 cmd=(
+    # PREFIX LOCAL: force SHELL to be set (don't use possibly ancient /bin/sh)
 	${MAKE:-make} SHELL="${BASH:-/bin/bash}" ${MAKEOPTS} "$@" ${EXTRA_EMAKE}
 )
 

diff --git a/bin/ebuild-helpers/fowners b/bin/ebuild-helpers/fowners
index 01a89dc1e..c6ed36ed3 100755
--- a/bin/ebuild-helpers/fowners
+++ b/bin/ebuild-helpers/fowners
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/fperms b/bin/ebuild-helpers/fperms
index 9780e6ca8..9620cc06a 100755
--- a/bin/ebuild-helpers/fperms
+++ b/bin/ebuild-helpers/fperms
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/keepdir b/bin/ebuild-helpers/keepdir
index 9b8986a5e..eb969b11b 100755
--- a/bin/ebuild-helpers/keepdir
+++ b/bin/ebuild-helpers/keepdir
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/newins b/bin/ebuild-helpers/newins
index 9b31a2ccf..d05d688ac 100755
--- a/bin/ebuild-helpers/newins
+++ b/bin/ebuild-helpers/newins
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/portageq b/bin/ebuild-helpers/portageq
index 47640c5a8..2c97a7481 100755
--- a/bin/ebuild-helpers/portageq
+++ b/bin/ebuild-helpers/portageq
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 2009-2015 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
@@ -15,9 +15,11 @@ for path in ${PATH}; do
 	[[ -x ${path}/${scriptname} ]] || continue
 	[[ ${path} == */portage/*/ebuild-helpers* ]] && continue
 	[[ ${path}/${scriptname} -ef ${scriptpath} ]] && continue
+	# BEGIN PREFIX LOCAL: use Prefix Python fallback
 	PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
 		exec "${PORTAGE_PYTHON:-@PREFIX_PORTAGE_PYTHON@}" \
 			"${path}/${scriptname}" "$@"
+	# END PREFIX LOCAL
 done
 
 unset IFS

diff --git a/bin/ebuild-helpers/prepall b/bin/ebuild-helpers/prepall
index 0251e7948..6af94db03 100755
--- a/bin/ebuild-helpers/prepall
+++ b/bin/ebuild-helpers/prepall
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/prepalldocs b/bin/ebuild-helpers/prepalldocs
index 0251e7948..6af94db03 100755
--- a/bin/ebuild-helpers/prepalldocs
+++ b/bin/ebuild-helpers/prepalldocs
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/prepallinfo b/bin/ebuild-helpers/prepallinfo
index 0251e7948..6af94db03 100755
--- a/bin/ebuild-helpers/prepallinfo
+++ b/bin/ebuild-helpers/prepallinfo
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/prepallman b/bin/ebuild-helpers/prepallman
index 0251e7948..6af94db03 100755
--- a/bin/ebuild-helpers/prepallman
+++ b/bin/ebuild-helpers/prepallman
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/prepallstrip b/bin/ebuild-helpers/prepallstrip
index 40764fc30..2bf567634 100755
--- a/bin/ebuild-helpers/prepallstrip
+++ b/bin/ebuild-helpers/prepallstrip
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/prepinfo b/bin/ebuild-helpers/prepinfo
index e448ac926..e771c97aa 100755
--- a/bin/ebuild-helpers/prepinfo
+++ b/bin/ebuild-helpers/prepinfo
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/prepman b/bin/ebuild-helpers/prepman
index 6fab36e0b..871fd589b 100755
--- a/bin/ebuild-helpers/prepman
+++ b/bin/ebuild-helpers/prepman
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip
index 4a899ee1a..9b523517c 100755
--- a/bin/ebuild-helpers/prepstrip
+++ b/bin/ebuild-helpers/prepstrip
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/unprivileged/chown b/bin/ebuild-helpers/unprivileged/chown
index 54174cc6c..572664324 100755
--- a/bin/ebuild-helpers/unprivileged/chown
+++ b/bin/ebuild-helpers/unprivileged/chown
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 2012-2015 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-helpers/xattr/install b/bin/ebuild-helpers/xattr/install
index b1719bcaf..ebc68645e 100755
--- a/bin/ebuild-helpers/xattr/install
+++ b/bin/ebuild-helpers/xattr/install
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 2013-2015 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/ebuild-ipc.py b/bin/ebuild-ipc.py
index 4a6a9468a..bc5dda27d 100755
--- a/bin/ebuild-ipc.py
+++ b/bin/ebuild-ipc.py
@@ -1,4 +1,4 @@
-#!@PREFIX_PORTAGE_PYTHON@
+#!/usr/bin/env python
 # Copyright 2010-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 #

diff --git a/bin/ebuild-pyhelper b/bin/ebuild-pyhelper
index dbddd6e2a..29187adfb 100755
--- a/bin/ebuild-pyhelper
+++ b/bin/ebuild-pyhelper
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 2010-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
@@ -13,8 +13,10 @@ fi
 cd "${PORTAGE_PYM_PATH}" || exit 1
 for path in "${PORTAGE_BIN_PATH}/${0##*/}"{.py,}; do
 	if [[ -x "${path}" ]]; then
+	    # BEGIN PREFIX LOCAL: use Prefix Python fallback
 		PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
-			exec "${PORTAGE_PYTHON:-@PREFIX_PORTAGE_PYTHON@/usr/bin/python}" "${path}" "$@"
+			exec "${PORTAGE_PYTHON:-@PREFIX_PORTAGE_PYTHON@}" "${path}" "$@"
+		# END PREFIX LOCAL
 	fi
 done
 echo "File not found: ${path}" >&2

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 41b193860..6bb5d45b7 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/emaint b/bin/emaint
index 38a2c6896..b9a129ed0 100755
--- a/bin/emaint
+++ b/bin/emaint
@@ -1,4 +1,4 @@
-#!@PREFIX_PORTAGE_PYTHON@
+#!/usr/bin/env python
 # Copyright 2005-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/emerge b/bin/emerge
index 9a0a570b5..d1a8d9f52 100755
--- a/bin/emerge
+++ b/bin/emerge
@@ -1,4 +1,4 @@
-#!@PREFIX_PORTAGE_PYTHON@
+#!/usr/bin/env python
 # Copyright 2006-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync
index 6ac7e3328..85a4d15d7 100755
--- a/bin/emerge-webrsync
+++ b/bin/emerge-webrsync
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # Author: Karl Trygve Kalleberg <karltk@gentoo.org>
@@ -46,6 +46,7 @@ else
 	eecho "could not find 'portageq'; aborting"
 	exit 1
 fi
+# PREFIX LOCAL: retrieve PORTAGE_USER/PORTAGE_GROUP
 eval "$("${portageq}" envvar -v DISTDIR EPREFIX FEATURES \
 	FETCHCOMMAND GENTOO_MIRRORS \
 	PORTAGE_BIN_PATH PORTAGE_CONFIGROOT PORTAGE_GPG_DIR \

diff --git a/bin/emirrordist b/bin/emirrordist
index 36bc7611a..9f8db8292 100755
--- a/bin/emirrordist
+++ b/bin/emirrordist
@@ -1,4 +1,4 @@
-#!@PREFIX_PORTAGE_PYTHON@
+#!/usr/bin/env python
 # Copyright 2013-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/env-update b/bin/env-update
index 7f1ae90ab..8e597b03d 100755
--- a/bin/env-update
+++ b/bin/env-update
@@ -1,4 +1,4 @@
-#!@PREFIX_PORTAGE_PYTHON@
+#!/usr/bin/env python
 # Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/etc-update b/bin/etc-update
index 773db2daa..bf5f93ec7 100755
--- a/bin/etc-update
+++ b/bin/etc-update
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
@@ -32,6 +32,7 @@ get_config() {
 		"${PORTAGE_CONFIGROOT}"etc/etc-update.conf)
 }
 
+# PREFIX LOCAL: use os-release from Prefix
 OS_RELEASE_POSSIBLE_IDS=$(source "@PORTAGE_EPREFIX@"/etc/os-release >/dev/null 2>&1; echo ":${ID}:${ID_LIKE//[[:space:]]/:}:")
 
 case ${OS_RELEASE_POSSIBLE_IDS} in

diff --git a/bin/filter-bash-environment.py b/bin/filter-bash-environment.py
index 09a45e509..86cb22948 100755
--- a/bin/filter-bash-environment.py
+++ b/bin/filter-bash-environment.py
@@ -1,4 +1,4 @@
-#!@PREFIX_PORTAGE_PYTHON@
+#!/usr/bin/env python
 # Copyright 1999-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/fixpackages b/bin/fixpackages
index ae28b216c..6f78b174d 100755
--- a/bin/fixpackages
+++ b/bin/fixpackages
@@ -1,4 +1,4 @@
-#!@PREFIX_PORTAGE_PYTHON@
+#!/usr/bin/env python
 # Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/glsa-check b/bin/glsa-check
index 2b2976100..431590cf8 100755
--- a/bin/glsa-check
+++ b/bin/glsa-check
@@ -1,4 +1,4 @@
-#!@PREFIX_PORTAGE_PYTHON@
+#!/usr/bin/env python
 # Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/helper-functions.sh b/bin/helper-functions.sh
index 34cbc3eec..a7f99197a 100644
--- a/bin/helper-functions.sh
+++ b/bin/helper-functions.sh
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/install-qa-check.d/05prefix b/bin/install-qa-check.d/05prefix
index 4da773f6a..9b859bf8a 100644
--- a/bin/install-qa-check.d/05prefix
+++ b/bin/install-qa-check.d/05prefix
@@ -3,18 +3,18 @@
 install_qa_check_prefix() {
 	[[ ${ED} == ${D} ]] && return
 
-	if [[ -d ${ED%/}${D%/} ]] ; then
-		find "${ED%/}${D%/}/" | \
+	if [[ -d ${ED}/${D} ]] ; then
+		find "${ED}/${D}/" | \
 		while read i ; do
-			eqawarn "QA Notice: /${i#${ED%/}${D%/}/} installed in \${ED}\${D}"
+			eqawarn "QA Notice: /${i##${ED}/${D}} installed in \${ED}\${D}"
 		done
-		die "Aborting due to QA concerns: files installed in ${ED%/}${D%/}/"
+		die "Aborting due to QA concerns: files installed in ${ED}/${D}"
 	fi
 
-	if [[ -d ${ED%/}${EPREFIX} ]] ; then
-		find "${ED%/}${EPREFIX}/" | \
+	if [[ -d ${ED}/${EPREFIX} ]] ; then
+		find "${ED}/${EPREFIX}/" | \
 		while read i ; do
-			eqawarn "QA Notice: ${i#${D%/}/} double prefix"
+			eqawarn "QA Notice: ${i#${D}} double prefix"
 		done
 		die "Aborting due to QA concerns: double prefix files installed"
 	fi
@@ -34,6 +34,7 @@ install_qa_check_prefix() {
 	# check shebangs, bug #282539
 	rm -f "${T}"/non-prefix-shebangs-errs
 	local WHITELIST=" /usr/bin/env "
+	# BEGIN PREFIX LOCAL: resolve path before check
 	# shebang can be an absolutised path, bug #342929
 	local eprefix=$(canonicalize ${EPREFIX})
 	# Without the stacked-prefix feature, tests using BPREFIX
@@ -49,9 +50,12 @@ install_qa_check_prefix() {
 		BPREFIX=${BROOT-${PORTAGE_OVERRIDE_EPREFIX}}
 		bprefix=$(canonicalize ${BPREFIX})
 	fi
+	# END PREFIX LOCAL
 	# this is hell expensive, but how else?
-	find "${ED%/}/" -executable \! -type d -print0 \
-			| xargs -0 grep -IHnm1 '^# \?!' \
+	# PREFIX LOCAL: use grep -I to skip binary files, allow POSIX space
+	#               between # and !
+	find "${ED}" -executable \! -type d -print0 \
+			| xargs -0 grep -H -n -m1 -I '^# \?!' \
 			| while read f ;
 	do
 		local fn=${f%%:*}
@@ -64,7 +68,7 @@ install_qa_check_prefix() {
 		line=( ${line#"#!"} )
 		IFS=${oldIFS}
 		[[ ${WHITELIST} == *" ${line[0]} "* ]] && continue
-		local fp=${fn#${D%/}/} ; fp=/${fp%/*}
+		local fp=${fn#${D}} ; fp=/${fp%/*}
 		local rf=${fn}
 		# in case we deal with a symlink, make sure we don't replace it
 		# with a real file (sed -i does that)
@@ -73,23 +77,25 @@ install_qa_check_prefix() {
 			[[ ${rf} != /* ]] && rf=${fn%/*}/${rf}
 			# ignore symlinks pointing to outside prefix
 			# as seen in sys-devel/native-cctools
-			[[ $(canonicalize "/${rf#${D%/}/}") != ${eprefix}/* ]] && continue
+			[[ $(canonicalize "/${rf#${D}}") != ${eprefix}/* ]] && continue
 		fi
 		# does the shebang start with ${EPREFIX}, and does it exist?
+		# PREFIX LOCAL: check BPREFIX also
 		if [[ ${line[0]} == ${EPREFIX}/* || ${line[0]} == ${eprefix}/* ]] \
 		|| [[ ${line[0]} == ${BPREFIX}/* || ${line[0]} == ${bprefix}/* ]] ; then
 			if [[ ! -e ${ROOT%/}${line[0]} && ! -e ${D%/}${line[0]} ]] ; then
 				# hmm, refers explicitly to $EPREFIX, but doesn't exist,
 				# if it's in PATH that's wrong in any case
 				if [[ ":${PATH}:" == *":${fp}:"* ]] ; then
-					echo "${fn#${D%/}/}:${line[0]} (explicit EPREFIX but target not found)" \
+					echo "${fn#${D}}:${line[0]} (explicit EPREFIX but target not found)" \
 						>> "${T}"/non-prefix-shebangs-errs
 				else
-					eqawarn "${fn#${D%/}/} has explicit EPREFIX in shebang but target not found (${line[0]})"
+					eqawarn "${fn#${D}} has explicit EPREFIX in shebang but target not found (${line[0]})"
 				fi
 			fi
 			continue
 		fi
+		# BEGIN PREFIX LOCAL: also check init scripts
 		# unprefixed shebang, is the script directly in $PATH or an init
 		# script?
 		if [[ ":${PATH}:${EPREFIX}/etc/init.d:" == *":${fp}:"* ]] ; then
@@ -115,15 +121,16 @@ install_qa_check_prefix() {
 				continue
 			else
 				# this is definitely wrong: script in $PATH and invalid shebang
-				echo "${fn#${D%/}/}:${line[0]} (script ${fn##*/} installed in PATH but interpreter ${line[0]} not found)" \
+				echo "${fn#${D}}:${line[0]} (script ${fn##*/} installed in PATH but interpreter ${line[0]} not found)" \
 					>> "${T}"/non-prefix-shebangs-errs
 			fi
 		else
 			# unprefixed/invalid shebang, but outside $PATH, this may be
 			# intended (e.g. config.guess) so remain silent by default
 			has stricter ${FEATURES} && \
-				eqawarn "invalid shebang in ${fn#${D%/}/}: ${line[0]}"
+				eqawarn "invalid shebang in ${fn#${D}}: ${line[0]}"
 		fi
+		# END PREFIX LOCAL
 	done
 	if [[ -e "${T}"/non-prefix-shebangs-errs ]] ; then
 		eqawarn "QA Notice: the following files use invalid (possible non-prefixed) shebangs:"

diff --git a/bin/install-qa-check.d/80multilib-strict b/bin/install-qa-check.d/80multilib-strict
index 6c705bf16..3db4ecce3 100644
--- a/bin/install-qa-check.d/80multilib-strict
+++ b/bin/install-qa-check.d/80multilib-strict
@@ -1,5 +1,6 @@
 # Strict multilib directory checks
 multilib_strict_check() {
+    # PREFIX LOCAL: use file/find from Prefix
 	if has multilib-strict ${FEATURES} && \
 	   [[ -x ${EPREFIX}/usr/bin/file && -x ${EPREFIX}/usr/bin/find ]] && \
 	   [[ -n ${MULTILIB_STRICT_DIRS} && -n ${MULTILIB_STRICT_DENY} ]]

diff --git a/bin/install-qa-check.d/90gcc-warnings b/bin/install-qa-check.d/90gcc-warnings
index 3c737b51e..523e123d6 100644
--- a/bin/install-qa-check.d/90gcc-warnings
+++ b/bin/install-qa-check.d/90gcc-warnings
@@ -114,6 +114,7 @@ gcc_warn_check() {
 		[[ $PORTAGE_LOG_FILE = *.gz ]] && cat_cmd=zcat
 		[[ $reset_debug = 1 ]] && set -x
 		# Use safe cwd, avoiding unsafe import for bug #469338.
+		# PREFIX LOCAL: use Prefix Python fallback
 		f=$(cd "${PORTAGE_PYM_PATH}" ; $cat_cmd "${PORTAGE_LOG_FILE}" | \
 			"${PORTAGE_PYTHON:-@PREFIX_PORTAGE_PYTHON@}" "$PORTAGE_BIN_PATH"/check-implicit-pointer-usage.py || die "check-implicit-pointer-usage.py failed")
 		if [[ -n ${f} ]] ; then

diff --git a/bin/install.py b/bin/install.py
index e8933606a..4bdffd255 100755
--- a/bin/install.py
+++ b/bin/install.py
@@ -1,4 +1,4 @@
-#!@PREFIX_PORTAGE_PYTHON@
+#!/usr/bin/env python
 # Copyright 2013-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index ba8594f69..20e9c735c 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
@@ -441,6 +441,7 @@ case "${NOCOLOR:-false}" in
 		;;
 esac
 
+# BEGIN PREFIX LOCAL
 # In Prefix every platform has USERLAND=GNU, even FreeBSD.  Since I
 # don't know how to reliably "figure out" we are in a Prefix instance of
 # portage here, I for now disable this check, and hardcode it to GNU.
@@ -457,6 +458,7 @@ esac
 #	esac
 #fi
 [[ -z ${USERLAND} ]] && USERLAND="GNU"
+# END PREFIX LOCAL
 
 if [[ -z ${XARGS} ]] ; then
 	case ${USERLAND} in
@@ -646,6 +648,7 @@ debug-print() {
 		# default target
 		printf '%s\n' "${@}" >> "${T}/eclass-debug.log"
 		# let the portage user own/write to this file
+		# PREFIX LOCAL: fallback to configured group
 		chgrp "${PORTAGE_GRPNAME:-${PORTAGE_GROUP}}" "${T}/eclass-debug.log"
 		chmod g+w "${T}/eclass-debug.log"
 	fi

diff --git a/bin/lock-helper.py b/bin/lock-helper.py
index e7acd1938..6619d625a 100755
--- a/bin/lock-helper.py
+++ b/bin/lock-helper.py
@@ -1,4 +1,4 @@
-#!@PREFIX_PORTAGE_PYTHON@
+#!/usr/bin/env python
 # Copyright 2010-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index 887af7a23..a77b3bcfc 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2018 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 #
@@ -1063,7 +1063,8 @@ preinst_mask() {
 	# from bashrc.
 	local f x
 	for f in man info doc; do
-		if has no${f} $FEATURES; then
+		if has no${f} ${FEATURES}; then
+		    # PREFIX LOCAL: use EPREFIX with path
 			INSTALL_MASK="${INSTALL_MASK} ${EPREFIX}/usr/share/${f}"
 		fi
 	done

diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index 5a653fa64..8e334c139 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
@@ -32,6 +32,7 @@ PORTAGE_READONLY_VARS="D EBUILD EBUILD_PHASE EBUILD_PHASE_FUNC \
 	PORTAGE_VERBOSE PORTAGE_WORKDIR_MODE PORTAGE_XATTR_EXCLUDE \
 	REPLACING_VERSIONS REPLACED_BY_VERSION T WORKDIR \
 	__PORTAGE_HELPER __PORTAGE_TEST_HARDLINK_LOCKS ED EROOT"
+    # PREFIX LOCAL: include ED EROOT (above)
 
 PORTAGE_SAVED_READONLY_VARS="A CATEGORY P PF PN PR PV PVR"
 
@@ -146,6 +147,7 @@ __filter_readonly_variables() {
 		fi
 	fi
 
+    # PREFIX LOCAL: use Prefix Python fallback
 	"${PORTAGE_PYTHON:-@PREFIX_PORTAGE_PYTHON@}" "${PORTAGE_BIN_PATH}"/filter-bash-environment.py "${filtered_vars}" || die "filter-bash-environment.py failed"
 }
 
@@ -770,6 +772,7 @@ __dyn_help() {
 		echo "production (stripped)"
 	fi
 	echo "  merge to    : ${ROOT}"
+	# PREFIX LOCAL: identify
 	echo "  offset      : ${EPREFIX}"
 	echo
 	if [[ -n "$USE" ]]; then
@@ -1101,6 +1104,7 @@ __ebuild_main() {
 		__save_ebuild_env | __filter_readonly_variables \
 			--filter-features > "$T/environment"
 		assert "__save_ebuild_env failed"
+		# PREFIX LOCAL: use configure group
 		chgrp "${PORTAGE_GRPNAME:-${PORTAGE_GROUP}}" "$T/environment"
 		chmod g+w "$T/environment"
 	fi

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 3a3430847..c5dfcf121 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/portageq b/bin/portageq
index 4fe254d5d..6d12c98dd 100755
--- a/bin/portageq
+++ b/bin/portageq
@@ -1,4 +1,4 @@
-#!@PREFIX_PORTAGE_PYTHON@
+#!/usr/bin/env python
 # Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/quickpkg b/bin/quickpkg
index 7e0445dc3..773c1c07e 100755
--- a/bin/quickpkg
+++ b/bin/quickpkg
@@ -1,4 +1,4 @@
-#!@PREFIX_PORTAGE_PYTHON@
+#!/usr/bin/env python
 # Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/readpecoff b/bin/readpecoff
index 389b55081..acd163a24 100755
--- a/bin/readpecoff
+++ b/bin/readpecoff
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 
 ###################################################################
 # This script does the following: for implemented platforms,      #

diff --git a/bin/regenworld b/bin/regenworld
index 6d381fad6..7927dd237 100755
--- a/bin/regenworld
+++ b/bin/regenworld
@@ -1,4 +1,4 @@
-#!@PREFIX_PORTAGE_PYTHON@
+#!/usr/bin/env python
 # Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh
index 5c7fd4d7d..3520d0416 100755
--- a/bin/save-ebuild-env.sh
+++ b/bin/save-ebuild-env.sh
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/xattr-helper.py b/bin/xattr-helper.py
index 8ad94c4ab..6e50ac487 100755
--- a/bin/xattr-helper.py
+++ b/bin/xattr-helper.py
@@ -1,4 +1,4 @@
-#!@PREFIX_PORTAGE_PYTHON@
+#!/usr/bin/env python
 # Copyright 2012-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/bin/xpak-helper.py b/bin/xpak-helper.py
index 8ffa9c747..ac29995e7 100755
--- a/bin/xpak-helper.py
+++ b/bin/xpak-helper.py
@@ -1,4 +1,4 @@
-#!@PREFIX_PORTAGE_PYTHON@
+#!/usr/bin/env python
 # Copyright 2009-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 

diff --git a/cnf/make.conf.example b/cnf/make.conf.example
index 8f20df26b..b48d9e6b6 100644
--- a/cnf/make.conf.example
+++ b/cnf/make.conf.example
@@ -100,7 +100,7 @@
 # PORTAGE_TMPDIR is the location portage will use for compilations and
 #     temporary storage of data. This can get VERY large depending upon
 #     the application being installed.
-#PORTAGE_TMPDIR=@PORTAGE_EPREFIX@/var/tmp
+#PORTAGE_TMPDIR=/var/tmp
 #
 # PORTDIR is the location of the ebuild repository. This is the repository
 #     for all profile information as well as all ebuilds. If you change
@@ -108,7 +108,7 @@
 #     ***Warning***
 #     Data stored inside PORTDIR is in peril of being overwritten or deleted by
 #     the emerge --sync command.
-#PORTDIR=@PORTAGE_EPREFIX@/var/db/repos/gentoo
+#PORTDIR=/var/db/repos/gentoo
 #
 # DISTDIR is where all of the source code tarballs will be placed for
 #     emerges. After packages are built, it is safe to remove any and
@@ -116,12 +116,12 @@
 #     fetched on demand for a given build. If you would like to
 #     selectively prune obsolete files from this directory, see
 #     eclean from the gentoolkit package.
-#DISTDIR=@PORTAGE_EPREFIX@/var/cache/distfiles
+#DISTDIR=/var/cache/distfiles
 #
 # PKGDIR is the location of binary packages that you can have created
 #     with '--buildpkg' or '-b' while emerging a package. This can get
 #     up to several hundred megs, or even a few gigs.
-#PKGDIR=@PORTAGE_EPREFIX@/var/cache/binpkgs
+#PKGDIR=/var/cache/binpkgs
 #
 # PORTAGE_LOGDIR is the location where portage will store all the logs it
 #     creates from each individual merge. They are stored as
@@ -134,7 +134,7 @@
 # PORTDIR_OVERLAY is a directory where local ebuilds may be stored without
 #     concern that they will be deleted by rsync updates. Default is not
 #     defined.
-#PORTDIR_OVERLAY=@PORTAGE_EPREFIX@/usr/local/portage
+#PORTDIR_OVERLAY=/usr/local/portage
 
 # Fetching files
 # ==============

diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py
index ce7d64307..bf00133e8 100644
--- a/lib/_emerge/actions.py
+++ b/lib/_emerge/actions.py
@@ -2951,25 +2951,28 @@ def getgccversion(chost=None):
     gcc_ver_command = ["gcc", "-dumpversion"]
     gcc_ver_prefix = "gcc-"
 
+    # BEGIN PREFIX LOCAL: accept clang as system compiler too
     clang_ver_command = ['clang', '--version']
     clang_ver_prefix = 'clang-'
 
     ubinpath = os.path.join('/', portage.const.EPREFIX, 'usr', 'bin')
 
-    gcc_not_found_error = red(
-        "!!! No gcc found. You probably need to 'source /etc/profile'\n"
-        + "!!! to update the environment of this terminal and possibly\n"
-        + "!!! other terminals also.\n"
-    )
-
     def getclangversion(output):
         version = re.search('clang version ([0-9.]+) ', output)
         if version:
             return version.group(1)
         return "unknown"
+    # END PREFIX LOCAL
+
+    gcc_not_found_error = red(
+        "!!! No gcc found. You probably need to 'source /etc/profile'\n"
+        + "!!! to update the environment of this terminal and possibly\n"
+        + "!!! other terminals also.\n"
+    )
 
     if chost:
         try:
+            # PREFIX LOCAL: use ubinpath
             proc = subprocess.Popen(
                 [ubinpath + "/" + "gcc-config", "-c"],
                 stdout=subprocess.PIPE, stderr=subprocess.STDOUT
@@ -2984,6 +2987,7 @@ def getgccversion(chost=None):
             return myoutput.replace(chost + "-", gcc_ver_prefix, 1)
 
         try:
+            # PREFIX LOCAL: use ubinpath
             proc = subprocess.Popen(
                 [ubinpath + "/" + chost + "-" + gcc_ver_command[0]]
                 + gcc_ver_command[1:],
@@ -2999,6 +3003,7 @@ def getgccversion(chost=None):
         if mystatus == os.EX_OK:
             return gcc_ver_prefix + myoutput
 
+        # BEGIN PREFIX LOCAL: try Clang
         try:
             proc = subprocess.Popen(
                 [ubinpath + "/" + chost + "-" + clang_ver_command[0]]
@@ -3014,6 +3019,7 @@ def getgccversion(chost=None):
             mystatus = proc.wait()
         if mystatus == os.EX_OK:
             return clang_ver_prefix + getclangversion(myoutput)
+        # END PREFIX LOCAL
 
     try:
         proc = subprocess.Popen(

diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py
index 9218066cf..c5d0343b7 100644
--- a/lib/_emerge/depgraph.py
+++ b/lib/_emerge/depgraph.py
@@ -11871,6 +11871,7 @@ def _get_masking_status(pkg, pkgsettings, root_config, myrepo=None, use=None):
         if not pkgsettings._accept_chost(pkg.cpv, pkg._metadata):
             mreasons.append(_MaskReason("CHOST", "CHOST: %s" % pkg._metadata["CHOST"]))
 
+    # BEGIN PREFIX LOCAL: check EPREFIX
     eprefix = pkgsettings["EPREFIX"]
     if len(eprefix.rstrip('/')) > 0 and pkg.built and not pkg.installed:
         if not "EPREFIX" in pkg._metadata:
@@ -11880,6 +11881,7 @@ def _get_masking_status(pkg, pkgsettings, root_config, myrepo=None, use=None):
             mreasons.append(_MaskReason("EPREFIX",
                 "EPREFIX: '%s' too small" % \
                     pkg._metadata["EPREFIX"]))
+    # END PREFIX LOCAL
 
     if pkg.invalid:
         for msgs in pkg.invalid.values():

diff --git a/lib/_emerge/emergelog.py b/lib/_emerge/emergelog.py
index c951d61b5..43f94beab 100644
--- a/lib/_emerge/emergelog.py
+++ b/lib/_emerge/emergelog.py
@@ -10,12 +10,14 @@ from portage import _unicode_decode
 from portage import _unicode_encode
 from portage.data import secpass
 from portage.output import xtermTitle
+# PREFIX LOCAL
 from portage.const import EPREFIX
 
 # We disable emergelog by default, since it's called from
 # dblink.merge() and we don't want that to trigger log writes
 # unless it's really called via emerge.
 _disable = True
+# PREFIX LOCAL: log inside Prefix
 _emerge_log_dir = EPREFIX + '/var/log'
 
 

diff --git a/lib/_emerge/getloadavg.py b/lib/_emerge/getloadavg.py
index de3c5670a..433f3ba21 100644
--- a/lib/_emerge/getloadavg.py
+++ b/lib/_emerge/getloadavg.py
@@ -2,7 +2,6 @@
 # Distributed under the terms of the GNU General Public License v2
 
 from portage import os
-import platform
 
 getloadavg = getattr(os, "getloadavg", None)
 if getloadavg is None:

diff --git a/lib/portage/const.py b/lib/portage/const.py
index 3038ce285..8d07abd98 100644
--- a/lib/portage/const.py
+++ b/lib/portage/const.py
@@ -2,10 +2,12 @@
 # Copyright 1998-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
+# BEGIN PREFIX LOCAL
 # ===========================================================================
 # autotool supplied constants.
 # ===========================================================================
 from portage.const_autotool import *
+# END PREFIX LOCAL
 
 import os
 import sys
@@ -63,14 +65,15 @@ DEPCACHE_PATH = f"/{CACHE_PATH}/dep"
 GLOBAL_CONFIG_PATH = "/usr/share/portage/config"
 
 # these variables are not used with target_root or config_root
-PORTAGE_BASE_PATH        = PORTAGE_BASE
 # NOTE: Use realpath(__file__) so that python module symlinks in site-packages
 # are followed back to the real location of the whole portage installation.
-#PREFIX: below should work, but I'm not sure how it it affects other places
+# PREFIX: below should work, but I'm not sure how it it affects other places
 # NOTE: Please keep PORTAGE_BASE_PATH in one line to help substitutions.
 # fmt:off
-# PREFIX LOCAL (from const_autotools)
+# BEGIN PREFIX LOCAL: from const_autotools
 #PORTAGE_BASE_PATH = os.path.join(os.sep, os.sep.join(os.path.realpath(__file__.rstrip("co")).split(os.sep)[:-3]))
+PORTAGE_BASE_PATH        = PORTAGE_BASE
+# END PREFIX LOCAL
 # fmt:on
 PORTAGE_BIN_PATH = f"{PORTAGE_BASE_PATH}/bin"
 PORTAGE_PYM_PATH = os.path.realpath(os.path.join(__file__, "../.."))
@@ -261,7 +264,6 @@ MANIFEST2_IDENTIFIERS = ("AUX", "MISC", "DIST", "EBUILD")
 # in the definition of any other constants within this file.
 # PREFIX LOCAL: rely on EPREFIX from autotools
 #EPREFIX = ""
-# END PREFIX LOCAL
 
 # pick up EPREFIX from the environment if set
 if "PORTAGE_OVERRIDE_EPREFIX" in os.environ:

diff --git a/lib/portage/data.py b/lib/portage/data.py
index 5d34db187..3b86c70a9 100644
--- a/lib/portage/data.py
+++ b/lib/portage/data.py
@@ -6,6 +6,7 @@ import grp
 import os
 import platform
 import pwd
+# PREFIX LOCAL
 from portage.const import PORTAGE_GROUPNAME, PORTAGE_USERNAME, EPREFIX
 
 import portage
@@ -333,20 +334,20 @@ def _init(settings):
         native_string = platform.python_implementation() == "PyPy"
 
         # PREFIX LOCAL: use var iso hardwired 'portage'
-        v = settings.get('PORTAGE_GRPNAME', PORTAGE_GROUPNAME)
+        v = settings.get("PORTAGE_GRPNAME", PORTAGE_GROUPNAME)
         # END PREFIX LOCAL
         if native_string:
             v = portage._native_string(v)
-        globals()['_portage_grpname'] = v
-        _initialized_globals.add('_portage_grpname')
+        globals()["_portage_grpname"] = v
+        _initialized_globals.add("_portage_grpname")
 
         # PREFIX LOCAL: use var iso hardwired 'portage'
-        v = settings.get('PORTAGE_USERNAME', PORTAGE_USERNAME)
+        v = settings.get("PORTAGE_USERNAME", PORTAGE_USERNAME)
         # END PREFIX LOCAL
         if native_string:
             v = portage._native_string(v)
-        globals()['_portage_username'] = v
-        _initialized_globals.add('_portage_username')
+        globals()["_portage_username"] = v
+        _initialized_globals.add("_portage_username")
 
     if "secpass" not in _initialized_globals:
         v = 0

diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py
index 6c668726d..c9a4b19ab 100644
--- a/lib/portage/dbapi/vartree.py
+++ b/lib/portage/dbapi/vartree.py
@@ -239,6 +239,9 @@ class vardbapi(dbapi):
             settings["ROOT"],
             os.path.join(self._eroot, PRIVATE_PATH, "preserved_libs_registry"),
         )
+
+        # BEGIN PREFIX LOCAL: set linkagemap to the platform specific
+        #                     provider
         chost = self.settings.get('CHOST')
         if not chost:
             chost = 'lunix?' # this happens when profiles are not available
@@ -250,6 +253,7 @@ class vardbapi(dbapi):
             self._linkmap = LinkageMapXCoff(self)
         else:
             self._linkmap = LinkageMap(self)
+        # END PREFIX LOCAL
         self._owners = self._owners_db(self)
 
         self._cached_counter = None
@@ -3767,6 +3771,7 @@ class dblink:
         def path_to_node(path):
             node = path_node_map.get(path)
             if node is None:
+                # BEGIN PREFIX LOCAL: use arch specific impl
                 chost = self.settings.get('CHOST')
                 if chost.find('darwin') >= 0:
                     node = LinkageMapMachO._LibGraphNode(linkmap._obj_key(path))
@@ -3776,6 +3781,7 @@ class dblink:
                     node = LinkageMapXCoff._LibGraphNode(linkmap._obj_key(path))
                 else:
                     node = LinkageMap._LibGraphNode(linkmap._obj_key(path))
+                # END PREFIX LOCAL
                 alt_path_node = lib_graph.get(node)
                 if alt_path_node is not None:
                     node = alt_path_node

diff --git a/lib/portage/package/ebuild/_config/special_env_vars.py b/lib/portage/package/ebuild/_config/special_env_vars.py
index 425efbaad..a192fa80b 100644
--- a/lib/portage/package/ebuild/_config/special_env_vars.py
+++ b/lib/portage/package/ebuild/_config/special_env_vars.py
@@ -238,7 +238,6 @@ environ_whitelist += [
 ]
 
 # other variables inherited from the calling environment
-# UNIXMODE is necessary for MiNT
 environ_whitelist += [
     "CVS_RSH",
     "ECHANGELOG_USER",
@@ -248,7 +247,7 @@ environ_whitelist += [
     "STY",
     "WINDOW",
     "XAUTHORITY",
-    # PREFIX LOCAL
+    # PREFIX LOCAL: UNIXMODE is necessary for MiNT
     "UNIXMODE",
 ]
 

diff --git a/lib/portage/package/ebuild/config.py b/lib/portage/package/ebuild/config.py
index 2e41ebfa5..66715de7f 100644
--- a/lib/portage/package/ebuild/config.py
+++ b/lib/portage/package/ebuild/config.py
@@ -65,7 +65,9 @@ from portage.env.loaders import KeyValuePairFileLoader
 from portage.exception import InvalidDependString, PortageException
 from portage.localization import _
 from portage.output import colorize
-from portage.process import fakeroot_capable, sandbox_capable, macossandbox_capable
+from portage.process import fakeroot_capable, sandbox_capable
+# PREFIX LOCAL
+from portage.process import macossandbox_capable
 from portage.repository.config import (
     allow_profile_repo_deps,
     load_repository_config,
@@ -183,7 +185,6 @@ class _iuse_implicit_match_cache:
 
 
 class config:
-
     """
     This class encompasses the main portage configuration.  Data is pulled from
     ROOT/PORTDIR/profiles/, from ROOT/etc/make.profile incrementally through all

diff --git a/lib/portage/package/ebuild/doebuild.py b/lib/portage/package/ebuild/doebuild.py
index 3c1998889..6f48dfd2d 100644
--- a/lib/portage/package/ebuild/doebuild.py
+++ b/lib/portage/package/ebuild/doebuild.py
@@ -22,6 +22,7 @@ from textwrap import wrap
 import time
 import warnings
 import zlib
+# PREFIX LOCAL
 import platform
 
 import portage
@@ -1694,6 +1695,7 @@ def _spawn_actionmap(settings):
         and "nouserpriv" not in restrict
     )
 
+    # PREFIX LOCAL: macOS sandbox
     if not (portage.process.sandbox_capable
             or portage.process.macossandbox_capable):
         nosandbox = True
@@ -2087,8 +2089,9 @@ def spawn(
             and not fakeroot
         )
 
+    # PREFIX LOCAL: macOS sandbox
     if not free and not (fakeroot or portage.process.sandbox_capable
-            or portage.process.macossandbox_capable):  # PREFIX LOCAL
+            or portage.process.macossandbox_capable):
         free = True
 
     if mysettings.mycpv is not None:

diff --git a/lib/portage/process.py b/lib/portage/process.py
index 5879694f9..460ddf07b 100644
--- a/lib/portage/process.py
+++ b/lib/portage/process.py
@@ -25,7 +25,9 @@ portage.proxy.lazyimport.lazyimport(
     "portage.util:dump_traceback,writemsg",
 )
 
-from portage.const import BASH_BINARY, SANDBOX_BINARY, MACOSSANDBOX_BINARY, FAKEROOT_BINARY
+from portage.const import BASH_BINARY, SANDBOX_BINARY, FAKEROOT_BINARY
+# PREFIX LOCAL
+from portage.const import MACOSSANDBOX_BINARY
 from portage.exception import CommandNotFound
 from portage.util._ctypes import find_library, LoadLibrary, ctypes
 
@@ -106,6 +108,7 @@ fakeroot_capable = os.path.isfile(FAKEROOT_BINARY) and os.access(
     FAKEROOT_BINARY, os.X_OK
 )
 
+# PREFIX LOCAL
 macossandbox_capable = (os.path.isfile(MACOSSANDBOX_BINARY) and
                    os.access(MACOSSANDBOX_BINARY, os.X_OK))
 
@@ -186,6 +189,7 @@ def spawn_fakeroot(mycommand, fakeroot_state=None, opt_name=None, **keywords):
     return spawn(args, opt_name=opt_name, **keywords)
 
 
+# BEGIN PREFIX LOCAL
 def spawn_macossandbox(mycommand, profile=None, opt_name=None, **keywords):
 	if not macossandbox_capable:
 		return spawn_bash(mycommand, opt_name=opt_name, **keywords)
@@ -198,6 +202,7 @@ def spawn_macossandbox(mycommand, profile=None, opt_name=None, **keywords):
 	args.append("-c")
 	args.append(mycommand)
 	return spawn(args, opt_name=opt_name, **keywords)
+# END PREFIX LOCAL
 
 _exithandlers = []
 

diff --git a/lib/portage/tests/lazyimport/test_lazy_import_portage_baseline.py b/lib/portage/tests/lazyimport/test_lazy_import_portage_baseline.py
index dca4de573..cb1270db7 100644
--- a/lib/portage/tests/lazyimport/test_lazy_import_portage_baseline.py
+++ b/lib/portage/tests/lazyimport/test_lazy_import_portage_baseline.py
@@ -25,7 +25,7 @@ class LazyImportPortageBaselineTestCase(TestCase):
             "portage.proxy.objectproxy",
             "portage._selinux",
             # PREFIX LOCAL
-            'portage.const_autotool',
+            "portage.const_autotool",
         ]
     )
 

diff --git a/lib/portage/tests/runTests.py b/lib/portage/tests/runTests.py
index 2a11381b0..da6d83e85 100755
--- a/lib/portage/tests/runTests.py
+++ b/lib/portage/tests/runTests.py
@@ -1,4 +1,4 @@
-#!@PREFIX_PORTAGE_PYTHON@ -Wd
+#!/usr/bin/env python -Wd
 # runTests.py -- Portage Unit Test Functionality
 # Copyright 2006-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
@@ -31,6 +31,7 @@ signal.signal(debug_signum, debug_signal)
 # Pretend that the current user's uid/gid are the 'portage' uid/gid,
 # so things go smoothly regardless of the current user and global
 # user/group configuration.
+# BEGIN PREFIX LOCAL: fall back to number ids
 try:
 	os.environ["PORTAGE_USERNAME"] = pwd.getpwuid(os.getuid()).pw_name
 except KeyError:
@@ -39,6 +40,7 @@ try:
 	os.environ["PORTAGE_GRPNAME"] = grp.getgrgid(os.getgid()).gr_name
 except KeyError:
 	os.environ["PORTAGE_GRPNAME"] = str(os.getgid())
+# END PREFIX LOCAL
 
 # Insert our parent dir so we can do shiny import "tests"
 # This line courtesy of Marienz and Pkgcore ;)

diff --git a/lib/portage/util/__init__.py b/lib/portage/util/__init__.py
index 11a7d0677..4e9cef66f 100644
--- a/lib/portage/util/__init__.py
+++ b/lib/portage/util/__init__.py
@@ -80,6 +80,7 @@ from portage.exception import (
 from portage.localization import _
 from portage.proxy.objectproxy import ObjectProxy
 from portage.cache.mappings import UserDict
+# PREFIX LOCAL
 from portage.const import EPREFIX
 
 

diff --git a/lib/portage/util/_info_files.py b/lib/portage/util/_info_files.py
index 2a8d277b3..5d4aff1d7 100644
--- a/lib/portage/util/_info_files.py
+++ b/lib/portage/util/_info_files.py
@@ -9,6 +9,7 @@ import subprocess
 
 import portage
 from portage import os
+# PREFIX LOCAL
 from portage.const import EPREFIX
 
 

diff --git a/lib/portage/util/_pty.py b/lib/portage/util/_pty.py
index 40ab1a8db..1fd846dd1 100644
--- a/lib/portage/util/_pty.py
+++ b/lib/portage/util/_pty.py
@@ -9,12 +9,14 @@ from portage import os
 from portage.output import get_term_size, set_term_size
 from portage.util import writemsg
 
+# BEGIN PREFIX LOCAL: disable on more platforms
 # Disable the use of openpty on Solaris (and others) as it seems Python's
 # openpty implementation doesn't play nice with Portage's behaviour,
 # causing hangs/deadlocks.
 # Additional note for the future: on Interix, pipes do NOT work, so
 # _disable_openpty on Interix must *never* be True
 _disable_openpty = platform.system() in ("AIX","FreeMiNT","HP-UX","SunOS",)
+# END PREFIX LOCAL
 
 _fbsd_test_pty = platform.system() == "FreeBSD"
 

diff --git a/lib/portage/util/futures/retry.py b/lib/portage/util/futures/retry.py
index 9f04a4427..496bfb562 100644
--- a/lib/portage/util/futures/retry.py
+++ b/lib/portage/util/futures/retry.py
@@ -1,4 +1,4 @@
-# Copyright 2018 Gentoo Foundation
+# Copyright 2018-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 __all__ = (

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index d459a2386..d4c70fb9c 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -1,4 +1,4 @@
-#!@PORTAGE_BASH@
+#!/usr/bin/env bash
 # Copyright 1999-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # Author: Brian Harring <ferringb@gentoo.org>, karltk@gentoo.org originally.


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-24 19:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-24 19:27 [gentoo-commits] proj/portage:prefix commit in: lib/portage/package/ebuild/_config/, bin/ebuild-helpers/xattr/, Fabian Groffen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox