* [gentoo-commits] proj/portage:master commit in: lib/portage/tests/ebuild/, lib/_emerge/
@ 2023-10-24 15:31 Zac Medico
0 siblings, 0 replies; only message in thread
From: Zac Medico @ 2023-10-24 15:31 UTC (permalink / raw
To: gentoo-commits
commit: 79e7024147faff511a69ac725ba63ba71a474aee
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 24 03:46:19 2023 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Oct 24 04:03:46 2023 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=79e70241
EbuildFetcher: multiprocessing spawn compat
Tested with this script:
import contextlib
import multiprocessing
import unittest
from portage.tests.conftest import prepare_environment
from portage.tests.ebuild.test_fetch import EbuildFetchTestCase
if __name__ == "__main__":
multiprocessing.set_start_method("spawn", force=True)
with contextlib.contextmanager(prepare_environment.__wrapped__)():
unittest.main()
Bug: https://bugs.gentoo.org/914876
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
lib/_emerge/EbuildFetcher.py | 12 ++++--------
lib/portage/tests/ebuild/test_fetch.py | 24 ++++++++++++++----------
2 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/lib/_emerge/EbuildFetcher.py b/lib/_emerge/EbuildFetcher.py
index edabe54456..7a45d95172 100644
--- a/lib/_emerge/EbuildFetcher.py
+++ b/lib/_emerge/EbuildFetcher.py
@@ -250,8 +250,7 @@ class _EbuildFetcherProcess(ForkProcess):
self.target = functools.partial(
self._target,
self._settings,
- self._get_digests,
- self._get_manifest,
+ self._get_manifest(),
self._uri_map,
self.fetchonly,
)
@@ -264,10 +263,7 @@ class _EbuildFetcherProcess(ForkProcess):
self._settings = None
@staticmethod
- def _target(settings, get_digests, get_manifest, uri_map, fetchonly):
- """
- TODO: Make all arguments picklable for the multiprocessing spawn start method.
- """
+ def _target(settings, manifest, uri_map, fetchonly):
# Force consistent color output, in case we are capturing fetch
# output through a normal pipe due to unavailability of ptys.
portage.output.havecolor = settings.get("NOCOLOR") not in ("yes", "true")
@@ -278,12 +274,12 @@ class _EbuildFetcherProcess(ForkProcess):
_drop_privs_userfetch(settings)
rval = 1
- allow_missing = get_manifest().allow_missing or "digest" in settings.features
+ allow_missing = manifest.allow_missing or "digest" in settings.features
if fetch(
uri_map,
settings,
fetchonly=fetchonly,
- digests=copy.deepcopy(get_digests()),
+ digests=copy.deepcopy(manifest.getTypeDigests("DIST")),
allow_missing_digests=allow_missing,
):
rval = os.EX_OK
diff --git a/lib/portage/tests/ebuild/test_fetch.py b/lib/portage/tests/ebuild/test_fetch.py
index 76dcdaf88c..a9ca030ff9 100644
--- a/lib/portage/tests/ebuild/test_fetch.py
+++ b/lib/portage/tests/ebuild/test_fetch.py
@@ -335,16 +335,7 @@ class EbuildFetchTestCase(TestCase):
)
)
- # Tests only work with one ebuild at a time, so the config
- # pool only needs a single config instance.
- class config_pool:
- @staticmethod
- def allocate():
- return settings
-
- @staticmethod
- def deallocate(settings):
- pass
+ config_pool = config_pool_cls(settings)
def async_fetch(pkg, ebuild_path):
fetcher = EbuildFetcher(
@@ -880,3 +871,16 @@ class EbuildFetchTestCase(TestCase):
self.assertEqual(filename_result, str(filename))
finally:
shutil.rmtree(distdir)
+
+
+# Tests only work with one ebuild at a time, so the config
+# pool only needs a single config instance.
+class config_pool_cls:
+ def __init__(self, settings):
+ self._settings = settings
+
+ def allocate(self):
+ return self._settings
+
+ def deallocate(self, settings):
+ pass
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-10-24 15:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-24 15:31 [gentoo-commits] proj/portage:master commit in: lib/portage/tests/ebuild/, lib/_emerge/ Zac Medico
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox