commit:     6bb0b79ecb88e536b2cdea570b0972c798170c4f
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 24 09:44:45 2022 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Jul 24 09:45:31 2022 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=6bb0b79e

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

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

 .gitignorerevs => .git-blame-ignore-revs           |    4 +
 .github/workflows/black.yml                        |    8 +
 .github/workflows/ci.yml                           |    6 +-
 .gitignore                                         |    2 -
 DEVELOPING                                         |   40 +-
 MANIFEST.in                                        |    3 +
 NEWS                                               |  215 +-
 README.md                                          |    9 +-
 RELEASE-NOTES                                      |    3 +
 bin/archive-conf                                   |   46 +-
 bin/binhost-snapshot                               |  264 ++-
 bin/check-implicit-pointer-usage.py                |    2 +-
 bin/chmod-lite.py                                  |    2 +-
 bin/chpathtool.py                                  |    2 +-
 bin/clean_locks                                    |   58 +-
 bin/dispatch-conf                                  |  347 +--
 bin/dohtml.py                                      |    4 +-
 bin/doins.py                                       |    2 +-
 bin/eapi.sh                                        |  134 +-
 bin/ebuild                                         |  514 ++--
 bin/ebuild-helpers/dosym                           |    2 +-
 bin/ebuild-ipc.py                                  |    2 +-
 bin/ebuild.sh                                      |  120 +-
 bin/egencache                                      | 2437 ++++++++++---------
 bin/emaint                                         |   45 +-
 bin/emerge                                         |  130 +-
 bin/emirrordist                                    |   20 +-
 bin/env-update                                     |   46 +-
 bin/estrip                                         |   22 +-
 bin/filter-bash-environment.py                     |   20 +-
 bin/fixpackages                                    |   42 +-
 bin/glsa-check                                     |  705 +++---
 bin/{xpak-helper.py => gpkg-helper.py}             |   33 +-
 bin/install-qa-check.d/05prefix                    |    4 +-
 bin/install-qa-check.d/10ignored-flags             |    5 +-
 bin/install-qa-check.d/20runtime-directories       |    4 +-
 bin/install-qa-check.d/60pkgconfig                 |  118 +-
 bin/install-qa-check.d/95empty-dirs                |    2 +-
 bin/install.py                                     |    2 +-
 bin/isolated-functions.sh                          |   31 +-
 bin/lock-helper.py                                 |    2 +-
 bin/misc-functions.sh                              |  140 +-
 bin/phase-functions.sh                             |   42 +-
 bin/phase-helpers.sh                               |  230 +-
 bin/pid-ns-init                                    |   42 +-
 bin/portageq                                       | 2451 +++++++++++---------
 bin/quickpkg                                       |  718 +++---
 bin/regenworld                                     |  209 +-
 bin/save-ebuild-env.sh                             |    7 -
 bin/shelve-utils                                   |   40 +-
 bin/socks5-server.py                               |    4 +-
 bin/xattr-helper.py                                |    4 +-
 bin/xpak-helper.py                                 |    2 +-
 cnf/dispatch-conf.conf                             |    6 +-
 cnf/make.conf.example                              |   36 +
 cnf/make.globals                                   |   25 +-
 doc/package/ebuild.docbook                         |    2 -
 doc/package/ebuild/eapi/4-python.docbook           |  160 --
 doc/package/ebuild/eapi/5-progress.docbook         |  247 --
 doc/portage.docbook                                |    2 -
 lib/_emerge/Binpkg.py                              |   13 +-
 lib/_emerge/BinpkgExtractorAsync.py                |    9 +
 lib/_emerge/BinpkgFetcher.py                       |   31 +-
 lib/_emerge/EbuildBinpkg.py                        |   16 +-
 lib/_emerge/EbuildMetadataPhase.py                 |   17 -
 lib/_emerge/EbuildPhase.py                         |   33 +-
 lib/_emerge/MiscFunctionsProcess.py                |   11 +
 lib/_emerge/Package.py                             |   60 +-
 lib/_emerge/Scheduler.py                           |    2 +-
 lib/_emerge/actions.py                             |  107 +-
 lib/_emerge/depgraph.py                            |   48 +-
 lib/_emerge/is_valid_package_atom.py               |    2 +-
 lib/_emerge/main.py                                |  105 +-
 lib/_emerge/resolver/output.py                     |    2 +-
 lib/_emerge/resolver/package_tracker.py            |    8 +-
 lib/_emerge/resolver/slot_collision.py             |   32 +-
 lib/portage/__init__.py                            |   74 +-
 lib/portage/_global_updates.py                     |   74 +-
 lib/portage/_sets/__init__.py                      |    2 +-
 lib/portage/_sets/base.py                          |    2 +-
 lib/portage/_sets/files.py                         |    8 +-
 lib/portage/binpkg.py                              |   56 +
 lib/portage/cache/anydbm.py                        |    4 +-
 lib/portage/cache/cache_errors.py                  |    2 +-
 lib/portage/cache/mappings.py                      |    4 +-
 lib/portage/cache/sql_template.py                  |    6 +-
 lib/portage/checksum.py                            |   39 +-
 lib/portage/const.py                               |   72 +-
 lib/portage/data.py                                |   65 +-
 lib/portage/dbapi/_MergeProcess.py                 |   22 +
 lib/portage/dbapi/__init__.py                      |   40 +-
 lib/portage/dbapi/bintree.py                       |  529 ++++-
 lib/portage/dbapi/porttree.py                      |    6 +-
 lib/portage/dbapi/vartree.py                       |  176 +-
 lib/portage/dep/__init__.py                        |  152 +-
 lib/portage/dep/dep_check.py                       |    8 +-
 lib/portage/dispatch_conf.py                       |   99 +-
 lib/portage/eapi.py                                |  495 ++--
 lib/portage/eclass_cache.py                        |   11 +-
 lib/portage/exception.py                           |   26 +-
 lib/portage/getbinpkg.py                           |  245 +-
 lib/portage/glsa.py                                |  177 +-
 lib/portage/gpg.py                                 |  106 +
 lib/portage/gpkg.py                                | 2016 ++++++++++++++++
 lib/portage/localization.py                        |    8 +-
 lib/portage/mail.py                                |   16 +-
 lib/portage/manifest.py                            |  412 ++--
 lib/portage/metadata.py                            |   34 +-
 lib/portage/module.py                              |   76 +-
 lib/portage/news.py                                |   75 +-
 lib/portage/output.py                              |   75 +-
 lib/portage/package/ebuild/_config/UseManager.py   |  176 --
 .../package/ebuild/_config/special_env_vars.py     |    2 +-
 .../package/ebuild/_config/unpack_dependencies.py  |   55 -
 lib/portage/package/ebuild/config.py               |  112 +-
 lib/portage/package/ebuild/doebuild.py             |   22 +-
 lib/portage/package/ebuild/fetch.py                |    2 +-
 lib/portage/sync/modules/git/git.py                |   43 +-
 .../06B3A311BD775C280D22A9305D90EA06352177F6.rev   |   37 +
 .../8DEDA2CDED49C8809287B89D8812797DDF1DD192.rev   |   37 +
 .../273B030399E7BEA66A9AD42216DE7CA17BA5D42E.key   |  Bin 0 -> 2055 bytes
 .../C99796FB85B0C3DF03314A11B5850C51167D6282.key   |  Bin 0 -> 2055 bytes
 lib/portage/tests/.gnupg/pubring.kbx               |  Bin 0 -> 2774 bytes
 lib/portage/tests/.gnupg/trustdb.gpg               |  Bin 0 -> 1360 bytes
 lib/portage/tests/__init__.py                      |   37 +-
 lib/portage/tests/bin/test_filter_bash_env.py      |    4 +-
 lib/portage/tests/dep/testAtom.py                  |   34 +-
 lib/portage/tests/dep/test_isvalidatom.py          |    9 -
 lib/portage/tests/emerge/test_simple.py            |   47 +-
 .../portage/tests/gpkg}/__init__.py                |    0
 .../tests => lib/portage/tests/gpkg}/__test__.py   |    0
 lib/portage/tests/gpkg/test_gpkg_checksum.py       |  396 ++++
 lib/portage/tests/gpkg/test_gpkg_gpg.py            |  398 ++++
 .../tests/gpkg/test_gpkg_metadata_update.py        |   59 +
 lib/portage/tests/gpkg/test_gpkg_metadata_url.py   |  173 ++
 lib/portage/tests/gpkg/test_gpkg_path.py           |  390 ++++
 lib/portage/tests/gpkg/test_gpkg_size.py           |   58 +
 lib/portage/tests/gpkg/test_gpkg_stream.py         |  112 +
 .../test_lazy_import_portage_baseline.py           |    2 +-
 lib/portage/tests/process/test_PipeLogger.py       |   14 +-
 lib/portage/tests/process/test_PopenProcess.py     |    2 +-
 .../tests/process/test_PopenProcessBlockingIO.py   |    2 +-
 lib/portage/tests/process/test_poll.py             |    2 +-
 lib/portage/tests/resolver/ResolverPlayground.py   |   71 +-
 .../test_build_id_profile_format.py                |   50 +-
 .../binpkg_multi_instance/test_rebuilt_binaries.py |   44 +-
 .../tests/resolver/soname/test_autounmask.py       |   38 +-
 .../tests/resolver/soname/test_downgrade.py        |   84 +-
 .../tests/resolver/soname/test_or_choices.py       |   39 +-
 .../tests/resolver/soname/test_reinstall.py        |   40 +-
 .../tests/resolver/soname/test_skip_update.py      |   39 +-
 .../soname/test_slot_conflict_reinstall.py         |  135 +-
 .../resolver/soname/test_slot_conflict_update.py   |   38 +-
 .../tests/resolver/soname/test_soname_provided.py  |   45 +-
 .../tests/resolver/soname/test_unsatisfiable.py    |   40 +-
 .../tests/resolver/soname/test_unsatisfied.py      |   40 +-
 .../tests/resolver/test_autounmask_binpkg_use.py   |   38 +-
 lib/portage/tests/resolver/test_bdeps.py           |   44 +-
 .../resolver/test_binary_pkg_ebuild_visibility.py  |   35 +-
 lib/portage/tests/resolver/test_changed_deps.py    |   41 +-
 ...test_complete_if_new_subslot_without_revbump.py |   40 +-
 .../resolver/test_disjunctive_depend_order.py      |   34 +-
 lib/portage/tests/resolver/test_installkernel.py   |   93 +
 lib/portage/tests/resolver/test_multirepo.py       |   62 +-
 .../test_regular_slot_change_without_revbump.py    |   41 +-
 lib/portage/tests/resolver/test_simple.py          |   34 +-
 lib/portage/tests/resolver/test_slot_abi.py        |  113 +-
 .../tests/resolver/test_slot_abi_downgrade.py      |   77 +-
 .../resolver/test_slot_change_without_revbump.py   |   40 +-
 .../resolver/test_slot_operator_autounmask.py      |   40 +-
 .../tests/resolver/test_slot_operator_bdeps.py     |   74 +-
 .../tests/resolver/test_slot_operator_rebuild.py   |   40 +-
 .../tests/resolver/test_slot_operator_unsolved.py  |   41 +-
 .../tests/resolver/test_unecessary_slot_upgrade.py |   11 -
 lib/portage/tests/resolver/test_useflags.py        |   37 +-
 lib/portage/tests/runTests.py                      |   14 +-
 lib/portage/tests/update/test_move_ent.py          |  129 +-
 lib/portage/tests/update/test_move_slot_ent.py     |  139 +-
 lib/portage/tests/update/test_update_dbentry.py    |  168 +-
 lib/portage/tests/util/file_copy/test_copyfile.py  |    6 +-
 lib/portage/tests/util/test_install_mask.py        |   33 +-
 lib/portage/tests/util/test_mtimedb.py             |  362 +++
 lib/portage/tests/xpak/test_decodeint.py           |    2 +-
 lib/portage/util/_urlopen.py                       |    4 +-
 lib/portage/util/backoff.py                        |    2 +-
 lib/portage/util/changelog.py                      |    2 +-
 lib/portage/util/install_mask.py                   |   18 +-
 lib/portage/util/lafilefixer.py                    |    6 +-
 lib/portage/util/movefile.py                       |   16 +-
 lib/portage/util/mtimedb.py                        |  102 +-
 lib/portage/util/whirlpool.py                      |   16 +-
 lib/portage/versions.py                            |   82 +-
 lib/portage/xml/metadata.py                        |    2 +-
 man/ebuild.1                                       |   35 +-
 man/ebuild.5                                       |   86 +-
 man/make.conf.5                                    |  100 +-
 man/portage.5                                      |   52 +-
 pylintrc                                           |    1 -
 repoman/.repoman_not_installed                     |    0
 repoman/MANIFEST.in                                |    4 -
 repoman/NEWS                                       |   14 -
 repoman/README                                     |   49 -
 repoman/RELEASE-NOTES                              |  213 --
 repoman/TEST-NOTES                                 |   45 -
 repoman/bin/repoman                                |   52 -
 repoman/cnf/linechecks/linechecks.yaml             |   34 -
 repoman/cnf/metadata.xsd                           |  548 -----
 repoman/cnf/qa_data/qa_data.yaml                   |  139 --
 repoman/cnf/repository/linechecks.yaml             |  251 --
 repoman/cnf/repository/qa_data.yaml                |  163 --
 repoman/cnf/repository/repository.yaml             |   76 -
 repoman/lib/repoman/__init__.py                    |  103 -
 repoman/lib/repoman/_portage.py                    |   26 -
 repoman/lib/repoman/_subprocess.py                 |   58 -
 repoman/lib/repoman/actions.py                     |  828 -------
 repoman/lib/repoman/argparser.py                   |  388 ----
 repoman/lib/repoman/check_missingslot.py           |   39 -
 repoman/lib/repoman/checks/__init__.py             |    0
 repoman/lib/repoman/config.py                      |  172 --
 repoman/lib/repoman/copyrights.py                  |  143 --
 repoman/lib/repoman/errors.py                      |   21 -
 repoman/lib/repoman/gpg.py                         |   73 -
 repoman/lib/repoman/main.py                        |  255 --
 repoman/lib/repoman/metadata.py                    |   89 -
 repoman/lib/repoman/modules/__init__.py            |    0
 repoman/lib/repoman/modules/commit/__init__.py     |    0
 repoman/lib/repoman/modules/commit/manifest.py     |  122 -
 repoman/lib/repoman/modules/commit/repochecks.py   |   44 -
 repoman/lib/repoman/modules/linechecks/__init__.py |    0
 .../modules/linechecks/assignment/__init__.py      |   27 -
 .../modules/linechecks/assignment/assignment.py    |   38 -
 repoman/lib/repoman/modules/linechecks/base.py     |  115 -
 repoman/lib/repoman/modules/linechecks/config.py   |  149 --
 .../lib/repoman/modules/linechecks/controller.py   |  164 --
 .../repoman/modules/linechecks/depend/__init__.py  |   21 -
 .../repoman/modules/linechecks/depend/implicit.py  |   38 -
 .../modules/linechecks/deprecated/__init__.py      |   46 -
 .../modules/linechecks/deprecated/deprecated.py    |   35 -
 .../modules/linechecks/deprecated/inherit.py       |   67 -
 .../lib/repoman/modules/linechecks/do/__init__.py  |   21 -
 repoman/lib/repoman/modules/linechecks/do/dosym.py |   20 -
 .../repoman/modules/linechecks/eapi/__init__.py    |   51 -
 .../lib/repoman/modules/linechecks/eapi/checks.py  |   79 -
 .../repoman/modules/linechecks/eapi/definition.py  |   35 -
 .../repoman/modules/linechecks/emake/__init__.py   |   27 -
 .../lib/repoman/modules/linechecks/emake/emake.py  |   25 -
 .../modules/linechecks/gentoo_header/__init__.py   |   21 -
 .../modules/linechecks/gentoo_header/header.py     |   56 -
 .../repoman/modules/linechecks/helpers/__init__.py |   21 -
 .../repoman/modules/linechecks/helpers/offset.py   |   21 -
 .../repoman/modules/linechecks/nested/__init__.py  |   21 -
 .../repoman/modules/linechecks/nested/nested.py    |   14 -
 .../repoman/modules/linechecks/nested/nesteddie.py |    9 -
 .../repoman/modules/linechecks/patches/__init__.py |   21 -
 .../repoman/modules/linechecks/patches/patches.py  |   24 -
 .../repoman/modules/linechecks/phases/__init__.py  |   40 -
 .../lib/repoman/modules/linechecks/phases/phase.py |  188 --
 .../repoman/modules/linechecks/portage/__init__.py |   27 -
 .../repoman/modules/linechecks/portage/internal.py |   32 -
 .../repoman/modules/linechecks/quotes/__init__.py  |   27 -
 .../repoman/modules/linechecks/quotes/quoteda.py   |   15 -
 .../repoman/modules/linechecks/quotes/quotes.py    |   92 -
 .../lib/repoman/modules/linechecks/uri/__init__.py |   21 -
 repoman/lib/repoman/modules/linechecks/uri/uri.py  |   30 -
 .../lib/repoman/modules/linechecks/use/__init__.py |   21 -
 .../repoman/modules/linechecks/use/builtwith.py    |    9 -
 .../repoman/modules/linechecks/useless/__init__.py |   27 -
 .../lib/repoman/modules/linechecks/useless/cd.py   |   24 -
 .../repoman/modules/linechecks/useless/dodoc.py    |   17 -
 .../modules/linechecks/whitespace/__init__.py      |   27 -
 .../repoman/modules/linechecks/whitespace/blank.py |   24 -
 .../modules/linechecks/whitespace/whitespace.py    |   20 -
 .../modules/linechecks/workaround/__init__.py      |   21 -
 .../modules/linechecks/workaround/workarounds.py   |   11 -
 repoman/lib/repoman/modules/scan/__init__.py       |    0
 .../lib/repoman/modules/scan/depend/__init__.py    |   43 -
 .../repoman/modules/scan/depend/_depend_checks.py  |  260 ---
 .../lib/repoman/modules/scan/depend/_gen_arches.py |   67 -
 repoman/lib/repoman/modules/scan/depend/profile.py |  427 ----
 .../repoman/modules/scan/directories/__init__.py   |   53 -
 .../lib/repoman/modules/scan/directories/files.py  |   99 -
 .../lib/repoman/modules/scan/directories/mtime.py  |   30 -
 repoman/lib/repoman/modules/scan/eapi/__init__.py  |   28 -
 repoman/lib/repoman/modules/scan/eapi/eapi.py      |   50 -
 .../lib/repoman/modules/scan/ebuild/__init__.py    |   66 -
 repoman/lib/repoman/modules/scan/ebuild/ebuild.py  |  263 ---
 .../lib/repoman/modules/scan/ebuild/multicheck.py  |   62 -
 .../lib/repoman/modules/scan/eclasses/__init__.py  |   49 -
 repoman/lib/repoman/modules/scan/eclasses/live.py  |   77 -
 repoman/lib/repoman/modules/scan/eclasses/ruby.py  |   49 -
 repoman/lib/repoman/modules/scan/fetch/__init__.py |   37 -
 repoman/lib/repoman/modules/scan/fetch/fetches.py  |  205 --
 .../lib/repoman/modules/scan/keywords/__init__.py  |   37 -
 .../lib/repoman/modules/scan/keywords/keywords.py  |  179 --
 .../lib/repoman/modules/scan/manifest/__init__.py  |   34 -
 .../lib/repoman/modules/scan/manifest/manifests.py |   56 -
 .../lib/repoman/modules/scan/metadata/__init__.py  |   89 -
 .../repoman/modules/scan/metadata/description.py   |   44 -
 .../modules/scan/metadata/ebuild_metadata.py       |   88 -
 .../repoman/modules/scan/metadata/pkgmetadata.py   |  221 --
 .../lib/repoman/modules/scan/metadata/restrict.py  |   58 -
 .../lib/repoman/modules/scan/metadata/use_flags.py |  103 -
 repoman/lib/repoman/modules/scan/module.py         |  127 -
 .../lib/repoman/modules/scan/options/__init__.py   |   28 -
 .../lib/repoman/modules/scan/options/options.py    |   27 -
 repoman/lib/repoman/modules/scan/scan.py           |   67 -
 repoman/lib/repoman/modules/scan/scanbase.py       |   79 -
 repoman/lib/repoman/modules/vcs/None/__init__.py   |   32 -
 repoman/lib/repoman/modules/vcs/None/changes.py    |   50 -
 repoman/lib/repoman/modules/vcs/None/status.py     |   52 -
 repoman/lib/repoman/modules/vcs/__init__.py        |   12 -
 repoman/lib/repoman/modules/vcs/bzr/__init__.py    |   32 -
 repoman/lib/repoman/modules/vcs/bzr/changes.py     |   77 -
 repoman/lib/repoman/modules/vcs/bzr/status.py      |   72 -
 repoman/lib/repoman/modules/vcs/changes.py         |  170 --
 repoman/lib/repoman/modules/vcs/cvs/__init__.py    |   32 -
 repoman/lib/repoman/modules/vcs/cvs/changes.py     |  134 --
 repoman/lib/repoman/modules/vcs/cvs/status.py      |  134 --
 repoman/lib/repoman/modules/vcs/git/__init__.py    |   32 -
 repoman/lib/repoman/modules/vcs/git/changes.py     |  145 --
 repoman/lib/repoman/modules/vcs/git/status.py      |   80 -
 repoman/lib/repoman/modules/vcs/hg/__init__.py     |   32 -
 repoman/lib/repoman/modules/vcs/hg/changes.py      |  109 -
 repoman/lib/repoman/modules/vcs/hg/status.py       |   68 -
 repoman/lib/repoman/modules/vcs/settings.py        |  113 -
 repoman/lib/repoman/modules/vcs/svn/__init__.py    |   32 -
 repoman/lib/repoman/modules/vcs/svn/changes.py     |  156 --
 repoman/lib/repoman/modules/vcs/svn/status.py      |  151 --
 repoman/lib/repoman/modules/vcs/vcs.py             |  145 --
 repoman/lib/repoman/profile.py                     |   94 -
 repoman/lib/repoman/qa_data.py                     |  210 --
 repoman/lib/repoman/qa_tracker.py                  |   46 -
 repoman/lib/repoman/repos.py                       |  377 ---
 repoman/lib/repoman/scanner.py                     |  484 ----
 repoman/lib/repoman/tests/__init__.py              |  328 ---
 repoman/lib/repoman/tests/changelog/__test__.py    |    0
 .../lib/repoman/tests/changelog/test_echangelog.py |  169 --
 repoman/lib/repoman/tests/commit/__init__.py       |    2 -
 repoman/lib/repoman/tests/commit/__test__.py       |    0
 repoman/lib/repoman/tests/commit/test_commitmsg.py |  155 --
 repoman/lib/repoman/tests/runTests.py              |   75 -
 repoman/lib/repoman/tests/simple/__init__.py       |    2 -
 repoman/lib/repoman/tests/simple/__test__.py       |    0
 repoman/lib/repoman/tests/simple/test_simple.py    |  512 ----
 repoman/lib/repoman/utilities.py                   |  590 -----
 repoman/man/repoman.1                              |  478 ----
 repoman/runtests                                   |  182 --
 repoman/setup.py                                   |  515 ----
 run-pylint                                         |    2 +
 runtests                                           |  110 +-
 setup.py                                           |   20 +-
 tabcheck.py                                        |    7 -
 tox.ini                                            |    8 +-
 353 files changed, 13289 insertions(+), 22599 deletions(-)

diff --cc bin/archive-conf
index 11e1d25b7,3f7d186fe..ecc8d8a1c
--- a/bin/archive-conf
+++ b/bin/archive-conf
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -b
 -#!/usr/bin/env python
++#!@PREFIX_PORTAGE_PYTHON@
  # Copyright 1999-2020 Gentoo Authors
  # Distributed under the terms of the GNU General Public License v2
  
diff --cc bin/binhost-snapshot
index fbecfa8bb,4022cb32c..0788e2704
--- a/bin/binhost-snapshot
+++ b/bin/binhost-snapshot
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -b
 -#!/usr/bin/env python
++#!@PREFIX_PORTAGE_PYTHON@
  # Copyright 2010-2014 Gentoo Foundation
  # Distributed under the terms of the GNU General Public License v2
  
diff --cc bin/check-implicit-pointer-usage.py
index 4c736fcd7,06b666c88..1457a3c9f
--- a/bin/check-implicit-pointer-usage.py
+++ b/bin/check-implicit-pointer-usage.py
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -b
 -#!/usr/bin/env python
++#!@PREFIX_PORTAGE_PYTHON@
  
  # Ripped from HP and updated from Debian
  # Update by Gentoo to support unicode output
diff --cc bin/chmod-lite.py
index 642a6a544,517a55bd9..baec75c40
--- a/bin/chmod-lite.py
+++ b/bin/chmod-lite.py
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -b
 -#!/usr/bin/env python
++#!@PREFIX_PORTAGE_PYTHON@
  # Copyright 2015 Gentoo Foundation
  # Distributed under the terms of the GNU General Public License v2
  
diff --cc bin/chpathtool.py
index f3842bdd5,d658e5012..1b30bc272
--- a/bin/chpathtool.py
+++ b/bin/chpathtool.py
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -b
 -#!/usr/bin/env python
++#!@PREFIX_PORTAGE_PYTHON@
  # Copyright 2011-2014 Gentoo Foundation
  # Distributed under the terms of the GNU General Public License v2
  
diff --cc bin/clean_locks
index 7959486ac,b80213911..4ff410aa3
--- a/bin/clean_locks
+++ b/bin/clean_locks
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -b
 -#!/usr/bin/env python
++#!@PREFIX_PORTAGE_PYTHON@
  # Copyright 1999-2021 Gentoo Authors
  # Distributed under the terms of the GNU General Public License v2
  
diff --cc bin/dispatch-conf
index c2587639d,9490197d3..52f065b91
--- a/bin/dispatch-conf
+++ b/bin/dispatch-conf
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -b
 -#!/usr/bin/env python
++#!@PREFIX_PORTAGE_PYTHON@
  # Copyright 1999-2021 Gentoo Authors
  # Distributed under the terms of the GNU General Public License v2
  
diff --cc bin/dohtml.py
index 30e685d00,7aebd2af7..198d63799
--- a/bin/dohtml.py
+++ b/bin/dohtml.py
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -b
 -#!/usr/bin/env python
++#!@PREFIX_PORTAGE_PYTHON@
  # Copyright 1999-2020 Gentoo Authors
  # Distributed under the terms of the GNU General Public License v2
  
diff --cc bin/eapi.sh
index 1aaaa19e8,689e09b10..59ce6d9de
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@@ -1,5 -1,5 +1,5 @@@
 -#!/bin/bash
 +#!@PORTAGE_BASH@
- # Copyright 2012-2021 Gentoo Authors
+ # Copyright 2012-2022 Gentoo Authors
  # Distributed under the terms of the GNU General Public License v2
  
  # PHASES
diff --cc bin/ebuild
index 6f70ee4bf,546ab9d1c..9cf4afd5a
--- a/bin/ebuild
+++ b/bin/ebuild
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -b
 -#!/usr/bin/env python
++#!@PREFIX_PORTAGE_PYTHON@
  # Copyright 1999-2021 Gentoo Authors
  # Distributed under the terms of the GNU General Public License v2
  
diff --cc bin/ebuild-ipc.py
index 2f5790ee4,bc5dda27d..4a6a9468a
--- a/bin/ebuild-ipc.py
+++ b/bin/ebuild-ipc.py
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -b
 -#!/usr/bin/env python
++#!@PREFIX_PORTAGE_PYTHON@
  # Copyright 2010-2021 Gentoo Authors
  # Distributed under the terms of the GNU General Public License v2
  #
diff --cc bin/egencache
index 99028203b,842f453ea..31a555102
--- a/bin/egencache
+++ b/bin/egencache
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -b
 -#!/usr/bin/env python
++#!@PREFIX_PORTAGE_PYTHON@
  # Copyright 2009-2021 Gentoo Authors
  # Distributed under the terms of the GNU General Public License v2
  
diff --cc bin/emaint
index af5234183,b9a129ed0..38a2c6896
--- a/bin/emaint
+++ b/bin/emaint
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -b
 -#!/usr/bin/env python
++#!@PREFIX_PORTAGE_PYTHON@
  # Copyright 2005-2020 Gentoo Authors
  # Distributed under the terms of the GNU General Public License v2
  
diff --cc bin/emerge
index d952840ef,d1a8d9f52..9a0a570b5
--- a/bin/emerge
+++ b/bin/emerge
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -b
 -#!/usr/bin/env python
++#!@PREFIX_PORTAGE_PYTHON@
  # Copyright 2006-2021 Gentoo Authors
  # Distributed under the terms of the GNU General Public License v2
  
diff --cc bin/emirrordist
index 866a2be65,9f8db8292..36bc7611a
--- a/bin/emirrordist
+++ b/bin/emirrordist
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -b
 -#!/usr/bin/env python
++#!@PREFIX_PORTAGE_PYTHON@
  # Copyright 2013-2014 Gentoo Foundation
  # Distributed under the terms of the GNU General Public License v2
  
diff --cc bin/env-update
index 5c2df8544,8e597b03d..7f1ae90ab
--- a/bin/env-update
+++ b/bin/env-update
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -b
 -#!/usr/bin/env python
++#!@PREFIX_PORTAGE_PYTHON@
  # Copyright 1999-2020 Gentoo Authors
  # Distributed under the terms of the GNU General Public License v2
  
diff --cc bin/filter-bash-environment.py
index a3cf7191a,86cb22948..09a45e509
--- a/bin/filter-bash-environment.py
+++ b/bin/filter-bash-environment.py
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -b
 -#!/usr/bin/env python
++#!@PREFIX_PORTAGE_PYTHON@
  # Copyright 1999-2014 Gentoo Foundation
  # Distributed under the terms of the GNU General Public License v2
  
diff --cc bin/fixpackages
index 5c4185071,6f78b174d..ae28b216c
--- a/bin/fixpackages
+++ b/bin/fixpackages
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -b
 -#!/usr/bin/env python
++#!@PREFIX_PORTAGE_PYTHON@
  # Copyright 1999-2020 Gentoo Authors
  # Distributed under the terms of the GNU General Public License v2
  
diff --cc bin/glsa-check
index 04312a236,431590cf8..2b2976100
--- a/bin/glsa-check
+++ b/bin/glsa-check
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -b
 -#!/usr/bin/env python
++#!@PREFIX_PORTAGE_PYTHON@
  # Copyright 1999-2021 Gentoo Authors
  # Distributed under the terms of the GNU General Public License v2
  
diff --cc bin/install.py
index 6729778a1,4bdffd255..e8933606a
--- a/bin/install.py
+++ b/bin/install.py
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -b
 -#!/usr/bin/env python
++#!@PREFIX_PORTAGE_PYTHON@
  # Copyright 2013-2014 Gentoo Foundation
  # Distributed under the terms of the GNU General Public License v2
  
diff --cc bin/lock-helper.py
index f09e4f2a7,6619d625a..e7acd1938
--- a/bin/lock-helper.py
+++ b/bin/lock-helper.py
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -b
 -#!/usr/bin/env python
++#!@PREFIX_PORTAGE_PYTHON@
  # Copyright 2010-2014 Gentoo Foundation
  # Distributed under the terms of the GNU General Public License v2
  
diff --cc bin/misc-functions.sh
index 6c86952b4,41340e3f7..887af7a23
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@@ -19,17 -19,13 +19,17 @@@ source "${PORTAGE_BIN_PATH}/ebuild.sh" 
  install_symlink_html_docs() {
        if ! ___eapi_has_prefix_variables; then
                local ED=${D}
 +      else
 +              # PREFIX LOCAL: ED needs not to exist, whereas D does
 +              [[ ! -d ${ED} && -d ${D} ]] && dodir /
 +              # END PREFIX LOCAL
        fi
        cd "${ED}" || die "cd failed"
-       #symlink the html documentation (if DOC_SYMLINKS_DIR is set in 
make.conf)
-       if [ -n "${DOC_SYMLINKS_DIR}" ] ; then
+       # Symlink the html documentation (if DOC_SYMLINKS_DIR is set in 
make.conf)
+       if [[ -n "${DOC_SYMLINKS_DIR}" ]]; then
                local mydocdir docdir
                for docdir in "${HTMLDOC_DIR:-does/not/exist}" "${PF}/html" 
"${PF}/HTML" "${P}/html" "${P}/HTML" ; do
-                       if [ -d "usr/share/doc/${docdir}" ] ; then
+                       if [[ -d "usr/share/doc/${docdir}" ]]; then
                                mydocdir="/usr/share/doc/${docdir}"
                        fi
                done
@@@ -287,9 -234,22 +273,24 @@@ install_qa_check_elf() 
                        fi
                fi
        fi
 +}
  
 +install_qa_check_misc() {
+       # If binpkg-dostrip is enabled, apply stripping before creating
+       # the binary package.
+       # Note: disabling it won't help with packages calling prepstrip 
directly.
+       # We do this after the scanelf bits so that we can reuse the data. bug 
#749624.
+       if has binpkg-dostrip ${FEATURES}; then
+               export STRIP_MASK
+               if ___eapi_has_dostrip; then
+                       "${PORTAGE_BIN_PATH}"/estrip --queue 
"${PORTAGE_DOSTRIP[@]}"
+                       "${PORTAGE_BIN_PATH}"/estrip --ignore 
"${PORTAGE_DOSTRIP_SKIP[@]}"
+                       "${PORTAGE_BIN_PATH}"/estrip --dequeue
+               else
+                       prepallstrip
+               fi
+       fi
+ 
        # Portage regenerates this on the installed system.
        rm -f "${ED%/}"/usr/share/info/dir{,.gz,.bz2} || die "rm failed!"
  }
@@@ -1203,35 -507,50 +1204,54 @@@ __dyn_package() 
        # Sandbox is disabled in case the user wants to use a symlink
        # for $PKGDIR and/or $PKGDIR/All.
        export SANDBOX_ON="0"
-       [ -z "${PORTAGE_BINPKG_TMPFILE}" ] && \
+       [[ -z "${PORTAGE_BINPKG_TMPFILE}" ]] && \
                die "PORTAGE_BINPKG_TMPFILE is unset"
        mkdir -p "${PORTAGE_BINPKG_TMPFILE%/*}" || die "mkdir failed"
-       [ -z "${PORTAGE_COMPRESSION_COMMAND}" ] && \
-         die "PORTAGE_COMPRESSION_COMMAND is unset"
-       tar $tar_options -cf - $PORTAGE_BINPKG_TAR_OPTS -C "${D}" . | \
-               $PORTAGE_COMPRESSION_COMMAND > "$PORTAGE_BINPKG_TMPFILE"
-       assert "failed to pack binary package: '$PORTAGE_BINPKG_TMPFILE'"
-       PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
-               "${PORTAGE_PYTHON:-@PREFIX_PORTAGE_PYTHON@}" 
"$PORTAGE_BIN_PATH"/xpak-helper.py recompose \
-               "$PORTAGE_BINPKG_TMPFILE" "$PORTAGE_BUILDDIR/build-info"
-       if [ $? -ne 0 ]; then
-               rm -f "${PORTAGE_BINPKG_TMPFILE}"
-               die "Failed to append metadata to the tbz2 file"
-       fi
-       local md5_hash=""
-       if type md5sum &>/dev/null ; then
-               md5_hash=$(md5sum "${PORTAGE_BINPKG_TMPFILE}")
-               md5_hash=${md5_hash%% *}
-       elif type md5 &>/dev/null ; then
-               md5_hash=$(md5 "${PORTAGE_BINPKG_TMPFILE}")
-               md5_hash=${md5_hash##* }
+ 
+       if [[ "${BINPKG_FORMAT}" == "xpak" ]]; then
+               local tar_options=""
+               [[ $PORTAGE_VERBOSE = 1 ]] && tar_options+=" -v"
+               has xattr ${FEATURES} && [[ $(tar --help 2> /dev/null) == 
*--xattrs* ]] && tar_options+=" --xattrs"
+               [[ -z "${PORTAGE_COMPRESSION_COMMAND}" ]] && \
+                       die "PORTAGE_COMPRESSION_COMMAND is unset"
+               tar $tar_options -cf - $PORTAGE_BINPKG_TAR_OPTS -C "${D}" . | \
+                       $PORTAGE_COMPRESSION_COMMAND > "$PORTAGE_BINPKG_TMPFILE"
+               assert "failed to pack binary package: 
'$PORTAGE_BINPKG_TMPFILE'"
++              # BEGIN PREFIX LOCAL: use PREFIX_PORTAGE_PYTHON fallback
+               PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
 -                      "${PORTAGE_PYTHON:-/usr/bin/python}" 
"$PORTAGE_BIN_PATH"/xpak-helper.py recompose \
++                      "${PORTAGE_PYTHON:-@PREFIX_PORTAGE_PYTHON@}" 
"$PORTAGE_BIN_PATH"/xpak-helper.py recompose \
+                       "$PORTAGE_BINPKG_TMPFILE" "$PORTAGE_BUILDDIR/build-info"
++              # END PREFIX LOCAL
+               if [[ $? -ne 0 ]]; then
+                       rm -f "${PORTAGE_BINPKG_TMPFILE}"
+                       die "Failed to append metadata to the tbz2 file"
+               fi
+               local md5_hash=""
+               if type md5sum &>/dev/null ; then
+                       md5_hash=$(md5sum "${PORTAGE_BINPKG_TMPFILE}")
+                       md5_hash=${md5_hash%% *}
+               elif type md5 &>/dev/null ; then
+                       md5_hash=$(md5 "${PORTAGE_BINPKG_TMPFILE}")
+                       md5_hash=${md5_hash##* }
+               fi
+               [[ -n "${md5_hash}" ]] && \
+                       echo ${md5_hash} > 
"${PORTAGE_BUILDDIR}"/build-info/BINPKGMD5
+               __vecho ">>> Done."
+ 
+       elif [[ "${BINPKG_FORMAT}" == "gpkg" ]]; then
++              # BEGIN PREFIX LOCAL: use PREFIX_PORTAGE_PYTHON fallback
+               PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
 -                      "${PORTAGE_PYTHON:-/usr/bin/python}" 
"$PORTAGE_BIN_PATH"/gpkg-helper.py compress \
++                      "${PORTAGE_PYTHON:-@PREFIX_PORTAGE_PYTHON@}" 
"$PORTAGE_BIN_PATH"/gpkg-helper.py compress \
+                       "${CATEGORY}/${PF}" "$PORTAGE_BINPKG_TMPFILE" 
"$PORTAGE_BUILDDIR/build-info" "${D}"
++              # END PREFIX LOCAL
+               if [[ $? -ne 0 ]]; then
+                       rm -f "${PORTAGE_BINPKG_TMPFILE}"
+                       die "Failed to create binpkg file"
+               fi
+               __vecho ">>> Done."
+       else
+               die "Unknown BINPKG_FORMAT ${BINPKG_FORMAT}"
        fi
-       [ -n "${md5_hash}" ] && \
-               echo ${md5_hash} > "${PORTAGE_BUILDDIR}"/build-info/BINPKGMD5
-       __vecho ">>> Done."
  
        cd "${PORTAGE_BUILDDIR}"
        >> "$PORTAGE_BUILDDIR/.packaged" || \
diff --cc bin/phase-functions.sh
index 0b6b93038,84a5c1ec3..5a653fa64
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@@ -766,9 -770,8 +770,9 @@@ __dyn_help() 
                echo "production (stripped)"
        fi
        echo "  merge to    : ${ROOT}"
 +      echo "  offset      : ${EPREFIX}"
        echo
-       if [ -n "$USE" ]; then
+       if [[ -n "$USE" ]]; then
                echo "Additionally, support for the following optional features 
will be enabled:"
                echo
                echo "  ${USE}"
diff --cc bin/portageq
index a178ff0b0,6d12c98dd..4fe254d5d
--- a/bin/portageq
+++ b/bin/portageq
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -b
 -#!/usr/bin/env python
++#!@PREFIX_PORTAGE_PYTHON@
  # Copyright 1999-2021 Gentoo Authors
  # Distributed under the terms of the GNU General Public License v2
  
diff --cc bin/quickpkg
index 1bcbda8ba,773c1c07e..7e0445dc3
--- a/bin/quickpkg
+++ b/bin/quickpkg
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -b
 -#!/usr/bin/env python
++#!@PREFIX_PORTAGE_PYTHON@
  # Copyright 1999-2021 Gentoo Authors
  # Distributed under the terms of the GNU General Public License v2
  
diff --cc bin/regenworld
index b4f8509cb,7927dd237..6d381fad6
--- a/bin/regenworld
+++ b/bin/regenworld
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -b
 -#!/usr/bin/env python
++#!@PREFIX_PORTAGE_PYTHON@
  # Copyright 1999-2021 Gentoo Authors
  # Distributed under the terms of the GNU General Public License v2
  
diff --cc bin/save-ebuild-env.sh
index b3d4c7363,17e4b1b3e..5c7fd4d7d
mode 100755,100644..100755
--- a/bin/save-ebuild-env.sh
+++ b/bin/save-ebuild-env.sh
@@@ -81,21 -81,10 +81,14 @@@ __save_ebuild_env() 
                ${QA_INTERCEPTORS}
  
        ___eapi_has_usex && unset -f usex
-       ___eapi_has_master_repositories && unset -f master_repositories
-       ___eapi_has_repository_path && unset -f repository_path
-       ___eapi_has_available_eclasses && unset -f available_eclasses
-       ___eapi_has_eclass_path && unset -f eclass_path
-       ___eapi_has_license_path && unset -f license_path
-       ___eapi_has_package_manager_build_user && unset -f 
package_manager_build_user
-       ___eapi_has_package_manager_build_group && unset -f 
package_manager_build_group
  
 -      # Clear out the triple underscore namespace as it is reserved by the PM.
 -      unset -f $(compgen -A function ___)
 -      unset ${!___*}
 +      # BEGIN PREFIX LOCAL: compgen is not compiled in during bootstrap
 +      if type compgen >& /dev/null ; then
 +              # Clear out the triple underscore namespace as it is reserved 
by the PM.
 +              unset -f $(compgen -A function ___)
 +              unset ${!___*}
 +      fi
 +      # END PREFIX LOCAL
  
        # portage config variables and variables set directly by portage
        unset ACCEPT_LICENSE BUILD_PREFIX COLS \
diff --cc bin/xattr-helper.py
index fb39ae9df,6e50ac487..8ad94c4ab
--- a/bin/xattr-helper.py
+++ b/bin/xattr-helper.py
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -b
 -#!/usr/bin/env python
++#!@PREFIX_PORTAGE_PYTHON@
  # Copyright 2012-2018 Gentoo Foundation
  # Distributed under the terms of the GNU General Public License v2
  
diff --cc bin/xpak-helper.py
index d92a3f7d8,ac29995e7..8ffa9c747
--- a/bin/xpak-helper.py
+++ b/bin/xpak-helper.py
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -b
 -#!/usr/bin/env python
++#!@PREFIX_PORTAGE_PYTHON@
  # Copyright 2009-2014 Gentoo Foundation
  # Distributed under the terms of the GNU General Public License v2
  
diff --cc cnf/make.globals
index 4840dc354,f951bb317..613f58ff0
--- a/cnf/make.globals
+++ b/cnf/make.globals
@@@ -145,11 -143,11 +166,11 @@@ PORTAGE_WORKDIR_MODE="0700
  PORTAGE_ELOG_CLASSES="log warn error"
  PORTAGE_ELOG_SYSTEM="save_summary:log,warn,error,qa echo"
  
 -PORTAGE_ELOG_MAILURI="root"
 +PORTAGE_ELOG_MAILURI="@rootuser@"
  PORTAGE_ELOG_MAILSUBJECT="[portage] ebuild log for \${PACKAGE} on \${HOST}"
 -PORTAGE_ELOG_MAILFROM="portage@localhost"
 +PORTAGE_ELOG_MAILFROM="@portageuser@@localhost"
  
- # Signing command used by repoman
+ # Signing command used by egencache
  PORTAGE_GPG_SIGNING_COMMAND="gpg --sign --digest-algo SHA256 --clearsign 
--yes --default-key \"\${PORTAGE_GPG_KEY}\" --homedir \"\${PORTAGE_GPG_DIR}\" 
\"\${FILE}\""
  
  # btrfs.* attributes are irrelevant, see bug #527636.
diff --cc lib/_emerge/EbuildPhase.py
index 3fe4c8f3a,9a04f9c1f..df166ad47
--- a/lib/_emerge/EbuildPhase.py
+++ b/lib/_emerge/EbuildPhase.py
@@@ -29,8 -29,8 +29,10 @@@ from portage.util._async.AsyncTaskFutur
  from portage.util._async.BuildLogger import BuildLogger
  from portage.util.futures import asyncio
  from portage.util.futures.executor.fork import ForkExecutor
+ from portage.exception import InvalidBinaryPackageFormat
+ from portage.const import SUPPORTED_GENTOO_BINPKG_FORMATS
 +# PREFIX LOCAL
 +from portage.const import EPREFIX
  
  try:
      from portage.xml.metadata import MetaDataXML
diff --cc lib/portage/__init__.py
index 1e4c68b13,a4a2c8865..ab3017a5d
--- a/lib/portage/__init__.py
+++ b/lib/portage/__init__.py
@@@ -50,19 -48,9 +50,19 @@@ except ImportError as e
      sys.stderr.write(
          "!!! gone wrong. Here is the information we got for this exception:\n"
      )
-     sys.stderr.write("    " + str(e) + "\n\n")
+     sys.stderr.write(f"    {e}\n\n")
      raise
  
 +# BEGIN PREFIX LOCAL
 +# for bug #758230, on macOS the default was switched from fork to spawn,
 +# the latter causing issues because all kinds of things can't be
 +# pickled, so force fork mode for now
 +try:
 +    multiprocessing.set_start_method('fork')
 +except RuntimeError:
 +    pass
 +# END PREFIX LOCAL
 +
  try:
  
      import portage.proxy.lazyimport
diff --cc lib/portage/const.py
index f2c69a4bb,f0f57067a..3038ce285
--- a/lib/portage/const.py
+++ b/lib/portage/const.py
@@@ -2,12 -2,8 +2,13 @@@
  # Copyright 1998-2021 Gentoo Authors
  # Distributed under the terms of the GNU General Public License v2
  
 +# ===========================================================================
 +# autotool supplied constants.
 +# ===========================================================================
 +from portage.const_autotool import *
 +
  import os
+ import sys
  
  # ===========================================================================
  # START OF CONSTANTS -- START OF CONSTANTS -- START OF CONSTANTS -- START OF
@@@ -62,40 -58,22 +63,40 @@@ 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
  # NOTE: Please keep PORTAGE_BASE_PATH in one line to help substitutions.
  # fmt:off
 -PORTAGE_BASE_PATH = os.path.join(os.sep, 
os.sep.join(os.path.realpath(__file__.rstrip("co")).split(os.sep)[:-3]))
 +# 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]))
  # fmt:on
- PORTAGE_BIN_PATH = PORTAGE_BASE_PATH + "/bin"
+ PORTAGE_BIN_PATH = f"{PORTAGE_BASE_PATH}/bin"
  PORTAGE_PYM_PATH = os.path.realpath(os.path.join(__file__, "../.."))
- LOCALE_DATA_PATH = PORTAGE_BASE_PATH + "/locale"  # FIXME: not used
- EBUILD_SH_BINARY = PORTAGE_BIN_PATH + "/ebuild.sh"
- MISC_SH_BINARY = PORTAGE_BIN_PATH + "/misc-functions.sh"
- # BEGIN PREFIX LOCAL
- SANDBOX_BINARY = EPREFIX + "/usr/bin/sandbox"
- FAKEROOT_BINARY = EPREFIX + "/usr/bin/fakeroot"
+ LOCALE_DATA_PATH = f"{PORTAGE_BASE_PATH}/locale"  # FIXME: not used
+ EBUILD_SH_BINARY = f"{PORTAGE_BIN_PATH}/ebuild.sh"
+ MISC_SH_BINARY = f"{PORTAGE_BIN_PATH}/misc-functions.sh"
 -SANDBOX_BINARY = "/usr/bin/sandbox"
 -FAKEROOT_BINARY = "/usr/bin/fakeroot"
++# BEGIN PREFIX LOCAL: use EPREFIX for binaries
++SANDBOX_BINARY = f"{EPREFIX}/usr/bin/sandbox"
++FAKEROOT_BINARY = f"{EPREFIX}/usr/bin/fakeroot"
 +# END PREFIX LOCAL
  BASH_BINARY = "/bin/bash"
  MOVE_BINARY = "/bin/mv"
  PRELINK_BINARY = "/usr/sbin/prelink"
- # BEGIN PREFIX LOCAL
++# BEGIN PREFIX LOCAL: macOS sandbox
 +MACOSSANDBOX_BINARY      = "/usr/bin/sandbox-exec"
 +MACOSSANDBOX_PROFILE     = '''(version 1)
 +(allow default)
 +(deny file-write*)
 +(allow file-write* file-write-setugid
 +@@MACOSSANDBOX_PATHS@@)
 +(allow file-write-data
 +@@MACOSSANDBOX_PATHS_CONTENT_ONLY@@)'''
 +
 +PORTAGE_GROUPNAME        = portagegroup
 +PORTAGE_USERNAME         = portageuser
 +# END PREFIX LOCAL
  
  INVALID_ENV_FILE = "/etc/spork/is/not/valid/profile.env"
  MERGING_IDENTIFIER = "-MERGING-"
@@@ -235,9 -217,7 +240,9 @@@ SUPPORTED_FEATURES = frozenset
          "usersync",
          "webrsync-gpg",
          "xattr",
 +        # PREFIX LOCAL
 +              "stacked-prefix",
-     ]
+     )
  )
  
  EAPI = 8
diff --cc lib/portage/data.py
index 6848751fe,1ef8d4aef..5d34db187
--- a/lib/portage/data.py
+++ b/lib/portage/data.py
@@@ -6,9 -6,9 +6,10 @@@ import gr
  import os
  import platform
  import pwd
 +from portage.const import PORTAGE_GROUPNAME, PORTAGE_USERNAME, EPREFIX
  
  import portage
+ from portage.localization import _
  
  portage.proxy.lazyimport.lazyimport(
      globals(),
@@@ -17,17 -17,11 +18,12 @@@
      "portage.util.path:first_existing",
      "subprocess",
  )
- from portage.localization import _
  
  ostype = platform.system()
- userland = None
- # Prefix always has USERLAND=GNU, even on
- # FreeBSD, OpenBSD and Darwin (thank the lord!).
- # Hopefully this entire USERLAND hack can go once
+ userland = "GNU"
 -if ostype == "DragonFly" or ostype.endswith("BSD"):
++# PREFIX LOCAL: Prefix always has USERLAND=GNU
 +if EPREFIX == "" and (ostype == "DragonFly" or ostype.endswith("BSD")):
      userland = "BSD"
- else:
-     userland = "GNU"
  
  lchown = getattr(os, "lchown", None)
  
diff --cc lib/portage/dbapi/bintree.py
index 8b008a93d,b441fff9a..986ffeb3d
--- a/lib/portage/dbapi/bintree.py
+++ b/lib/portage/dbapi/bintree.py
@@@ -514,9 -582,7 +588,10 @@@ class binarytree
                  "SLOT": "0",
                  "USE": "",
              }
-             self._pkgindex_inherited_keys = ["CHOST", "repository",
 -            self._pkgindex_inherited_keys = ["BINPKG_FORMAT", "CHOST", 
"repository"]
++            self._pkgindex_inherited_keys = ["BINPKG_FORMAT", "CHOST",
 +                    # PREFIX LOCAL
-                     "EPREFIX"]
++                    "EPREFIX",
++                    "repository"]
  
              # Populate the header with appropriate defaults.
              self._pkgindex_default_header_data = {
diff --cc lib/portage/dbapi/vartree.py
index 7e68b3f8c,a95d60691..6c668726d
--- a/lib/portage/dbapi/vartree.py
+++ b/lib/portage/dbapi/vartree.py
@@@ -59,8 -55,7 +60,9 @@@ from portage.const import 
      PORTAGE_PACKAGE_ATOM,
      PRIVATE_PATH,
      VDB_PATH,
+     SUPPORTED_GENTOO_BINPKG_FORMATS,
 +    # PREFIX LOCAL
 +    EPREFIX,
  )
  from portage.dbapi import dbapi
  from portage.exception import (
diff --cc lib/portage/getbinpkg.py
index aaf0bcf81,ea9ee1d0a..3cad401af
--- a/lib/portage/getbinpkg.py
+++ b/lib/portage/getbinpkg.py
@@@ -19,12 -19,8 +19,10 @@@ import socke
  import time
  import tempfile
  import base64
 +# PREFIX LOCAL
 +from portage.const import CACHE_PATH
  import warnings
  
- _all_errors = [NotImplementedError, ValueError, socket.error]
- 
  from html.parser import HTMLParser as html_parser_HTMLParser
  from urllib.parse import unquote as urllib_parse_unquote
  
@@@ -621,18 -603,15 +605,17 @@@ def dir_get_metadata
          stacklevel=2,
      )
  
-     if not conn:
+     keepconnection = 1
+     if conn:
          keepconnection = 0
-     else:
-         keepconnection = 1
  
 -    cache_path = "/var/cache/edb"
 +    # PREFIX LOCAL
 +    cache_path = CACHE_PATH
      metadatafilename = os.path.join(cache_path, "remote_metadata.pickle")
  
-     if makepickle is None:
-         # PREFIX LOCAL
-         makepickle = CACHE_PATH + "/metadata.idx.most_recent"
+     if not makepickle:
 -        makepickle = "/var/cache/edb/metadata.idx.most_recent"
++        # PREFIX LOCAL: use CACHE_PATH for EPREFIX
++        makepickle = os.path.join(cache_path, "metadata.idx.most_recent")
  
      try:
          conn = create_conn(baseurl, conn)[0]
diff --cc lib/portage/package/ebuild/doebuild.py
index af8845f34,8ee9f73c6..3c1998889
--- a/lib/portage/package/ebuild/doebuild.py
+++ b/lib/portage/package/ebuild/doebuild.py
@@@ -67,10 -66,7 +67,11 @@@ from portage.const import 
      INVALID_ENV_FILE,
      MISC_SH_BINARY,
      PORTAGE_PYM_PACKAGES,
+     SUPPORTED_GENTOO_BINPKG_FORMATS,
 +    # BEGIN PREFIX LOCAL
 +    EPREFIX,
 +    MACOSSANDBOX_PROFILE,
 +    # END PREFIX LOCAL
  )
  from portage.data import portage_gid, portage_uid, secpass, uid, 
userpriv_groups
  from portage.dbapi.porttree import _parse_uri_map
diff --cc lib/portage/tests/resolver/ResolverPlayground.py
index 969d8f2fb,ec69ee068..81ce9178b
--- a/lib/portage/tests/resolver/ResolverPlayground.py
+++ b/lib/portage/tests/resolver/ResolverPlayground.py
@@@ -356,8 -360,7 +360,9 @@@ class ResolverPlayground
              metadata["repository"] = repo
              metadata["CATEGORY"] = cat
              metadata["PF"] = pf
+             metadata["BINPKG_FORMAT"] = binpkg_format
 +            # PREFIX LOCAL
 +            metadata["EPREFIX"] = self.eprefix
  
              repo_dir = self.pkgdir
              category_dir = os.path.join(repo_dir, cat)
diff --cc lib/portage/tests/runTests.py
index f2e799c65,00a8ad7bb..2a11381b0
--- a/lib/portage/tests/runTests.py
+++ b/lib/portage/tests/runTests.py
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -bWd
 -#!/usr/bin/env python -Wd
++#!@PREFIX_PORTAGE_PYTHON@ -Wd
  # runTests.py -- Portage Unit Test Functionality
  # Copyright 2006-2020 Gentoo Authors
  # Distributed under the terms of the GNU General Public License v2

Reply via email to