def _unregister(self): ForkProcess._unregister(self) pipe_reader = self._digest_pipe_reader if pipe_reader is not None: self._digest_pipe_reader = None pipe_reader.removeExitListener(self._digest_pipe_reader_exit) pipe_reader.cancel()
def _unregister(self): ForkProcess._unregister(self) pipe_reader = self._async_func_reader if pipe_reader is not None: self._async_func_reader = None pipe_reader.removeExitListener(self._async_func_reader_exit) pipe_reader.cancel()
def _async_waitpid_cb(self, *args, **kwargs): """ Override _async_waitpid_cb to perform cleanup that is not necessarily idempotent. """ ForkProcess._async_waitpid_cb(self, *args, **kwargs) if self.returncode == portage.const.RETURNCODE_POSTINST_FAILURE: self.postinst_failure = True self.returncode = os.EX_OK
def _start(self): root_config = self.pkg.root_config portdb = root_config.trees["porttree"].dbapi ebuild_path = self._get_ebuild_path() try: uri_map = self._get_uri_map() except portage.exception.InvalidDependString as e: msg_lines = [] msg = "Fetch failed for '%s' due to invalid SRC_URI: %s" % \ (self.pkg.cpv, e) msg_lines.append(msg) self._eerror(msg_lines) self._set_returncode((self.pid, 1 << 8)) self._async_wait() return if not uri_map: # Nothing to fetch. self._set_returncode((self.pid, os.EX_OK << 8)) self._async_wait() return settings = self.config_pool.allocate() settings.setcpv(self.pkg) portage.doebuild_environment(ebuild_path, 'fetch', settings=settings, db=portdb) if self.prefetch and \ self._prefetch_size_ok(uri_map, settings, ebuild_path): self.config_pool.deallocate(settings) self._set_returncode((self.pid, os.EX_OK << 8)) self._async_wait() return nocolor = settings.get("NOCOLOR") if self.prefetch: settings["PORTAGE_PARALLEL_FETCHONLY"] = "1" if self.background: nocolor = "true" if nocolor is not None: settings["NOCOLOR"] = nocolor self._settings = settings ForkProcess._start(self) # Free settings now since it's no longer needed in # this process (the subprocess has a private copy). self.config_pool.deallocate(settings) settings = None self._settings = None
def _start(self): root_config = self.pkg.root_config portdb = root_config.trees["porttree"].dbapi ebuild_path = self._get_ebuild_path() try: uri_map = self._get_uri_map() except portage.exception.InvalidDependString as e: msg_lines = [] msg = "Fetch failed for '%s' due to invalid SRC_URI: %s" % \ (self.pkg.cpv, e) msg_lines.append(msg) self._eerror(msg_lines) self._set_returncode((self.pid, 1 << 8)) self.wait() return if not uri_map: # Nothing to fetch. self._set_returncode((self.pid, os.EX_OK << 8)) self.wait() return settings = self.config_pool.allocate() settings.setcpv(self.pkg) portage.doebuild_environment(ebuild_path, 'fetch', settings=settings, db=portdb) if self.prefetch and \ self._prefetch_size_ok(uri_map, settings, ebuild_path): self.config_pool.deallocate(settings) self._set_returncode((self.pid, os.EX_OK << 8)) self.wait() return nocolor = settings.get("NOCOLOR") if self.prefetch: settings["PORTAGE_PARALLEL_FETCHONLY"] = "1" if self.background: nocolor = "true" if nocolor is not None: settings["NOCOLOR"] = nocolor self._settings = settings ForkProcess._start(self) # Free settings now since it's no longer needed in # this process (the subprocess has a private copy). self.config_pool.deallocate(settings) settings = None self._settings = None
def _start(self): pr, pw = os.pipe() self.fd_pipes = {} self.fd_pipes[pw] = pw self._async_func_reader_pw = pw self._async_func_reader = PipeReader(input_files={"input": pr}, scheduler=self.scheduler) self._async_func_reader.addExitListener(self._async_func_reader_exit) self._async_func_reader.start() ForkProcess._start(self) os.close(pw)
def _start(self): pr, pw = os.pipe() self.fd_pipes = {} self.fd_pipes[pw] = pw self._digest_pw = pw self._digest_pipe_reader = PipeReader( input_files={"input":pr}, scheduler=self.scheduler) self._digest_pipe_reader.addExitListener(self._digest_pipe_reader_exit) self._digest_pipe_reader.start() ForkProcess._start(self) os.close(pw)
def _set_returncode(self, wait_retval): ForkProcess._set_returncode(self, wait_retval) # Collect elog messages that might have been # created by the pkg_nofetch phase. # Skip elog messages for prefetch, in order to avoid duplicates. if not self.prefetch and self.returncode != os.EX_OK: msg_lines = [] msg = "Fetch failed for '%s'" % (self.pkg.cpv,) if self.logfile is not None: msg += ", Log file:" msg_lines.append(msg) if self.logfile is not None: msg_lines.append(" '%s'" % (self.logfile,)) self._eerror(msg_lines)
def _set_returncode(self, wait_retval): ForkProcess._set_returncode(self, wait_retval) # Collect elog messages that might have been # created by the pkg_nofetch phase. # Skip elog messages for prefetch, in order to avoid duplicates. if not self.prefetch and self.returncode != os.EX_OK: msg_lines = [] msg = "Fetch failed for '%s'" % (self.pkg.cpv, ) if self.logfile is not None: msg += ", Log file:" msg_lines.append(msg) if self.logfile is not None: msg_lines.append(" '%s'" % (self.logfile, )) self._eerror(msg_lines)
def _start(self): root_config = self.pkg.root_config portdb = root_config.trees["porttree"].dbapi ebuild_path = self._get_ebuild_path() # This is initialized by an earlier _async_uri_map call. uri_map = self._uri_map if not uri_map: # Nothing to fetch. self.returncode = os.EX_OK self._async_wait() return settings = self.config_pool.allocate() settings.setcpv(self.pkg) settings.configdict["pkg"]["SRC_URI"] = self.src_uri portage.doebuild_environment(ebuild_path, 'fetch', settings=settings, db=portdb) if self.prefetch and \ self._prefetch_size_ok(uri_map, settings, ebuild_path): self.config_pool.deallocate(settings) self.returncode = os.EX_OK self._async_wait() return nocolor = settings.get("NOCOLOR") if self.prefetch: settings["PORTAGE_PARALLEL_FETCHONLY"] = "1" if self.background: nocolor = "true" if nocolor is not None: settings["NOCOLOR"] = nocolor self._settings = settings ForkProcess._start(self) # Free settings now since it's no longer needed in # this process (the subprocess has a private copy). self.config_pool.deallocate(settings) settings = None self._settings = None
def _async_waitpid_cb(self, *args, **kwargs): """ Override _async_waitpid_cb to perform cleanup that is not necessarily idempotent. """ ForkProcess._async_waitpid_cb(self, *args, **kwargs) # Collect elog messages that might have been # created by the pkg_nofetch phase. # Skip elog messages for prefetch, in order to avoid duplicates. if not self.prefetch and self.returncode != os.EX_OK: msg_lines = [] msg = "Fetch failed for '%s'" % (self.pkg.cpv,) if self.logfile is not None: msg += ", Log file:" msg_lines.append(msg) if self.logfile is not None: msg_lines.append(" '%s'" % (self.logfile,)) self._eerror(msg_lines)
def _start(self): self.addExitListener(self._future_done) ForkProcess._start(self)
def _async_waitpid(self): # Ignore this event, since we want to ensure that we # exit only after _digest_pipe_reader has reached EOF. if self._digest_pipe_reader is None: ForkProcess._async_waitpid(self)
def _async_waitpid(self): # Ignore this event, since we want to ensure that we exit # only after _async_func_reader_exit has reached EOF. if self._async_func_reader is None: ForkProcess._async_waitpid(self)
def _set_returncode(self, wait_retval): ForkProcess._set_returncode(self, wait_retval) if self.returncode == portage.const.RETURNCODE_POSTINST_FAILURE: self.postinst_failure = True self.returncode = os.EX_OK
def _async_start(self): self.addExitListener(self._future_done) yield ForkProcess._async_start(self)