from portage.package.ebuild.digestgen import digestgen
from portage.package.ebuild.prepare_build_dirs import prepare_build_dirs
+from _emerge.BinpkgFetcher import BinpkgFetcher
from _emerge.BinpkgPrefetcher import BinpkgPrefetcher
+from _emerge.BinpkgVerifier import BinpkgVerifier
from _emerge.Blocker import Blocker
from _emerge.BlockerDB import BlockerDB
from _emerge.clear_caches import clear_caches
os.execv(mynewargv[0], mynewargv)
def _run_pkg_pretend(self):
+ """
+ Since pkg_pretend output may be important, this method sends all
+ output directly to stdout (regardless of options like --quiet or
+ --jobs).
+ """
failures = 0
+ # Use a local PollScheduler instance here, since we don't
+ # want tasks here to trigger the usual Scheduler callbacks
+ # that handle job scheduling and status display.
+ sched_iface = PollScheduler().sched_iface
+
for x in self._mergelist:
if not isinstance(x, Package):
continue
tmpdir_orig = settings["PORTAGE_TMPDIR"]
settings["PORTAGE_TMPDIR"] = tmpdir
- if x.built:
- tree = "bintree"
- bintree = root_config.trees["bintree"].dbapi.bintree
- if bintree.isremote(x.cpv):
- fetcher = BinpkgPrefetcher(background=self._background,
- logfile=self.settings.get("PORTAGE_LOG_FILE"), pkg=x, scheduler=self._sched_iface)
- fetcher.start()
- fetcher.wait()
-
- tbz2_file = bintree.getname(x.cpv)
- infloc = os.path.join(tmpdir, x.category, x.pf, "build-info")
- os.makedirs(infloc)
- portage.xpak.tbz2(tbz2_file).unpackinfo(infloc)
- ebuild_path = os.path.join(infloc, x.pf + ".ebuild")
- settings.configdict["pkg"]["EMERGE_FROM"] = "binary"
- settings.configdict["pkg"]["MERGE_TYPE"] = "binary"
-
- else:
- tree = "porttree"
- portdb = root_config.trees["porttree"].dbapi
- ebuild_path = portdb.findname(x.cpv)
- if ebuild_path is None:
- raise AssertionError("ebuild not found for '%s'" % x.cpv)
- settings.configdict["pkg"]["EMERGE_FROM"] = "ebuild"
- if self._build_opts.buildpkgonly:
- settings.configdict["pkg"]["MERGE_TYPE"] = "buildonly"
- else:
- settings.configdict["pkg"]["MERGE_TYPE"] = "source"
-
- portage.package.ebuild.doebuild.doebuild_environment(ebuild_path,
- "pretend", settings=settings,
- db=self.trees[settings["ROOT"]][tree].dbapi)
- prepare_build_dirs(root_config.root, settings, cleanup=0)
-
- vardb = root_config.trees['vartree'].dbapi
- settings["REPLACING_VERSIONS"] = " ".join(
- set(portage.versions.cpv_getversion(match) \
- for match in vardb.match(x.slot_atom) + \
- vardb.match('='+x.cpv)))
- pretend_phase = EbuildPhase(background=self._background,
- phase="pretend", scheduler=self._sched_iface,
- settings=settings)
-
- pretend_phase.start()
- ret = pretend_phase.wait()
+ try:
+ if x.built:
+ tree = "bintree"
+ bintree = root_config.trees["bintree"].dbapi.bintree
+
+ # Display fetch on stdout, so that it's always clear what
+ # is consuming time here.
+ if bintree.isremote(x.cpv):
+ fetcher = BinpkgFetcher(pkg=x,
+ scheduler=sched_iface)
+ fetcher.start()
+ if fetcher.wait() != os.EX_OK:
+ failures += 1
+ continue
+
+ verifier = BinpkgVerifier(pkg=x,
+ scheduler=sched_iface)
+ verifier.start()
+ if verifier.wait() != os.EX_OK:
+ failures += 1
+ continue
- portage.elog.elog_process(x.cpv, settings)
+ tbz2_file = bintree.getname(x.cpv)
+ infloc = os.path.join(tmpdir, x.category, x.pf, "build-info")
+ os.makedirs(infloc)
+ portage.xpak.tbz2(tbz2_file).unpackinfo(infloc)
+ ebuild_path = os.path.join(infloc, x.pf + ".ebuild")
+ settings.configdict["pkg"]["EMERGE_FROM"] = "binary"
+ settings.configdict["pkg"]["MERGE_TYPE"] = "binary"
- if ret == os.EX_OK:
+ else:
+ tree = "porttree"
+ portdb = root_config.trees["porttree"].dbapi
+ ebuild_path = portdb.findname(x.cpv)
+ if ebuild_path is None:
+ raise AssertionError("ebuild not found for '%s'" % x.cpv)
+ settings.configdict["pkg"]["EMERGE_FROM"] = "ebuild"
+ if self._build_opts.buildpkgonly:
+ settings.configdict["pkg"]["MERGE_TYPE"] = "buildonly"
+ else:
+ settings.configdict["pkg"]["MERGE_TYPE"] = "source"
+
+ portage.package.ebuild.doebuild.doebuild_environment(ebuild_path,
+ "pretend", settings=settings,
+ db=self.trees[settings["ROOT"]][tree].dbapi)
+ prepare_build_dirs(root_config.root, settings, cleanup=0)
+
+ vardb = root_config.trees['vartree'].dbapi
+ settings["REPLACING_VERSIONS"] = " ".join(
+ set(portage.versions.cpv_getversion(match) \
+ for match in vardb.match(x.slot_atom) + \
+ vardb.match('='+x.cpv)))
+ pretend_phase = EbuildPhase(
+ phase="pretend", scheduler=sched_iface,
+ settings=settings)
+
+ pretend_phase.start()
+ ret = pretend_phase.wait()
+ if ret != os.EX_OK:
+ failures += 1
+ portage.elog.elog_process(x.cpv, settings)
+ finally:
shutil.rmtree(tmpdir)
- settings["PORTAGE_TMPDIR"] = tmpdir_orig
+ settings["PORTAGE_TMPDIR"] = tmpdir_orig
- if ret != os.EX_OK:
- failures += 1
if failures:
return 1
return os.EX_OK