summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-03-25 02:29:06 -0700
committerZac Medico <zmedico@gentoo.org>2011-03-25 02:29:06 -0700
commit2fd76b639d44f3ff3624ed8dbe96d214a42875e5 (patch)
treeb90f8401dc45cfc9c4934210dcd431ae8c3fcf45
parentf3c4a464cc38788a4946de5331c2618c183fccac (diff)
downloadportage-2fd76b639d44f3ff3624ed8dbe96d214a42875e5.tar.gz
portage-2fd76b639d44f3ff3624ed8dbe96d214a42875e5.tar.bz2
portage-2fd76b639d44f3ff3624ed8dbe96d214a42875e5.zip
MergeProcess: separate unmerge output from merge
The unmerge output has been mixed together with the merge output since commit 7535cabdf2fab76fc55df83643157613dfd66be9 because dblink._scheduler was set to None. Now it's fixed to produce separate logs like it used to.
-rw-r--r--pym/portage/dbapi/_MergeProcess.py4
-rw-r--r--pym/portage/dbapi/vartree.py69
-rw-r--r--pym/portage/package/ebuild/_config/special_env_vars.py2
3 files changed, 46 insertions, 29 deletions
diff --git a/pym/portage/dbapi/_MergeProcess.py b/pym/portage/dbapi/_MergeProcess.py
index 8f61a2fde..5caeef372 100644
--- a/pym/portage/dbapi/_MergeProcess.py
+++ b/pym/portage/dbapi/_MergeProcess.py
@@ -92,6 +92,10 @@ class MergeProcess(SpawnProcess):
# already be opened by the parent process, so we set the
# "subprocess" value for use in conditional logging code
# involving PORTAGE_LOG_FILE.
+ if self.settings.get("PORTAGE_BACKGROUND") == "1":
+ # unmerge phases have separate logs
+ self.settings["PORTAGE_BACKGROUND_UNMERGE"] = "1"
+ self.settings.backup_changes("PORTAGE_BACKGROUND_UNMERGE")
self.settings["PORTAGE_BACKGROUND"] = "subprocess"
self.settings.backup_changes("PORTAGE_BACKGROUND")
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index a58521a36..8203de85e 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -56,6 +56,7 @@ from portage import _unicode_encode
from _emerge.AsynchronousLock import AsynchronousLock
from _emerge.EbuildBuildDir import EbuildBuildDir
+from _emerge.EbuildPhase import EbuildPhase
from _emerge.PollScheduler import PollScheduler
from _emerge.MiscFunctionsProcess import MiscFunctionsProcess
@@ -1487,6 +1488,18 @@ class dblink(object):
" method is now unused.",
DeprecationWarning, stacklevel=2)
+ background = False
+ if self._scheduler is None:
+ # We create a scheduler instance and use it to
+ # log unmerge output separately from merge output.
+ self._scheduler = PollScheduler().sched_iface
+ if self.settings.get("PORTAGE_BACKGROUND_UNMERGE") == "1":
+ self.settings["PORTAGE_BACKGROUND"] = "1"
+ self.settings.backup_changes("PORTAGE_BACKGROUND")
+ background = True
+ else:
+ self.settings.pop("PORTAGE_BACKGROUND", None)
+
self.vartree.dbapi._bump_mtime(self.mycpv)
showMessage = self._display_merge
if self.vartree.dbapi._categories is not None:
@@ -1549,18 +1562,17 @@ class dblink(object):
try:
if myebuildpath:
builddir_lock = EbuildBuildDir(
- scheduler=(scheduler or PollScheduler().sched_iface),
+ scheduler=scheduler,
settings=self.settings)
builddir_lock.lock()
prepare_build_dirs(settings=self.settings, cleanup=True)
log_path = self.settings.get("PORTAGE_LOG_FILE")
-
- if scheduler is None:
- retval = _spawn_phase('prerm', self.settings)
- else:
- retval = scheduler.dblinkEbuildPhase(
- self, self.vartree.dbapi, myebuildpath, ebuild_phase)
+ phase = EbuildPhase(background=background,
+ phase=ebuild_phase, scheduler=scheduler,
+ settings=self.settings)
+ phase.start()
+ retval = phase.wait()
# XXX: Decide how to handle failures here.
if retval != os.EX_OK:
@@ -1582,11 +1594,11 @@ class dblink(object):
if myebuildpath:
ebuild_phase = "postrm"
- if scheduler is None:
- retval = _spawn_phase(ebuild_phase, self.settings)
- else:
- retval = scheduler.dblinkEbuildPhase(
- self, self.vartree.dbapi, myebuildpath, ebuild_phase)
+ phase = EbuildPhase(background=background,
+ phase=ebuild_phase, scheduler=scheduler,
+ settings=self.settings)
+ phase.start()
+ retval = phase.wait()
# XXX: Decide how to handle failures here.
if retval != os.EX_OK:
@@ -1678,12 +1690,11 @@ class dblink(object):
self.pkg + ".ebuild")
doebuild_environment(myebuildpath, "cleanrm",
settings=self.settings, db=self.vartree.dbapi)
- if scheduler is None:
- _spawn_phase("cleanrm", self.settings)
- else:
- scheduler.dblinkEbuildPhase(
- self, self.vartree.dbapi,
- myebuildpath, "cleanrm")
+ phase = EbuildPhase(background=background,
+ phase="cleanrm", scheduler=scheduler,
+ settings=self.settings)
+ phase.start()
+ retval = phase.wait()
finally:
if builddir_lock is not None:
builddir_lock.unlock()
@@ -1726,11 +1737,18 @@ class dblink(object):
def _display_merge(self, msg, level=0, noiselevel=0):
if not self._verbose and noiselevel >= 0 and level < logging.WARN:
return
- if self._scheduler is not None:
- self._scheduler.dblinkDisplayMerge(self, msg,
- level=level, noiselevel=noiselevel)
- return
- writemsg_level(msg, level=level, noiselevel=noiselevel)
+ if self._scheduler is None:
+ writemsg_level(msg, level=level, noiselevel=noiselevel)
+ else:
+ log_path = self.settings.get("PORTAGE_LOG_FILE")
+ background = self.settings.get("PORTAGE_BACKGROUND") == "1"
+
+ if log_path is None:
+ if not (background and level < logging.WARN):
+ writemsg_level(msg, level=level, noiselevel=noiselevel)
+ else:
+ self._scheduler.output(msg,
+ background=background, log_path=log_path)
def _unmerge_pkgfiles(self, pkgfiles, others_in_slot):
"""
@@ -1748,7 +1766,6 @@ class dblink(object):
os = _os_merge
perf_md5 = perform_md5
showMessage = self._display_merge
- scheduler = self._scheduler
if not pkgfiles:
showMessage(_("No package files given... Grabbing a set.\n"))
@@ -1849,10 +1866,6 @@ class dblink(object):
for i, objkey in enumerate(mykeys):
- if scheduler is not None and \
- 0 == i % self._file_merge_yield_interval:
- scheduler.scheduleYield()
-
obj = normalize_path(objkey)
if os is _os_merge:
try:
diff --git a/pym/portage/package/ebuild/_config/special_env_vars.py b/pym/portage/package/ebuild/_config/special_env_vars.py
index 561de9cf4..6a196cfca 100644
--- a/pym/portage/package/ebuild/_config/special_env_vars.py
+++ b/pym/portage/package/ebuild/_config/special_env_vars.py
@@ -137,7 +137,7 @@ environ_filter += [
"FETCHCOMMAND_HTTP", "FETCHCOMMAND_HTTPS",
"FETCHCOMMAND_RSYNC", "FETCHCOMMAND_SFTP",
"GENTOO_MIRRORS", "NOCONFMEM", "O",
- "PORTAGE_BACKGROUND",
+ "PORTAGE_BACKGROUND", "PORTAGE_BACKGROUND_UNMERGE",
"PORTAGE_BINHOST_CHUNKSIZE", "PORTAGE_BUILDIR_LOCKED", "PORTAGE_CALLER",
"PORTAGE_ELOG_CLASSES",
"PORTAGE_ELOG_MAILFROM", "PORTAGE_ELOG_MAILSUBJECT",