v = 0
self._pkg.mtime = v
-class EbuildFetchPretend(SlotObject):
+class EbuildFetchonly(SlotObject):
- __slots__ = ("fetch_all", "pkg", "settings")
+ __slots__ = ("fetch_all", "pkg", "pretend", "settings")
def execute(self):
# To spawn pkg_nofetch requires PORTAGE_BUILDDIR for
retval = portage.doebuild(ebuild_path, "fetch",
self.settings["ROOT"], self.settings, debug=debug,
- listonly=1, fetchonly=1, fetchall=self.fetch_all,
+ listonly=self.pretend, fetchonly=1, fetchall=self.fetch_all,
mydbapi=portdb, tree="porttree")
+ if retval != os.EX_OK:
+ msg = "Fetch failed for '%s'" % (pkg.cpv,)
+ eerror(msg, phase="unpack", key=pkg.cpv)
+
portage.elog.elog_process(self.pkg.cpv, self.settings)
return retval
pkg = self.pkg
settings = self.settings
- if opts.fetchonly and opts.pretend:
- fetcher = EbuildFetchPretend(
+ if opts.fetchonly:
+ fetcher = EbuildFetchonly(
fetch_all=opts.fetch_all_uri,
- pkg=pkg, settings=settings)
+ pkg=pkg, pretend=opts.pretend,
+ settings=settings)
retval = fetcher.execute()
self.returncode = retval
self.wait()
self._erase()
self.out.write(self._format_msg(msg) + self._term_codes['newline'])
+ self.out.flush()
self._displayed = False
if was_displayed:
# In some cases the above print statements don't flush stdout, so
# it needs to be flushed before allowing a child process to use it
# so that output always shows in the correct order.
+ stdout_filenos = (sys.stdout.fileno(), sys.stderr.fileno())
for fd in fd_pipes.itervalues():
- if fd == sys.stdout.fileno():
+ if fd in stdout_filenos:
sys.stdout.flush()
- if fd == sys.stderr.fileno():
sys.stderr.flush()
+ break
# The default policy for the sesandbox domain only allows entry (via exec)
# from shells and from binaries that belong to portage (the number of entry