MergeProcess: query blockers in the main process
authorZac Medico <zmedico@gentoo.org>
Sat, 26 Mar 2011 23:25:15 +0000 (16:25 -0700)
committerZac Medico <zmedico@gentoo.org>
Sat, 26 Mar 2011 23:25:15 +0000 (16:25 -0700)
Metadata cache queries may not work for some databases from within a
subprocess. For example, sqlite is known to misbehave.

pym/portage/dbapi/_MergeProcess.py
pym/portage/dbapi/vartree.py

index 43111cb16af0a6ac584f9bcc468f19b4d3f11358..ea7c3e6d66608c0ebacfeda44a88157964c20f60 100644 (file)
@@ -114,9 +114,15 @@ class MergeProcess(SpawnProcess):
                elog_reader_fd, elog_writer_fd = os.pipe()
                fcntl.fcntl(elog_reader_fd, fcntl.F_SETFL,
                        fcntl.fcntl(elog_reader_fd, fcntl.F_GETFL) | os.O_NONBLOCK)
+               blockers = None
+               if self.blockers is not None:
+                       # Query blockers in the main process, since metadata cache
+                       # queries may not work for some databases from within a
+                       # subprocess. For example, sqlite is known to misbehave.
+                       blockers = self.blockers()
                mylink = self.dblink(self.mycat, self.mypkg, settings=self.settings,
                        treetype=self.treetype, vartree=self.vartree,
-                       blockers=self.blockers, scheduler=self.scheduler,
+                       blockers=blockers, scheduler=self.scheduler,
                        pipe=elog_writer_fd)
                fd_pipes[elog_writer_fd] = elog_writer_fd
                self._elog_reg_id = self.scheduler.register(elog_reader_fd,
index 4be783ddd982682e96695deb0b8ad3f3313632fe..45b5a69832c34e87d66282d53da8f620954cdd1a 100644 (file)
@@ -3076,9 +3076,7 @@ class dblink(object):
                                return 1
 
                # check for package collisions
-               blockers = None
-               if self._blockers is not None:
-                       blockers = self._blockers()
+               blockers = self._blockers
                if blockers is None:
                        blockers = []
                collisions, plib_collisions = \