commit:     abdd26a5d2a72e56946770f34d57d387c9ebf494
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 29 18:04:03 2025 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Jun 29 18:32:10 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=abdd26a5

Merge remote-tracking branch 'origin/master' into prefix

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

 .github/workflows/ci.yml                           |  19 +-
 .github/workflows/lint.yml                         |  15 +-
 .github/workflows/pre-commit.yml                   |  10 +-
 .pre-commit-config.yaml                            |   6 +-
 NEWS                                               | 333 ++++++-
 bin/bashrc-functions.sh                            |  45 +-
 bin/binhost-snapshot                               |  15 +-
 bin/dispatch-conf                                  |  66 +-
 bin/eapi.sh                                        | 341 ++------
 bin/eapi7-ver-funcs.sh                             |   1 +
 bin/ebuild                                         |  12 +-
 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                           |  14 +-
 bin/ebuild-helpers/dohard                          |   2 +-
 bin/ebuild-helpers/doheader                        |   2 +-
 bin/ebuild-helpers/dohtml                          |   8 +-
 bin/ebuild-helpers/doinfo                          |   2 +-
 bin/ebuild-helpers/doinitd                         |   3 +-
 bin/ebuild-helpers/doins                           |   4 +-
 bin/ebuild-helpers/dolib                           |   2 +-
 bin/ebuild-helpers/doman                           |   7 +-
 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                           |   2 +-
 bin/ebuild-helpers/fowners                         |  10 +-
 bin/ebuild-helpers/fperms                          |  10 +-
 bin/ebuild-helpers/keepdir                         |   2 +-
 bin/ebuild-helpers/newins                          |  14 +-
 bin/ebuild-helpers/nonfatal                        |   2 +-
 bin/ebuild-helpers/prepall                         |   2 +-
 bin/ebuild-helpers/unprivileged/chown              |   2 +-
 bin/ebuild-helpers/xattr/install                   |   2 +-
 bin/ebuild-pyhelper                                |   2 +-
 bin/ebuild.sh                                      | 166 ++--
 bin/ecompress                                      | 388 +++++----
 bin/ecompress-file                                 |   8 +-
 bin/egencache                                      |   5 +-
 bin/emerge-webrsync                                | 957 ++++++++++-----------
 bin/env-update                                     |  44 +-
 bin/estrip                                         | 869 ++++++++++---------
 bin/etc-update                                     |  22 +-
 bin/fixpackages                                    |   4 +-
 bin/helper-functions.sh                            |  76 +-
 bin/install-qa-check.d/05double-D                  |   4 +-
 bin/install-qa-check.d/05prefix                    |  11 +-
 bin/install-qa-check.d/10executable-issues         |  20 +-
 bin/install-qa-check.d/10ignored-flags             |  21 +-
 bin/install-qa-check.d/20deprecated-directories    |   4 +-
 bin/install-qa-check.d/20runtime-directories       |   4 +-
 bin/install-qa-check.d/60bash-completion           |  28 +-
 bin/install-qa-check.d/60openrc                    |  19 +-
 bin/install-qa-check.d/60pkgconfig                 |   8 +-
 bin/install-qa-check.d/60pngfix                    |   6 +-
 bin/install-qa-check.d/60systemd                   |   4 +-
 bin/install-qa-check.d/60udev                      |   4 +-
 bin/install-qa-check.d/80libraries                 |  10 +-
 bin/install-qa-check.d/80multilib-strict           |  35 +-
 bin/install-qa-check.d/90bad-bin-group-write       |   1 +
 bin/install-qa-check.d/90bad-bin-owner             |   1 +
 bin/install-qa-check.d/90cmake-warnings            |   4 +-
 bin/install-qa-check.d/90config-impl-decl          |  32 +-
 bin/install-qa-check.d/90cython-dep                |   8 +-
 bin/install-qa-check.d/90gcc-warnings              | 387 ++++-----
 bin/install-qa-check.d/90world-writable            |   4 +-
 bin/install-qa-check.d/95empty-dirs                |   4 +-
 bin/install.py                                     |   3 +-
 bin/isolated-functions.sh                          | 232 +++--
 bin/lock-helper.py                                 |  10 +-
 bin/misc-functions.sh                              |  74 +-
 bin/phase-functions.sh                             | 353 ++++----
 bin/phase-helpers.sh                               | 662 ++++++--------
 bin/portageq                                       |  35 +-
 bin/portageq-wrapper                               |   2 +-
 bin/postinst-qa-check.d/50xdg-utils                |  10 +-
 bin/quickpkg                                       |   9 +-
 bin/save-ebuild-env.sh                             |  30 +-
 cnf/METADATA                                       |   3 +
 cnf/make.conf.example                              |   7 +-
 cnf/make.globals                                   |   8 +-
 cnf/sets/portage.conf                              |   6 +-
 doc/meson.build                                    |   1 -
 doc/package/ebuild.docbook                         |   1 -
 doc/package/ebuild/eapi/4-slot-abi.docbook         |  70 --
 doc/portage.docbook                                |   1 -
 lib/_emerge/Binpkg.py                              |   7 +-
 lib/_emerge/BinpkgEnvExtractor.py                  |   5 +-
 lib/_emerge/BinpkgExtractorAsync.py                |  20 +-
 lib/_emerge/BinpkgFetcher.py                       |  20 +-
 lib/_emerge/BinpkgPrefetcher.py                    |  42 +-
 lib/_emerge/BinpkgVerifier.py                      |   2 +-
 lib/_emerge/EbuildBinpkg.py                        |   3 +-
 lib/_emerge/EbuildFetcher.py                       |  76 +-
 lib/_emerge/EbuildMetadataPhase.py                 |   7 +
 lib/_emerge/EbuildPhase.py                         |  42 +
 lib/_emerge/JobStatusDisplay.py                    |  31 +-
 lib/_emerge/MiscFunctionsProcess.py                |   4 +-
 lib/_emerge/PackageMerge.py                        |   4 +-
 lib/_emerge/PackagePhase.py                        |   3 +-
 lib/_emerge/PollScheduler.py                       |   2 +-
 lib/_emerge/Scheduler.py                           | 131 ++-
 lib/_emerge/SpawnProcess.py                        |  69 +-
 lib/_emerge/actions.py                             |  66 +-
 lib/_emerge/depgraph.py                            |  92 +-
 lib/_emerge/emergelog.py                           |   2 +-
 lib/_emerge/main.py                                |   8 +-
 lib/_emerge/post_emerge.py                         |   2 +-
 lib/portage/__init__.py                            |  82 +-
 lib/portage/_emirrordist/FetchTask.py              |   3 +-
 lib/portage/_global_updates.py                     |  30 +-
 lib/portage/_sets/dbapi.py                         |  60 +-
 lib/portage/_sets/libs.py                          |   4 +-
 lib/portage/binpkg.py                              |   2 +-
 lib/portage/binrepo/config.py                      |  13 +-
 lib/portage/const.py                               |   3 +
 lib/portage/dbapi/_MergeProcess.py                 |   9 +-
 lib/portage/dbapi/_SyncfsProcess.py                |  14 +-
 lib/portage/dbapi/bintree.py                       | 186 +++-
 lib/portage/dbapi/porttree.py                      |   7 +-
 lib/portage/dbapi/vartree.py                       |  43 +-
 lib/portage/dep/soname/multilib_category.py        |   4 +-
 lib/portage/dispatch_conf.py                       |   5 +-
 lib/portage/eapi.py                                |  45 +-
 lib/portage/eclass_cache.py                        |   6 +-
 lib/portage/elog/mod_custom.py                     |  73 +-
 lib/portage/emaint/modules/logs/logs.py            |   5 +-
 lib/portage/emaint/modules/meson.build             |   1 +
 lib/portage/emaint/modules/revisions/__init__.py   |  36 +
 .../modules/{config => revisions}/meson.build      |   4 +-
 lib/portage/emaint/modules/revisions/revisions.py  |  95 ++
 lib/portage/emaint/modules/sync/sync.py            |  31 +-
 lib/portage/getbinpkg.py                           |   3 +-
 lib/portage/gpg.py                                 |   7 +-
 lib/portage/gpkg.py                                |  71 +-
 lib/portage/locks.py                               |   6 -
 lib/portage/output.py                              |  34 +-
 .../package/ebuild/_config/LocationsManager.py     |   4 +-
 .../package/ebuild/_config/env_var_validation.py   |   4 +-
 .../package/ebuild/_config/special_env_vars.py     |   5 +-
 .../ebuild/_parallel_manifest/ManifestTask.py      |   5 +-
 lib/portage/package/ebuild/config.py               |  23 +-
 lib/portage/package/ebuild/doebuild.py             | 257 ++++--
 lib/portage/package/ebuild/fetch.py                | 111 ++-
 lib/portage/package/ebuild/prepare_build_dirs.py   |  35 +-
 lib/portage/process.py                             |  95 +-
 lib/portage/repository/config.py                   |  14 +-
 lib/portage/repository/storage/hardlink_rcu.py     |   8 +-
 lib/portage/sync/controller.py                     |   8 +-
 lib/portage/sync/meson.build                       |   1 +
 lib/portage/sync/modules/cvs/cvs.py                |  14 +-
 lib/portage/sync/modules/git/git.py                |  22 +-
 lib/portage/sync/modules/mercurial/mercurial.py    |  21 +-
 lib/portage/sync/modules/meson.build               |   1 +
 lib/portage/sync/modules/rsync/rsync.py            |  22 +-
 lib/portage/sync/modules/svn/svn.py                |   9 +-
 lib/portage/sync/modules/webrsync/webrsync.py      |   4 +-
 lib/portage/sync/modules/zipfile/__init__.py       |  34 +
 .../config => sync/modules/zipfile}/meson.build    |   4 +-
 lib/portage/sync/modules/zipfile/zipfile.py        | 143 +++
 lib/portage/sync/revision_history.py               | 133 +++
 lib/portage/tests/__init__.py                      |  19 +
 lib/portage/tests/dbapi/test_bintree.py            |  22 +-
 lib/portage/tests/dbapi/test_portdb_cache.py       |   7 +-
 lib/portage/tests/ebuild/meson.build               |   1 -
 lib/portage/tests/ebuild/test_doebuild_fd_pipes.py |  96 ++-
 lib/portage/tests/ebuild/test_doebuild_spawn.py    |   4 +-
 lib/portage/tests/ebuild/test_fetch.py             | 105 ++-
 lib/portage/tests/ebuild/test_ipc_daemon.py        |   5 +
 lib/portage/tests/ebuild/test_shell_quote.py       | 106 ---
 lib/portage/tests/emerge/conftest.py               |   8 +-
 lib/portage/tests/emerge/test_config_protect.py    |   5 +-
 lib/portage/tests/emerge/test_emerge_slot_abi.py   |   3 +-
 lib/portage/tests/locks/test_asynchronous_lock.py  |   9 +
 lib/portage/tests/process/test_unshare_net.py      |  20 +-
 lib/portage/tests/resolver/ResolverPlayground.py   |  11 +-
 lib/portage/tests/resolver/meson.build             |   2 +
 lib/portage/tests/resolver/test_bootstrap_deps.py  | 250 ++++++
 .../tests/resolver/test_rebuild_ghostscript.py     |   2 +-
 .../resolver/test_runtime_cycle_merge_order.py     |  11 +-
 lib/portage/tests/resolver/test_tar_merge_order.py | 496 +++++++++++
 lib/portage/tests/resolver/test_targetroot.py      |   6 +-
 lib/portage/tests/resolver/test_virtual_slot.py    |   8 +-
 lib/portage/tests/sets/base/test_variable_set.py   |  20 +-
 lib/portage/tests/sync/meson.build                 |   1 +
 lib/portage/tests/sync/test_sync_local.py          | 161 +++-
 lib/portage/tests/sync/test_sync_zipfile.py        |  99 +++
 lib/portage/tests/update/test_move_ent.py          |   8 +-
 lib/portage/tests/update/test_move_slot_ent.py     |   4 +-
 lib/portage/tests/update/test_update_dbentry.py    |   4 +-
 lib/portage/tests/util/file_copy/test_copyfile.py  |  35 +-
 lib/portage/tests/util/futures/asyncio/meson.build |   1 -
 .../asyncio/test_policy_wrapper_recursion.py       |  23 -
 lib/portage/tests/util/futures/meson.build         |   1 -
 .../tests/util/futures/test_compat_coroutine.py    | 210 -----
 lib/portage/tests/util/futures/test_retry.py       |  18 +
 lib/portage/tests/util/meson.build                 |   1 +
 lib/portage/tests/util/test_atomic_ofstream.py     |  85 ++
 lib/portage/tests/util/test_mtimedb.py             |  30 +-
 lib/portage/tests/util/test_socks5.py              | 107 ++-
 lib/portage/update.py                              |   4 +-
 lib/portage/util/ExtractKernelVersion.py           |   5 +-
 lib/portage/util/__init__.py                       |  83 +-
 lib/portage/util/_async/BuildLogger.py             |   4 +-
 lib/portage/util/_async/ForkProcess.py             |  15 +-
 lib/portage/util/_ctypes.py                        |  15 +
 lib/portage/util/_dyn_libs/soname_deps.py          |   6 +-
 lib/portage/util/_eventloop/asyncio_event_loop.py  |  34 +-
 lib/portage/util/_pty.py                           |  23 +-
 lib/portage/util/_urlopen.py                       |   6 +-
 lib/portage/util/compression_probe.py              |   4 +-
 lib/portage/util/elf/constants.py                  |   3 +-
 lib/portage/util/file_copy.py                      | 137 +++
 lib/portage/util/file_copy/__init__.py             |  36 -
 lib/portage/util/file_copy/meson.build             |   7 -
 lib/portage/util/futures/_asyncio/__init__.py      | 150 +++-
 lib/portage/util/futures/compat_coroutine.py       | 142 ---
 lib/portage/util/futures/meson.build               |   1 -
 lib/portage/util/futures/unix_events.py            |  11 +-
 lib/portage/util/locale.py                         |  14 +-
 lib/portage/util/meson.build                       |   2 +-
 lib/portage/util/movefile.py                       |   5 +
 lib/portage/util/socks5.py                         |  39 +-
 lib/portage/util/whirlpool.py                      |   2 -
 lib/portage/util/writeable_check.py                |   7 +-
 lib/portage/versions.py                            |   6 +-
 man/ebuild.5                                       |  58 +-
 man/emaint.1                                       |  18 +-
 man/emerge.1                                       |  36 +-
 man/make.conf.5                                    |  65 +-
 man/portage.5                                      |  39 +-
 meson.build                                        |  16 +-
 misc/emerge-delta-webrsync                         |  75 +-
 pylintrc                                           |   9 +-
 src/meson.build                                    |  29 -
 src/portage_util__whirlpool.c                      |  46 +-
 src/portage_util_file_copy_reflink_linux.c         | 396 ---------
 src/portage_util_libc.c                            |  67 --
 244 files changed, 6978 insertions(+), 4790 deletions(-)

diff --cc bin/ebuild-helpers/emake
index 21da858458,33af49f831..8a919a7a83
--- a/bin/ebuild-helpers/emake
+++ b/bin/ebuild-helpers/emake
@@@ -9,11 -9,10 +9,11 @@@
  #
  # With newer EAPIs, we also automatically fail the build if make itself fails.
  
- source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+ source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
  
  cmd=(
 -      ${MAKE:-make} ${MAKEOPTS} "$@" ${EXTRA_EMAKE}
 +    # PREFIX LOCAL: force SHELL to be set (don't use possibly ancient /bin/sh)
 +      ${MAKE:-make} SHELL="${BASH:-/bin/bash}" ${MAKEOPTS} "$@" ${EXTRA_EMAKE}
  )
  
  if [[ ${PORTAGE_QUIET} != 1 ]] ; then
diff --cc bin/ebuild-pyhelper
index afed4d4d56,1af05f479f..595e8524e8
--- a/bin/ebuild-pyhelper
+++ b/bin/ebuild-pyhelper
@@@ -11,12 -11,10 +11,12 @@@ f
  
  # Use safe cwd, avoiding unsafe import for bug #469338.
  cd "${PORTAGE_PYM_PATH}" || exit 1
- for path in "${PORTAGE_BIN_PATH}/${0##*/}"{.py,}; do
+ 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:-/usr/bin/python}" "${path}" "$@"
 +                      exec "${PORTAGE_PYTHON:-@PREFIX_PORTAGE_PYTHON@}" 
"${path}" "$@"
 +              # END PREFIX LOCAL
        fi
  done
  echo "File not found: ${path}" >&2
diff --cc bin/emerge-webrsync
index 9959b6a5a7,e908a97cbc..5007e1c498
--- a/bin/emerge-webrsync
+++ b/bin/emerge-webrsync
@@@ -655,97 -602,82 +602,87 @@@ do_latest_snapshot() 
                        break
                fi
  
-               if do_snapshot 0 "${snapshot_date}"; then
-                       r=0
-                       break;
-               fi
+               do_snapshot 0 "${snapshot_date}" && break
        done
- 
-       return "${r}"
- }
- 
- usage() {
-       cat <<-EOF
-       Usage: $0 [options]
- 
-       Options:
-         --revert=yyyymmdd   Revert to snapshot
-         --no-pgp-verify     Disable PGP verification of snapshot
-         -k, --keep          Keep snapshots in DISTDIR (don't delete)
-         -q, --quiet         Only output errors
-         -v, --verbose       Enable verbose output (no-op)
-         -x, --debug         Enable debug output
-         -h, --help          This help screen (duh!)
-       EOF
-       if [[ -n $* ]] ; then
-               printf "\nError: %s\n" "$*" 1>&2
-               exit 1
-       else
-               exit 0
-       fi
  }
  
- main() {
-       local arg
-       local revert_date
+ # Determine whether emerge-webrsync was executed by portage.
+ from_portage=${PORTAGE_BIN_PATH:+1}
  
-       for arg in "$@" ; do
-               local v=${arg#*=}
-               case ${arg} in
-                       -h|--help)    usage ;;
-                       -k|--keep)    keep=true ;;
-                       -q|--quiet)   PORTAGE_QUIET=1 ;;
-                       -v|--verbose) unset PORTAGE_QUIET ;;
-                       -x|--debug)   do_debug=1 ;;
-                       --revert=*)   revert_date=${v} ;;
-                       --no-pgp-verify) no_pgp_verify=1 ;;
-                       *)            usage "Invalid option '${arg}'" ;;
-               esac
-       done
- 
-       handle_pgp_setup
+ # Use emerge and portageq from the same directory/prefix as the current 
script,
+ # so that we don't have to rely on PATH including the current EPREFIX.
+ if ! emerge=$(PATH=${BASH_SOURCE%/*}:${PATH} type -P emerge); then
+       die "could not find 'emerge'; aborting"
+ fi
+ if ! portageq=$(PATH=${BASH_SOURCE%/*}:${PATH} type -P portageq); then
+       die "could not find 'portageq'; aborting"
+ fi
  
-       [[ -d ${repo_location} ]] || mkdir -p "${repo_location}"
-       if [[ ! -w ${repo_location} ]] ; then
-               die "Repository '${repo_name}' is not writable: 
${repo_location}"
-       fi
+ portage_vars=(
+       DISTDIR
+       EPREFIX
+       FEATURES
+       FETCHCOMMAND
+       GENTOO_MIRRORS
+       PORTAGE_BIN_PATH
+       PORTAGE_GPG_DIR
+       PORTAGE_GRPNAME
+       PORTAGE_NICENESS
+       PORTAGE_REPOSITORIES
+       PORTAGE_RSYNC_EXTRA_OPTS
+       PORTAGE_RSYNC_OPTS
+       PORTAGE_TEMP_GPG_DIR
+       PORTAGE_TMPDIR
+       PORTAGE_USERNAME
+       USERLAND
+       ftp_proxy
+       http_proxy
+       https_proxy
+ )
+ 
+ eval "$("${portageq}" envvar -v "${portage_vars[@]}")"
+ export http_proxy https_proxy ftp_proxy
  
-       [[ -d ${PORTAGE_TMPDIR}/portage ]] || mkdir -p 
"${PORTAGE_TMPDIR}/portage"
-       TMPDIR=$(mktemp -d "${PORTAGE_TMPDIR}/portage/webrsync-XXXXXX")
-       if [[ ! -w ${TMPDIR} ]] ; then
-               die "TMPDIR is not writable: ${TMPDIR}"
-       fi
-       trap 'set -u ; cd / ; rm -rf "${TMPDIR}"' EXIT
-       cd "${TMPDIR}" || exit 1
++# PREFIX LOCAL: use Prefix servers, just because we want this and infra
++# can't support us yet
++GENTOO_MIRRORS="http://rsync.prefix.bitzolder.nl";
++# END PREFIX LOCAL
 +
-       ${keep} || DISTDIR=${TMPDIR}
-       [[ ! -d "${DISTDIR}" ]] && mkdir -p "${DISTDIR}"
+ source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
  
-       if ${keep} && [[ ! -w ${DISTDIR} ]] ; then
-               die "DISTDIR is not writable: ${DISTDIR}"
-       fi
+ # The implementation of die() from isolated-functions.sh is over-engineered 
and
+ # unsuitable for standalone scripts. This one mimics gentoo-functions.
+ die() {
+       case $? in
+               0)
+                       local exitval=1
+                       ;;
+               *)
+                       local exitval=$?
+       esac
+       printf '%s: %s\n' "${0##*/}" "$*" >&2
+       exit "${exitval}"
+ }
  
-       # This is a sanity check to help prevent people like funtoo users
-       # from accidentally wiping out their git tree.
-       if [[ -n ${repo_sync_type} && ${repo_sync_type} != rsync && 
${repo_sync_type} != webrsync ]] ; then
-               eerror "The current sync-type attribute of repository 'gentoo' 
is not set to 'rsync' or 'webrsync':"
-               eerror
-               eerror "  sync-type=${repo_sync_type}"
-               eerror
-               eerror "If you intend to use emerge-webrsync then please"
-               eerror "adjust sync-type and sync-uri attributes to refer to 
rsync."
-               eerror "emerge-webrsync exiting due to abnormal sync-type 
setting."
-               die
-       fi
+ # Opportunistically use gentoo-functions for its implementations of einfo(),
+ # ewarn() and eerror(). As of late, these are better maintained.
+ functions_script="${EPREFIX}/lib/gentoo/functions.sh"
+ if [[ -f ${functions_script} ]]; then
+       source "${functions_script}" || exit
+ fi
  
-       [[ ${do_debug} -eq 1 ]] && set -x
+ repo_name=gentoo
+ repo_location=$(__repo_attr "${repo_name}" location)
+ if [[ -z ${repo_location} ]]; then
+       die "Repository '${repo_name}' not found"
+ fi
+ repo_sync_type=$(__repo_attr "${repo_name}" sync-type)
  
-       if [[ -n ${revert_date} ]] ; then
-               do_snapshot 1 "${revert_date}"
-       else
-               do_latest_snapshot
-       fi
- }
+ # If PORTAGE_NICENESS is overriden via the env then it will
+ # still pass through the portageq call and override properly.
+ if [[ -n "${PORTAGE_NICENESS}" ]]; then
+       renice "${PORTAGE_NICENESS}" $$ > /dev/null
+ fi
  
+ declare -A opt=()
  main "$@"
diff --cc bin/isolated-functions.sh
index 47e18cc6b6,c6ce52928c..08b21e098c
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@@ -450,38 -467,25 +467,33 @@@ els
  fi
  
  
 -if [[ -z ${USERLAND} ]] ; then
 -      case $(uname -s) in
 -      *BSD|DragonFly)
 -              export USERLAND="BSD"
 -              ;;
 -      *)
 -              export USERLAND="GNU"
 -              ;;
 -      esac
 -fi
 +# 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.
 +# Somehow it appears stange to me that this code is in this file,
 +# non-ebuilds/eclasses should never rely on USERLAND and XARGS, don't they?
 +#if [[ -z ${USERLAND} ]] ; then
 +#     case $(uname -s) in
 +#     *BSD|DragonFly)
 +#             export USERLAND="BSD"
 +#             ;;
 +#     *)
 +#             export USERLAND="GNU"
 +#             ;;
 +#     esac
 +#fi
 +[[ -z ${USERLAND} ]] && USERLAND="GNU"
 +# END PREFIX LOCAL
  
  if [[ -z ${XARGS} ]] ; then
-       case ${USERLAND} in
-       BSD)
-               if type -P gxargs > /dev/null; then
-                       export XARGS="gxargs -r"
-               else
-                       export XARGS="xargs"
-               fi
-               ;;
-       *)
+       if XARGS=$(type -P gxargs); then
+               export XARGS+=" -r"
+       elif : | xargs -r 2>/dev/null; then
                export XARGS="xargs -r"
-               ;;
-       esac
+       else
+               export XARGS="xargs"
+       fi
  fi
  
  ___makeopts_jobs() {
diff --cc bin/misc-functions.sh
index 47ee72917d,d414e11f8f..3951e57782
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@@ -282,154 -257,18 +284,164 @@@ install_qa_check_misc() 
                        "${PORTAGE_BIN_PATH}"/estrip --prepallstrip
                fi
        fi
+ 
+       # Prematurely delete WORKDIR in case merge-wait is enabled to
+       # decrease the space used by portage build directories until the
+       # packages are merged and cleaned.
+       if contains_word merge-wait "${FEATURES}" \
+               && ! contains_word keepwork "${FEATURES}" \
+               && ! contains_word noclean "${FEATURES}"
+       then
+               rm -rf "${WORKDIR}"
+       fi
  }
  
 +install_qa_check_macho() {
 +      if ! has binchecks ${RESTRICT} ; then
 +              # on Darwin, dynamic libraries are called .dylibs instead of
 +              # .sos.  In addition the version component is before the
 +              # extension, not after it.  Check for this, and *only* warn
 +              # about it.  Some packages do ship .so files on Darwin and make
 +              # it work (ugly!).
 +              rm -f "${T}/mach-o.check"
 +              find ${ED%/} -name "*.so" -or -name "*.so.*" | \
 +              while read i ; do
 +                      [[ $(file $i) == *"Mach-O"* ]] && \
 +                              echo "${i#${D}}" >> "${T}/mach-o.check"
 +              done
 +              if [[ -f ${T}/mach-o.check ]] ; then
 +                      f=$(< "${T}/mach-o.check")
 +                      __vecho -ne '\a\n'
 +                      eqawarn "QA Notice: Found .so dynamic libraries on 
Darwin:"
 +                      eqawarn "    ${f//$'\n'/\n    }"
 +              fi
 +              rm -f "${T}/mach-o.check"
 +
 +              # The naming for dynamic libraries is different on Darwin; the
 +              # version component is before the extention, instead of after
 +              # it, as with .sos.  Again, make this a warning only.
 +              rm -f "${T}/mach-o.check"
 +              find ${ED%/} -name "*.dylib.*" | \
 +              while read i ; do
 +                      echo "${i#${D}}" >> "${T}/mach-o.check"
 +              done
 +              if [[ -f "${T}/mach-o.check" ]] ; then
 +                      f=$(< "${T}/mach-o.check")
 +                      __vecho -ne '\a\n'
 +                      eqawarn "QA Notice: Found wrongly named dynamic 
libraries on Darwin:"
 +                      eqawarn "    ${f// /\n    }"
 +              fi
 +              rm -f "${T}/mach-o.check"
 +      fi
 +
 +      install_name_is_relative() {
 +              case $1 in
 +                      "@executable_path/"*)  return 0  ;;
 +                      "@loader_path"/*)      return 0  ;;
 +                      "@rpath/"*)            return 0  ;;
 +                      *)                     return 1  ;;
 +              esac
 +      }
 +
 +      # While we generate the NEEDED files, check that we don't get kernel
 +      # traps at runtime because of broken install_names on Darwin.
 +      rm -f "${T}"/.install_name_check_failed
 +      scanmacho -qyRF '%a;%p;%S;%n' "${D}" | { while IFS= read l ; do
 +              arch=${l%%;*}; l=${l#*;}
 +              obj="/${l%%;*}"; l=${l#*;}
 +              install_name=${l%%;*}; l=${l#*;}
 +              needed=${l%%;*}; l=${l#*;}
 +
 +              ignore=
 +              qa_var="QA_IGNORE_INSTALL_NAME_FILES_${ARCH/-/_}"
 +              eval "[[ -n \${!qa_var} ]] &&
 +                      QA_IGNORE_INSTALL_NAME_FILES=(\"\${${qa_var}[@]}\")"
 +
 +              if [[ ${#QA_IGNORE_INSTALL_NAME_FILES[@]} -gt 1 ]] ; then
 +                      for x in "${QA_IGNORE_INSTALL_NAME_FILES[@]}" ; do
 +                              [[ ${obj##*/} == ${x} ]] && \
 +                                      ignore=true
 +                      done
 +              else
 +                      local shopts=$-
 +                      set -o noglob
 +                      for x in ${QA_IGNORE_INSTALL_NAME_FILES} ; do
 +                              [[ ${obj##*/} == ${x} ]] && \
 +                                      ignore=true
 +                      done
 +                      set +o noglob
 +                      set -${shopts}
 +              fi
 +
 +              # See if the self-reference install_name points to an existing
 +              # and to be installed file.  This usually is a symlink for the
 +              # major version.
 +              if install_name_is_relative ${install_name} ; then
 +                      # try to locate the library in the installed image
 +                      local inpath=${install_name#@*/}
 +                      local libl
 +                      for libl in $(find "${ED}" -name "${inpath##*/}") ; do
 +                              if [[ ${libl} == */${inpath} ]] ; then
 +                                      install_name=/${libl#${D}}
 +                                      break
 +                              fi
 +                      done
 +              fi
 +              if [[ ! -e ${D}${install_name} ]] ; then
 +                      eqawarn "QA Notice: invalid self-reference install_name 
${install_name} in ${obj}"
 +                      # remember we are in an implicit subshell, that's
 +                      # why we touch a file here ... ideally we should be
 +                      # able to die correctly/nicely here
 +                      [[ -z ${ignore} ]] && touch 
"${T}"/.install_name_check_failed
 +              fi
 +
 +              # this is ugly, paths with spaces won't work
 +              for lib in ${needed//,/ } ; do
 +                      if [[ ${lib} == ${D}* ]] ; then
 +                              eqawarn "QA Notice: install_name references 
\${D}: ${lib} in ${obj}"
 +                              [[ -z ${ignore} ]] && touch 
"${T}"/.install_name_check_failed
 +                      elif [[ ${lib} == ${S}* ]] ; then
 +                              eqawarn "QA Notice: install_name references 
\${S}: ${lib} in ${obj}"
 +                              [[ -z ${ignore} ]] && touch 
"${T}"/.install_name_check_failed
 +                      elif ! install_name_is_relative ${lib} ; then
 +                              local isok=no
 +                              if [[ -e ${lib} || -e ${D}${lib} ]] ; then
 +                                      isok=yes  # yay, we're ok
 +                              elif [[ -e "${EROOT}"/MacOSX.sdk ]] ; then
 +                                      # trigger SDK mode, at least since Big 
Sur (11.0)
 +                                      # there are no libraries in /usr/lib 
any more, but
 +                                      # there are references too it (some 
library cache is
 +                                      # in place), yet we can validate it 
sort of is sane
 +                                      # by looking at the SDK metacaches, 
TAPI-files, .tbd
 +                                      # text versions of libraries, so just 
look there
 +                                      local tbd=${lib%.*}.tbd
 +                                      if [[ -e 
${EROOT}/MacOSX.sdk/${lib%.*}.tbd ]] ; then
 +                                              isok=yes  # it's in the SDK, so 
ok
 +                                      elif [[ -e 
${EROOT}/MacOSX.sdk/${lib}.tbd ]] ; then
 +                                              isok=yes  # this happens in 
case of Framework refs
 +                                      fi
 +                              fi
 +                              if [[ ${isok} == no ]] ; then
 +                                      eqawarn "QA Notice: invalid reference 
to ${lib} in ${obj}"
 +                                      [[ -z ${ignore} ]] && \
 +                                              touch 
"${T}"/.install_name_check_failed
 +                              fi
 +                      fi
 +              done
 +
 +              # backwards compatibility
 +              echo "${obj} ${needed}" >> 
"${PORTAGE_BUILDDIR}"/build-info/NEEDED
 +              # what we use
 +              echo "${arch};${obj};${install_name};${needed}" >> 
"${PORTAGE_BUILDDIR}"/build-info/NEEDED.MACHO.3
 +      done }
 +      if [[ -f ${T}/.install_name_check_failed ]] ; then
 +              # secret switch "allow_broken_install_names" to get
 +              # around this and install broken crap (not a good idea)
 +              has allow_broken_install_names ${FEATURES} || \
 +                      die "invalid install_name found, your application or 
library will crash at runtime"
 +      fi
 +}
 +
  __dyn_instprep() {
        if [[ -e ${PORTAGE_BUILDDIR}/.instprepped ]] ; then
                __vecho ">>> It appears that '${PF}' is already instprepped; 
skipping."
diff --cc bin/phase-functions.sh
index 31b02cedfc,f809231961..3652acc0a2
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@@ -116,38 -143,39 +143,40 @@@ __filter_readonly_variables() 
                fi
        fi
        if ___eapi_has_PORTDIR_ECLASSDIR; then
-               filtered_vars+=" PORTDIR ECLASSDIR"
+               filtered_vars+=( PORTDIR ECLASSDIR )
        fi
  
-       if has --filter-sandbox $* ; then
-               filtered_vars="${filtered_vars} SANDBOX_.*"
+       if has --filter-sandbox "$@"; then
+               filtered_vars+=( "SANDBOX_.*" )
        else
-               filtered_vars="${filtered_vars} ${filtered_sandbox_vars}"
+               filtered_vars+=( "${filtered_sandbox_vars[@]}" )
        fi
-       if has --filter-features $* ; then
-               filtered_vars="${filtered_vars} FEATURES PORTAGE_FEATURES"
+       if has --filter-features "$@"; then
+               filtered_vars+=( FEATURES PORTAGE_FEATURES )
        fi
-       if has --filter-path $* ; then
-               filtered_vars+=" PATH"
+       if has --filter-path "$@"; then
+               filtered_vars+=( PATH )
        fi
-       if has --filter-locale $* ; then
-               filtered_vars+=" LANG LC_ALL LC_COLLATE
-                       LC_CTYPE LC_MESSAGES LC_MONETARY
-                       LC_NUMERIC LC_PAPER LC_TIME"
+       if has --filter-locale "$@"; then
+               filtered_vars+=(
+                       LANG LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY
+                       LC_NUMERIC LC_PAPER LC_TIME
+               )
        fi
-       if ! has --allow-extra-vars $* ; then
-               if [[ "${EMERGE_FROM}" = binary ]]; then
-                       # preserve additional variables from build time,
-                       # while excluding untrusted variables
-                       filtered_vars+=" ${binpkg_untrusted_vars}"
-               else
-                       filtered_vars+=" ${PORTAGE_SAVED_READONLY_VARS}"
-                       filtered_vars+=" ${PORTAGE_MUTABLE_FILTERED_VARS}"
-               fi
+       if has --allow-extra-vars "$@"; then
+               :
+       elif [[ "${EMERGE_FROM}" = binary ]]; then
+               # Preserve additional variables from build time, while
+               # excluding untrusted variables.
+               filtered_vars+=( "${binpkg_untrusted_vars[@]}" )
+       else
+               read -rd '' -a words <<<"${PORTAGE_SAVED_READONLY_VARS} 
${PORTAGE_MUTABLE_FILTERED_VARS}"
+               filtered_vars+=( "${words[@]}" )
        fi
  
 -      "${PORTAGE_PYTHON:-/usr/bin/python}" 
"${PORTAGE_BIN_PATH}"/filter-bash-environment.py "${filtered_vars[*]}" \
 +    # 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"
++      "${PORTAGE_PYTHON:-@PREFIX_PORTAGE_PYTHON@}" 
"${PORTAGE_BIN_PATH}"/filter-bash-environment.py "${filtered_vars[*]}" \
+       || die "filter-bash-environment.py failed"
  }
  
  # @FUNCTION: __preprocess_ebuild_env
diff --cc bin/save-ebuild-env.sh
index c3c83c91d2,5d5d25bbd7..d4160ef0f9
mode 100755,100644..100755
--- a/bin/save-ebuild-env.sh
+++ b/bin/save-ebuild-env.sh
@@@ -119,14 -127,6 +127,10 @@@ __save_ebuild_env() 
        # user config variables
        unset DOC_SYMLINKS_DIR INSTALL_MASK PKG_INSTALL_MASK
  
 +      # PREFIX LOCAL: Prefix additions
 +      unset EXTRA_PATH PORTAGE_GROUP PORTAGE_USER
 +      # END PREFIX LOCAL
 +
        declare -p
        declare -fp
-       if [[ ${BASH_VERSINFO[0]} == 3 ]]; then
-               export
-       fi
-       )
- }
+ )
diff --cc lib/portage/dbapi/bintree.py
index 005681adcf,90f213f1cb..77afb3f808
--- a/lib/portage/dbapi/bintree.py
+++ b/lib/portage/dbapi/bintree.py
@@@ -132,9 -136,11 +136,13 @@@ class bindbapi(fakedbapi)
              "SLOT",
              "USE",
              "_mtime_",
 +            # PREFIX LOCAL
 +            "EPREFIX",
          }
+         # Keys required only when initially adding a package.
+         self._init_aux_keys = {
+             "REPO_REVISIONS",
+         }
          self._aux_cache = {}
          self._aux_cache_slot_dict_cache = None
  
diff --cc lib/portage/process.py
index 2365778e6a,3f2c48e927..98ffabcc82
--- a/lib/portage/process.py
+++ b/lib/portage/process.py
@@@ -35,11 -38,9 +38,11 @@@ portage.proxy.lazyimport.lazyimport
  )
  
  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.proxy.objectproxy import ObjectProxy
- from portage.util._ctypes import find_library, LoadLibrary, ctypes
+ from portage.util._ctypes import load_libc, LoadLibrary, ctypes
  
  try:
      from portage.util.netlink import RtNetlink
diff --cc man/ebuild.5
index 687c4f9d85,b83ea46e17..556fef735f
--- a/man/ebuild.5
+++ b/man/ebuild.5
@@@ -928,6 -922,6 +922,12 @@@ shared libraries that have SONAMEs but 
  symlink in the same directory. The paths may contain regular expressions
  with escape\-quoted special characters.
  .TP
++.B QA_IGNORE_INSTALL_NAME_FILES
++This should contain a list of file names (without path) that should be
++ignored in the install_name check.  That is, if these files point to
++something not available in the image directory or live filesystem, these
++files are ignored, albeit being broken.
++.TP
  .B QA_TEXTRELS
  This variable can be set to a list of file paths, relative to the image
  directory, of files that contain text relocations that cannot be eliminated.
diff --cc man/make.conf.5
index cfd8434550,97178093fd..bd69a596da
--- a/man/make.conf.5
+++ b/man/make.conf.5
@@@ -718,10 -736,12 +739,15 @@@ dependencies
  .TP
  .B sandbox
  Enable sandbox\-ing when running \fBemerge\fR(1) and \fBebuild\fR(1).
 +On Mac OS X platforms that have /usr/bin/sandbox-exec available (10.5
 +and later), this particular sandbox implementation is used instead of
 +sys-apps/sandbox.
  .TP
+ .B selinux
+ Enable SELinux awareness.  Portage will install objects to the filesystem with
+ a SELinux context calculated from the current loaded policy.
+ Do not toggle this \fBFEATURE\fR yourself.
+ .TP
  .B sesandbox
  Enable SELinux sandbox\-ing.  Do not toggle this \fBFEATURE\fR yourself.
  .TP


Reply via email to