[gentoo-commits] proj/portage:master commit in: lib/portage/package/ebuild/, lib/_emerge/, lib/portage/util/futures/_asyncio/, ...

2024-02-12 Thread Zac Medico
commit: 5c528b1cf44f30d80a3ca5620a810e4fe2bd66f1
Author: Zac Medico  gentoo  org>
AuthorDate: Tue Feb 13 04:47:53 2024 +
Commit: Zac Medico  gentoo  org>
CommitDate: Tue Feb 13 05:02:14 2024 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=5c528b1c

Revert "EbuildPhase: async_check_locale"

This reverts commit c95fc64abf9698263090b3ffd4a056e989dd2be1
since we had assumed EbuildMetadataPhase._start would serialize
access to the portdbapi doebuild_settings attribute, and that
assumption broke when _async_start was introduced in order to
call async_check_locale.

Bug: https://bugs.gentoo.org/923841
Bug: https://bugs.gentoo.org/924319
Signed-off-by: Zac Medico  gentoo.org>

 lib/_emerge/EbuildMetadataPhase.py| 21 
 lib/_emerge/EbuildPhase.py| 28 +--
 lib/portage/package/ebuild/config.py  | 26 ++---
 lib/portage/util/futures/_asyncio/__init__.py |  9 -
 lib/portage/util/locale.py| 28 +--
 5 files changed, 25 insertions(+), 87 deletions(-)

diff --git a/lib/_emerge/EbuildMetadataPhase.py 
b/lib/_emerge/EbuildMetadataPhase.py
index 53b7ad9624..f4f685e81c 100644
--- a/lib/_emerge/EbuildMetadataPhase.py
+++ b/lib/_emerge/EbuildMetadataPhase.py
@@ -8,14 +8,12 @@ import portage
 
 portage.proxy.lazyimport.lazyimport(
 globals(),
-"_emerge.EbuildPhase:_setup_locale",
 "portage.package.ebuild._metadata_invalid:eapi_invalid",
 )
 from portage import os
 from portage import _encodings
 from portage import _unicode_decode
 from portage import _unicode_encode
-from portage.util.futures import asyncio
 
 import fcntl
 
@@ -46,12 +44,6 @@ class EbuildMetadataPhase(SubProcess):
 _files_dict = slot_dict_class(_file_names, prefix="")
 
 def _start(self):
-asyncio.ensure_future(
-self._async_start(), loop=self.scheduler
-).add_done_callback(self._async_start_done)
-
-async def _async_start(self):
-
 ebuild_path = self.ebuild_hash.location
 
 with open(
@@ -83,9 +75,6 @@ class EbuildMetadataPhase(SubProcess):
 settings.setcpv(self.cpv)
 settings.configdict["pkg"]["EAPI"] = parsed_eapi
 
-# This requires above setcpv and EAPI setup.
-await _setup_locale(self.settings)
-
 debug = settings.get("PORTAGE_DEBUG") == "1"
 master_fd = None
 slave_fd = None
@@ -150,16 +139,6 @@ class EbuildMetadataPhase(SubProcess):
 
 self._proc = retval
 
-def _async_start_done(self, future):
-future.cancelled() or future.result()
-if future.cancelled():
-self.cancel()
-self._was_cancelled()
-
-if self.returncode is not None:
-self._unregister()
-self.wait()
-
 def _output_handler(self):
 while True:
 buf = self._read_buf(self._files.ebuild)

diff --git a/lib/_emerge/EbuildPhase.py b/lib/_emerge/EbuildPhase.py
index c8caf73722..c81bf54a81 100644
--- a/lib/_emerge/EbuildPhase.py
+++ b/lib/_emerge/EbuildPhase.py
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 import functools
@@ -24,7 +24,6 @@ from portage.package.ebuild.prepare_build_dirs import (
 _prepare_fake_distdir,
 _prepare_fake_filesdir,
 )
-from portage.eapi import _get_eapi_attrs
 from portage.util import writemsg, ensure_dirs
 from portage.util._async.AsyncTaskFuture import AsyncTaskFuture
 from portage.util._async.BuildLogger import BuildLogger
@@ -55,34 +54,12 @@ portage.proxy.lazyimport.lazyimport(
 + "_post_src_install_write_metadata,"
 + "_preinst_bsdflags",
 "portage.util.futures.unix_events:_set_nonblocking",
-"portage.util.locale:async_check_locale,split_LC_ALL",
 )
 from portage import os
 from portage import _encodings
 from portage import _unicode_encode
 
 
-async def _setup_locale(settings):
-eapi_attrs = _get_eapi_attrs(settings["EAPI"])
-if eapi_attrs.posixish_locale:
-split_LC_ALL(settings)
-settings["LC_COLLATE"] = "C"
-# check_locale() returns None when check can not be executed.
-if await async_check_locale(silent=True, env=settings.environ()) is 
False:
-# try another locale
-for l in ("C.UTF-8", "en_US.UTF-8", "en_GB.UTF-8", "C"):
-settings["LC_CTYPE"] = l
-if await async_check_locale(silent=True, 
env=settings.environ()):
-# TODO: output the following only once
-# writemsg(
-# _("!!! LC_CTYPE unsupported, using %s instead\n")
-# % self.settings["LC_CTYPE"]
-# )
-break
-else:
-raise AssertionError("C locale did not pass the test!")
-
-
 class EbuildPhase(CompositeTask):

[gentoo-commits] proj/portage:master commit in: lib/portage/package/ebuild/, lib/_emerge/, lib/portage/package/ebuild/_config/, ...

2022-04-04 Thread Matt Turner
commit: 328a87e50b0559517ca4b6c016617afc5ac7a2f4
Author: Matt Turner  gentoo  org>
AuthorDate: Sat Feb 19 01:46:16 2022 +
Commit: Matt Turner  gentoo  org>
CommitDate: Sat Apr  2 04:22:53 2022 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=328a87e5

Eliminate now-dead code from EAPIs 4-python and 5-progress

Signed-off-by: Matt Turner  gentoo.org>

 bin/eapi.sh|  32 
 bin/ebuild.sh  |   9 --
 bin/phase-helpers.sh   | 166 -
 bin/save-ebuild-env.sh |   7 -
 lib/_emerge/EbuildMetadataPhase.py |  17 ---
 lib/_emerge/Package.py |  15 +-
 lib/portage/dep/__init__.py| 138 -
 lib/portage/eapi.py|  26 
 lib/portage/package/ebuild/_config/UseManager.py   |   3 +-
 .../package/ebuild/_config/unpack_dependencies.py  |  55 ---
 lib/portage/package/ebuild/config.py   |   8 -
 lib/portage/package/ebuild/doebuild.py |   9 --
 lib/portage/tests/resolver/ResolverPlayground.py   |   1 -
 lib/portage/versions.py|  66 ++--
 14 files changed, 45 insertions(+), 507 deletions(-)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index b6d2e07f1..a39513b1c 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -144,34 +144,6 @@ ___eapi_has_useq() {
[[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-slot-abi|5|6|7)$ ]]
 }
 
-___eapi_has_master_repositories() {
-   [[ ${1-${EAPI-0}} =~ ^$ ]]
-}
-
-___eapi_has_repository_path() {
-   [[ ${1-${EAPI-0}} =~ ^$ ]]
-}
-
-___eapi_has_available_eclasses() {
-   [[ ${1-${EAPI-0}} =~ ^$ ]]
-}
-
-___eapi_has_eclass_path() {
-   [[ ${1-${EAPI-0}} =~ ^$ ]]
-}
-
-___eapi_has_license_path() {
-   [[ ${1-${EAPI-0}} =~ ^$ ]]
-}
-
-___eapi_has_package_manager_build_user() {
-   [[ ${1-${EAPI-0}} =~ ^$ ]]
-}
-
-___eapi_has_package_manager_build_group() {
-   [[ ${1-${EAPI-0}} =~ ^$ ]]
-}
-
 # HELPERS BEHAVIOR
 
 ___eapi_best_version_and_has_version_support_--host-root() {
@@ -296,10 +268,6 @@ ___eapi_enables_failglob_in_global_scope() {
[[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-slot-abi|5)$ ]]
 }
 
-___eapi_enables_globstar() {
-   [[ ${1-${EAPI-0}} =~ ^$ ]]
-}
-
 ___eapi_bash_3_2() {
[[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-slot-abi|5)$ ]]
 }

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 5b0b79585..628d7eb80 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -73,11 +73,6 @@ else
# These functions die because calls to them during the "depend" phase
# are considered to be severe QA violations.
funcs+=" best_version has_version portageq"
-   ___eapi_has_master_repositories && funcs+=" master_repositories"
-   ___eapi_has_repository_path && funcs+=" repository_path"
-   ___eapi_has_available_eclasses && funcs+=" available_eclasses"
-   ___eapi_has_eclass_path && funcs+=" eclass_path"
-   ___eapi_has_license_path && funcs+=" license_path"
for x in ${funcs} ; do
eval "${x}() { die \"\${FUNCNAME}() calls are not allowed in 
global scope\"; }"
done
@@ -573,10 +568,6 @@ if ! has "$EBUILD_PHASE" clean cleanrm depend && \
[[ -n $EAPI ]] || EAPI=0
 fi
 
-if ___eapi_enables_globstar; then
-   shopt -s globstar
-fi
-
 # Convert quoted paths to array.
 eval "PORTAGE_ECLASS_LOCATIONS=(${PORTAGE_ECLASS_LOCATIONS})"
 

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index a6aaa7926..0a3bc5cb7 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -1210,169 +1210,3 @@ if ___eapi_has_in_iuse; then
has "${use}" "${liuse[@]#[+-]}"
}
 fi
-
-if ___eapi_has_master_repositories; then
-   master_repositories() {
-   local output repository=$1 retval
-   shift
-   [[ $# -gt 0 ]] && die "${FUNCNAME[0]}: unused argument(s): $*"
-
-   if [[ -n ${PORTAGE_IPC_DAEMON} ]]; then
-   "${PORTAGE_BIN_PATH}/ebuild-ipc" master_repositories 
"${EROOT}" "${repository}"
-   else
-   output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" 
master_repositories "${EROOT}" "${repository}")
-   fi
-   retval=$?
-   [[ -n ${output} ]] && echo "${output}"
-   case "${retval}" in
-   0|1)
-   return ${retval}
-   ;;
-   2)
-   die "${FUNCNAME[0]}: invalid repository: 
${repository}"
-   ;;
-   *)
-   if [[ -n ${PORTAGE_IPC_DAEMON} ]]; then
-   die "${FUNCNAME[0]}: unexpected 
ebuild-ipc exit code: ${retval}"
-   else
- 

[gentoo-commits] proj/portage:master commit in: lib/portage/package/ebuild/, lib/_emerge/, /, ...

2020-08-06 Thread Zac Medico
commit: d695d866e4e7b2ab79264508f1520f89a5585e04
Author: Aaron Bauman  gentoo  org>
AuthorDate: Fri Aug  7 01:12:15 2020 +
Commit: Zac Medico  gentoo  org>
CommitDate: Fri Aug  7 02:53:12 2020 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=d695d866

*: drop all import __future__ statements

* We only support Py3 now.

Signed-off-by: Aaron Bauman  gentoo.org>
Signed-off-by: Zac Medico  gentoo.org>

 bin/archive-conf   |  4 +---
 bin/check-implicit-pointer-usage.py|  2 --
 bin/clean_locks|  4 +---
 bin/dispatch-conf  |  4 +---
 bin/dohtml.py  |  4 +---
 bin/doins.py   |  2 --
 bin/ebuild |  4 +---
 bin/egencache  |  4 ++--
 bin/emaint |  4 +---
 bin/emerge |  4 +---
 bin/env-update |  4 +---
 bin/fixpackages|  4 +---
 bin/glsa-check |  4 +---
 bin/portageq   |  4 +---
 bin/quickpkg   |  4 +---
 bin/regenworld |  4 +---
 lib/_emerge/Scheduler.py   |  2 --
 lib/_emerge/UserQuery.py   |  2 --
 lib/_emerge/actions.py |  2 --
 lib/_emerge/chk_updated_cfg_files.py   |  2 --
 lib/_emerge/countdown.py   |  4 +---
 lib/_emerge/depgraph.py|  4 +---
 lib/_emerge/help.py|  4 +---
 lib/_emerge/main.py|  2 --
 lib/_emerge/post_emerge.py |  4 +---
 lib/_emerge/resolver/circular_dependency.py|  8 +++
 lib/_emerge/resolver/package_tracker.py|  4 +---
 lib/_emerge/resolver/slot_collision.py |  3 +--
 lib/_emerge/unmerge.py |  2 --
 lib/portage/_emirrordist/FetchTask.py  |  2 --
 lib/portage/_global_updates.py |  4 +---
 lib/portage/_sets/__init__.py  |  2 --
 lib/portage/_sets/dbapi.py |  2 --
 lib/portage/_sets/libs.py  |  4 +---
 lib/portage/cache/anydbm.py|  5 ++--
 lib/portage/cache/sqlite.py|  3 +--
 lib/portage/cvstree.py |  2 --
 lib/portage/dbapi/vartree.py   |  2 --
 lib/portage/dispatch_conf.py   |  5 +---
 lib/portage/elog/mod_echo.py   |  4 +---
 lib/portage/emaint/main.py |  4 +---
 lib/portage/glsa.py| 27 +++---
 lib/portage/localization.py|  4 +---
 lib/portage/metadata.py|  4 +---
 lib/portage/module.py  |  5 +---
 lib/portage/news.py|  2 --
 lib/portage/output.py  |  2 --
 lib/portage/package/ebuild/fetch.py|  2 --
 lib/portage/sync/controller.py |  3 ---
 lib/portage/sync/old_tree_timestamp.py |  4 +---
 lib/portage/tests/__init__.py  |  4 +---
 lib/portage/tests/util/test_xattr.py   |  4 +---
 .../util/_dyn_libs/display_preserved_libs.py   |  6 ++---
 lib/portage/util/_eventloop/EventLoop.py   |  5 +---
 lib/portage/util/_eventloop/PollSelectAdapter.py   |  5 ++--
 lib/portage/util/_xattr.py |  4 +---
 lib/portage/util/locale.py |  4 ++--
 lib/portage/util/movefile.py   |  2 --
 repoman/bin/repoman|  5 ++--
 repoman/lib/repoman/actions.py |  4 +---
 repoman/lib/repoman/errors.py  |  2 --
 repoman/lib/repoman/gpg.py |  2 --
 repoman/lib/repoman/main.py|  5 ++--
 repoman/lib/repoman/metadata.py|  2 --
 repoman/lib/repoman/modules/commit/repochecks.py   |  2 --
 repoman/lib/repoman/modules/scan/ebuild/ebuild.py  |  3 +--
 repoman/lib/repoman/modules/vcs/settings.py|  3 +--
 repoman/lib/repoman/modules/vcs/vcs.py |  3 +--
 repoman/lib/repoman/profile.py |  2 --
 repoman/lib/repoman/scanner.py |  6 ++---
 repoman/lib/repoman/tests/__init__.py  |  4 +---
 repoman/lib/repoman/utilities.py   |  4 +---
 repoman/runtests   |  4 +---
 repoman/setup.py   |  4 

[gentoo-commits] proj/portage:master commit in: lib/portage/package/ebuild/, lib/_emerge/

2020-02-29 Thread Zac Medico
commit: ec654122c0eb191c90ffb2c191403d342dbc361e
Author: Zac Medico  gentoo  org>
AuthorDate: Sun Mar  1 05:58:00 2020 +
Commit: Zac Medico  gentoo  org>
CommitDate: Sun Mar  1 05:58:46 2020 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ec654122

fetch: drop privileges early for NFS root_squash (bug 601252)

Drop privileges prior to fetch function calls, so that
all necessary operations can succeed when DISTDIR is
on NFS with root_squash enabled.

Bug: https://bugs.gentoo.org/601252
Signed-off-by: Zac Medico  gentoo.org>

 lib/_emerge/EbuildFetcher.py   | 12 +++-
 lib/portage/package/ebuild/doebuild.py | 22 +-
 lib/portage/package/ebuild/fetch.py| 31 +++
 3 files changed, 59 insertions(+), 6 deletions(-)

diff --git a/lib/_emerge/EbuildFetcher.py b/lib/_emerge/EbuildFetcher.py
index c9e03dc97..d315d4f02 100644
--- a/lib/_emerge/EbuildFetcher.py
+++ b/lib/_emerge/EbuildFetcher.py
@@ -12,7 +12,12 @@ from portage import _unicode_encode
 from portage import _unicode_decode
 from portage.checksum import _hash_filter
 from portage.elog.messages import eerror
-from portage.package.ebuild.fetch import _check_distfile, fetch
+from portage.package.ebuild.fetch import (
+   _check_distfile,
+   _drop_privs_userfetch,
+   _want_userfetch,
+   fetch,
+)
 from portage.util._async.AsyncTaskFuture import AsyncTaskFuture
 from portage.util._async.ForkProcess import ForkProcess
 from portage.util.futures.compat_coroutine import coroutine
@@ -239,6 +244,11 @@ class _EbuildFetcherProcess(ForkProcess):
portage.output.havecolor = self._settings.get('NOCOLOR') \
not in ('yes', 'true')
 
+   # For userfetch, drop privileges for the entire fetch call, in
+   # order to handle DISTDIR on NFS with root_squash for bug 
601252.
+   if _want_userfetch(self._settings):
+   _drop_privs_userfetch(self._settings)
+
rval = 1
allow_missing = self._get_manifest().allow_missing or \
'digest' in self._settings.features

diff --git a/lib/portage/package/ebuild/doebuild.py 
b/lib/portage/package/ebuild/doebuild.py
index 92e9d755c..71e3a74ce 100644
--- a/lib/portage/package/ebuild/doebuild.py
+++ b/lib/portage/package/ebuild/doebuild.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2019 Gentoo Authors
+# Copyright 2010-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 from __future__ import unicode_literals
@@ -30,7 +30,7 @@ portage.proxy.lazyimport.lazyimport(globals(),
'portage.package.ebuild.config:check_config_instance',
'portage.package.ebuild.digestcheck:digestcheck',
'portage.package.ebuild.digestgen:digestgen',
-   'portage.package.ebuild.fetch:fetch',
+   
'portage.package.ebuild.fetch:_drop_privs_userfetch,_want_userfetch,fetch',
'portage.package.ebuild.prepare_build_dirs:_prepare_fake_distdir',
'portage.package.ebuild._ipc.QueryCommand:QueryCommand',
'portage.dep._slot_operator:evaluate_slot_operator_equal_deps',
@@ -83,6 +83,7 @@ from portage.util.cpuinfo import get_cpu_count
 from portage.util.lafilefixer import rewrite_lafile
 from portage.util.compression_probe import _compressors
 from portage.util.futures import asyncio
+from portage.util.futures.executor.fork import ForkExecutor
 from portage.util.path import first_existing
 from portage.util.socks5 import get_socks5_proxy
 from portage.versions import _pkgsplit
@@ -1082,9 +1083,20 @@ def doebuild(myebuild, mydo, _unused=DeprecationWarning, 
settings=None, debug=0,
dist_digests = None
if mf is not None:
dist_digests = mf.getTypeDigests("DIST")
-   if not fetch(fetchme, mysettings, listonly=listonly,
-   fetchonly=fetchonly, 
allow_missing_digests=False,
-   digests=dist_digests):
+
+   def _fetch_subprocess(fetchme, mysettings, listonly, 
dist_digests):
+   # For userfetch, drop privileges for the entire 
fetch call, in
+   # order to handle DISTDIR on NFS with 
root_squash for bug 601252.
+   if _want_userfetch(mysettings):
+   _drop_privs_userfetch(mysettings)
+
+   return fetch(fetchme, mysettings, 
listonly=listonly,
+   fetchonly=fetchonly, 
allow_missing_digests=False,
+   digests=dist_digests)
+
+   loop = asyncio._safe_loop()
+   if not 
loop.run_until_complete(loop.run_in_executor(ForkExecutor(loop=loop),
+   _fetch_subprocess, fetchme, mysettings, 
listonly,