From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id C4398158089 for ; Thu, 5 Oct 2023 04:45:37 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 00F302BC02E; Thu, 5 Oct 2023 04:45:37 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id DED3F2BC02E for ; Thu, 5 Oct 2023 04:45:36 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 75BF5335C67 for ; Thu, 5 Oct 2023 04:45:35 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id D86239AC for ; Thu, 5 Oct 2023 04:45:33 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1696479511.8e88810e61b6b36bd36e8fb1e5ae76715a72dcd9.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: lib/_emerge/EbuildFetcher.py X-VCS-Directories: lib/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 8e88810e61b6b36bd36e8fb1e5ae76715a72dcd9 X-VCS-Branch: master Date: Thu, 5 Oct 2023 04:45:33 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: ca1adbe1-55a1-4864-8a0c-30874391e23e X-Archives-Hash: fe31c4baa1dd78606d14f0c69f6e925e commit: 8e88810e61b6b36bd36e8fb1e5ae76715a72dcd9 Author: Zac Medico gentoo org> AuthorDate: Thu Oct 5 04:17:10 2023 +0000 Commit: Zac Medico gentoo org> CommitDate: Thu Oct 5 04:18:31 2023 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=8e88810e EbuildFetcherProcess: Migrate to ForkProcess target parameter Bug: https://bugs.gentoo.org/915099 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/EbuildFetcher.py | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/lib/_emerge/EbuildFetcher.py b/lib/_emerge/EbuildFetcher.py index 7e28be4938..edabe54456 100644 --- a/lib/_emerge/EbuildFetcher.py +++ b/lib/_emerge/EbuildFetcher.py @@ -1,7 +1,8 @@ -# Copyright 1999-2020 Gentoo Authors +# Copyright 1999-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import copy +import functools import io import sys @@ -246,6 +247,14 @@ class _EbuildFetcherProcess(ForkProcess): self._settings = settings self.log_filter_file = settings.get("PORTAGE_LOG_FILTER_FILE_CMD") + self.target = functools.partial( + self._target, + self._settings, + self._get_digests, + self._get_manifest, + self._uri_map, + self.fetchonly, + ) ForkProcess._start(self) # Free settings now since it's no longer needed in @@ -254,25 +263,27 @@ class _EbuildFetcherProcess(ForkProcess): settings = None self._settings = None - def _run(self): + @staticmethod + def _target(settings, get_digests, get_manifest, uri_map, fetchonly): + """ + TODO: Make all arguments picklable for the multiprocessing spawn start method. + """ # Force consistent color output, in case we are capturing fetch # output through a normal pipe due to unavailability of ptys. - portage.output.havecolor = self._settings.get("NOCOLOR") not in ("yes", "true") + portage.output.havecolor = 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) + if _want_userfetch(settings): + _drop_privs_userfetch(settings) rval = 1 - allow_missing = ( - self._get_manifest().allow_missing or "digest" in self._settings.features - ) + allow_missing = get_manifest().allow_missing or "digest" in settings.features if fetch( - self._uri_map, - self._settings, - fetchonly=self.fetchonly, - digests=copy.deepcopy(self._get_digests()), + uri_map, + settings, + fetchonly=fetchonly, + digests=copy.deepcopy(get_digests()), allow_missing_digests=allow_missing, ): rval = os.EX_OK