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)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 0043E158089 for ; Wed, 4 Oct 2023 04:29:50 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 112212BC024; Wed, 4 Oct 2023 04:29:50 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (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 E5ECE2BC024 for ; Wed, 4 Oct 2023 04:29:49 +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 E6378335CE9 for ; Wed, 4 Oct 2023 04:29:48 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 29266921 for ; Wed, 4 Oct 2023 04:29:47 +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: <1696392674.f45e2bb561f2f5d16bdf8f6cd31cc393d2794f92.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/dbapi/ X-VCS-Repository: proj/portage X-VCS-Files: lib/portage/dbapi/_SyncfsProcess.py X-VCS-Directories: lib/portage/dbapi/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: f45e2bb561f2f5d16bdf8f6cd31cc393d2794f92 X-VCS-Branch: master Date: Wed, 4 Oct 2023 04:29:47 +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: 941e217c-285b-4d9a-9758-915c97b082ca X-Archives-Hash: 4d2fb0d99be4db9d3499bd96f0b58d04 commit: f45e2bb561f2f5d16bdf8f6cd31cc393d2794f92 Author: Zac Medico gentoo org> AuthorDate: Wed Oct 4 04:06:49 2023 +0000 Commit: Zac Medico gentoo org> CommitDate: Wed Oct 4 04:11:14 2023 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=f45e2bb5 SyncfsProcess: Migrate to ForkProcess target parameter Bug: https://bugs.gentoo.org/915099 Signed-off-by: Zac Medico gentoo.org> lib/portage/dbapi/_SyncfsProcess.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/portage/dbapi/_SyncfsProcess.py b/lib/portage/dbapi/_SyncfsProcess.py index 6beeac8dd4..ddc2240071 100644 --- a/lib/portage/dbapi/_SyncfsProcess.py +++ b/lib/portage/dbapi/_SyncfsProcess.py @@ -1,6 +1,8 @@ -# Copyright 2012 Gentoo Foundation +# Copyright 2012-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 +import functools + from portage import os from portage.util._ctypes import find_library, LoadLibrary from portage.util._async.ForkProcess import ForkProcess @@ -16,6 +18,10 @@ class SyncfsProcess(ForkProcess): __slots__ = ("paths",) + def _start(self): + self.target = functools.partial(self._target, self._get_syncfs, self.paths) + super()._start() + @staticmethod def _get_syncfs(): filename = find_library("c") @@ -29,12 +35,13 @@ class SyncfsProcess(ForkProcess): return None - def _run(self): + @staticmethod + def _target(get_syncfs, paths): syncfs_failed = False - syncfs = self._get_syncfs() + syncfs = get_syncfs() if syncfs is not None: - for path in self.paths: + for path in paths: try: fd = os.open(path, os.O_RDONLY) except OSError: