Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH v2] SyncManager.async: initialize attributes before fork (bug 561234)
Date: Wed, 23 Sep 2015 19:14:41
Message-Id: 1443035645-27442-1-git-send-email-zmedico@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] SyncManager.async: initialize attributes before fork (bug 561234) by Zac Medico
1 Since commit 496ff326dc18890889d1ea5d2aec590394635960, the pre_sync
2 method executes in a forked child process. Therefore, initialize
3 attributes before the fork (in the async method).
4
5 Fixes: 496ff326dc18 ("sync repositories in parallel (bug 557426)")
6 X-Gentoo-Bug: 561234
7 X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=561234
8 ---
9 [PATCH v2] adds self.emerge_config to the initialized attributes
10
11 pym/portage/sync/controller.py | 8 ++++----
12 1 file changed, 4 insertions(+), 4 deletions(-)
13
14 diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
15 index e992cc4..28dbc57 100644
16 --- a/pym/portage/sync/controller.py
17 +++ b/pym/portage/sync/controller.py
18 @@ -115,13 +115,16 @@ class SyncManager(object):
19 return []
20
21 def async(self, emerge_config=None, repo=None):
22 + self.emerge_config = emerge_config
23 + self.settings, self.trees, self.mtimedb = emerge_config
24 + self.xterm_titles = "notitles" not in self.settings.features
25 + self.portdb = self.trees[self.settings['EROOT']]['porttree'].dbapi
26 proc = AsyncFunction(target=self.sync,
27 kwargs=dict(emerge_config=emerge_config, repo=repo))
28 proc.addExitListener(self._sync_callback)
29 return proc
30
31 def sync(self, emerge_config=None, repo=None):
32 - self.emerge_config = emerge_config
33 self.callback = None
34 self.repo = repo
35 self.exitcode = 1
36 @@ -199,13 +202,10 @@ class SyncManager(object):
37
38
39 def pre_sync(self, repo):
40 - self.settings, self.trees, self.mtimedb = self.emerge_config
41 - self.xterm_titles = "notitles" not in self.settings.features
42 msg = ">>> Syncing repository '%s' into '%s'..." \
43 % (repo.name, repo.location)
44 self.logger(self.xterm_titles, msg)
45 writemsg_level(msg + "\n")
46 - self.portdb = self.trees[self.settings['EROOT']]['porttree'].dbapi
47 try:
48 st = os.stat(repo.location)
49 except OSError:
50 --
51 2.4.6

Replies