the task is complete and self.returncode has been set.
"""
- __slots__ = ("cancelled", "returncode") + ("_exit_listeners",)
+ __slots__ = ("background", "cancelled", "returncode") + \
+ ("_exit_listeners",)
def start(self):
"""
(pkg_count.curval, pkg_count.maxval, pkg.cpv)
logger.log(msg, short_msg=short_msg)
- build = EbuildExecuter(pkg=pkg, scheduler=scheduler,
- settings=settings)
+ build = EbuildExecuter(background=self.background, pkg=pkg,
+ scheduler=scheduler, settings=settings)
self._start_task(build, self._build_exit)
def _fetchonly_exit(self, fetcher):
self.wait()
return
- packager = EbuildBinpkg(pkg=self.pkg,
+ packager = EbuildBinpkg(background=self.background, pkg=self.pkg,
scheduler=self.scheduler, settings=self.settings)
self._start_task(packager, self._buildpkg_exit)
self.opts.buildpkgonly:
# Need to call "clean" phase for buildpkgonly mode
phase = "clean"
- clean_phase = EbuildPhase(pkg=self.pkg, phase=phase,
+ clean_phase = EbuildPhase(background=self.background,
+ pkg=self.pkg, phase=phase,
scheduler=self.scheduler, settings=self.settings,
tree=self._tree)
self._start_task(clean_phase, self._clean_exit)
settings = self.settings
phase = "clean"
- clean_phase = EbuildPhase(pkg=pkg, phase=phase,
+ clean_phase = EbuildPhase(background=self.background, pkg=pkg, phase=phase,
scheduler=scheduler, settings=settings, tree=tree)
self._start_task(clean_phase, self._clean_phase_exit)
ebuild_phases = TaskSequence(scheduler=scheduler)
for phase in self._phases:
- ebuild_phases.add(EbuildPhase(fd_pipes=fd_pipes,
+ ebuild_phases.add(EbuildPhase(background=self.background,
+ fd_pipes=fd_pipes,
pkg=pkg, phase=phase, scheduler=scheduler,
settings=settings, tree=tree))
if fd == sys.stderr.fileno():
sys.stderr.flush()
- fd_pipes_orig = None
+ fd_pipes_orig = fd_pipes.copy()
self.files = self._files_dict()
files = self.files
got_pty = False
fcntl.fcntl(master_fd, fcntl.F_SETFL,
fcntl.fcntl(master_fd, fcntl.F_GETFL) | os.O_NONBLOCK)
- fd_pipes.setdefault(0, sys.stdin.fileno())
- fd_pipes_orig = fd_pipes.copy()
if got_pty and os.isatty(fd_pipes_orig[1]):
from portage.output import get_term_size, set_term_size
rows, columns = get_term_size()
fcntl.fcntl(master_fd, fcntl.F_SETFL,
fcntl.fcntl(master_fd, fcntl.F_GETFL) | os.O_NONBLOCK)
fd_pipes[self._dummy_pipe_fd] = slave_fd
+ if self.background:
+ fd_pipes[1] = slave_fd
+ fd_pipes[2] = slave_fd
retval = portage.doebuild(ebuild_path, self.phase,
root_config.root, settings, debug,
if logfile:
files.log = open(logfile, 'a')
- files.stdout = os.fdopen(os.dup(fd_pipes_orig[1]), 'w')
+ if not self.background:
+ files.stdout = os.fdopen(os.dup(fd_pipes_orig[1]), 'w')
output_handler = self._output_handler
else:
output_handler = self._dummy_handler
except EOFError:
pass
if buf:
- buf.tofile(files.stdout)
- files.stdout.flush()
+ if not self.background:
+ buf.tofile(files.stdout)
+ files.stdout.flush()
buf.tofile(files.log)
files.log.flush()
else:
class Binpkg(CompositeTask):
- __slots__ = ("background", "find_blockers",
+ __slots__ = ("find_blockers",
"ldpath_mtimes", "logger", "opts",
"pkg", "pkg_count", "prefetcher", "settings", "world_atom") + \
("_bintree", "_build_dir", "_ebuild_path", "_fetched_pkg",
execution support (start, poll, and wait methods).
"""
- __slots__ = ("args_set", "background",
+ __slots__ = ("args_set",
"binpkg_opts", "build_opts", "emerge_opts",
"failed_fetches", "find_blockers", "logger", "mtimedb", "pkg",
"pkg_count", "prefetcher", "settings", "world_atom") + \