* [gentoo-commits] portage r11685 - in main/trunk/pym: _emerge portage
@ 2008-10-12 23:17 Zac Medico (zmedico)
0 siblings, 0 replies; only message in thread
From: Zac Medico (zmedico) @ 2008-10-12 23:17 UTC (permalink / raw
To: gentoo-commits
Author: zmedico
Date: 2008-10-12 23:17:56 +0000 (Sun, 12 Oct 2008)
New Revision: 11685
Modified:
main/trunk/pym/_emerge/__init__.py
main/trunk/pym/portage/__init__.py
Log:
Bug #241118 - Re-enable pkg_nofetch for emerge --pretend --fetch, but direct
output to stderr. This requires PORTAGE_BUILDDIR locking for bug #239560 and
also for elog message storage.
Modified: main/trunk/pym/_emerge/__init__.py
===================================================================
--- main/trunk/pym/_emerge/__init__.py 2008-10-12 21:01:12 UTC (rev 11684)
+++ main/trunk/pym/_emerge/__init__.py 2008-10-12 23:17:56 UTC (rev 11685)
@@ -1588,6 +1588,13 @@
__slots__ = ("fetch_all", "pkg", "settings")
def execute(self):
+ # To spawn pkg_nofetch requires PORTAGE_BUILDDIR for
+ # ensuring sane $PWD (bug #239560) and storing elog
+ # messages.
+ build_dir = EbuildBuildDir(pkg=self.pkg, settings=self.settings)
+ build_dir.lock()
+ build_dir.clean()
+ portage.prepare_build_dirs(self.pkg.root, self.settings, 0)
portdb = self.pkg.root_config.trees["porttree"].dbapi
ebuild_path = portdb.findname(self.pkg.cpv)
debug = self.settings.get("PORTAGE_DEBUG") == "1"
@@ -1596,6 +1603,10 @@
self.settings["ROOT"], self.settings, debug=debug,
listonly=1, fetchonly=1, fetchall=self.fetch_all,
mydbapi=portdb, tree="porttree")
+
+ portage.elog.elog_process(self.pkg.cpv, self.settings)
+ build_dir.clean()
+ build_dir.unlock()
return retval
class AsynchronousTask(SlotObject):
@@ -2248,7 +2259,7 @@
settings = self.config_pool.allocate()
self._build_dir = EbuildBuildDir(pkg=self.pkg, settings=settings)
self._build_dir.lock()
- self._clean_builddir()
+ self._build_dir.clean()
portage.prepare_build_dirs(self.pkg.root, self._build_dir.settings, 0)
if self.logfile is None:
self.logfile = settings.get("PORTAGE_LOG_FILE")
@@ -2291,18 +2302,6 @@
portage._create_pty_or_pipe(copy_term_size=stdout_pipe)
return (master_fd, slave_fd)
- def _clean_builddir(self):
- """Uses shutil.rmtree() rather than spawning a 'clean' phase. Disabled
- by keepwork or keeptemp in FEATURES."""
- features = self._build_dir.settings.features
- if not ("keepwork" in features or "keeptemp" in features):
- try:
- shutil.rmtree(self._build_dir.settings["PORTAGE_BUILDDIR"])
- except EnvironmentError, e:
- if e.errno != errno.ENOENT:
- raise
- del e
-
def _set_returncode(self, wait_retval):
SpawnProcess._set_returncode(self, wait_retval)
# Collect elog messages that might have been
@@ -2322,7 +2321,7 @@
portage.elog.elog_process(self.pkg.cpv, self._build_dir.settings)
features = self._build_dir.settings.features
if self.fetchonly or self.returncode == os.EX_OK:
- self._clean_builddir()
+ self._build_dir.clean()
self._build_dir.unlock()
self.config_pool.deallocate(self._build_dir.settings)
self._build_dir = None
@@ -2377,6 +2376,19 @@
if catdir_lock is not None:
portage.locks.unlockdir(catdir_lock)
+ def clean(self):
+ """Uses shutil.rmtree() rather than spawning a 'clean' phase. Disabled
+ by keepwork or keeptemp in FEATURES."""
+ settings = self.settings
+ features = settings.features
+ if not ("keepwork" in features or "keeptemp" in features):
+ try:
+ shutil.rmtree(settings["PORTAGE_BUILDDIR"])
+ except EnvironmentError, e:
+ if e.errno != errno.ENOENT:
+ raise
+ del e
+
def unlock(self):
if self._lock_obj is None:
return
Modified: main/trunk/pym/portage/__init__.py
===================================================================
--- main/trunk/pym/portage/__init__.py 2008-10-12 21:01:12 UTC (rev 11684)
+++ main/trunk/pym/portage/__init__.py 2008-10-12 23:17:56 UTC (rev 11685)
@@ -4060,29 +4060,43 @@
if listonly:
writemsg_stdout("\n", noiselevel=-1)
- elif fetched != 2:
+ if fetched != 2:
if restrict_fetch:
- print "\n!!!", mysettings["CATEGORY"] + "/" + \
- mysettings["PF"], "has fetch restriction turned on."
- print "!!! This probably means that this " + \
- "ebuild's files must be downloaded"
- print "!!! manually. See the comments in" + \
- " the ebuild for more information.\n"
+ msg = ("\n!!! %s/%s" + \
+ " has fetch restriction turned on.\n" + \
+ "!!! This probably means that this " + \
+ "ebuild's files must be downloaded\n" + \
+ "!!! manually. See the comments in" + \
+ " the ebuild for more information.\n\n") % \
+ (mysettings["CATEGORY"], mysettings["PF"])
+ portage.util.writemsg_level(msg,
+ level=logging.ERROR, noiselevel=-1)
if not parallel_fetchonly:
# To spawn pkg_nofetch requires PORTAGE_BUILDDIR for
# ensuring sane $PWD (bug #239560) and storing elog
# messages. Therefore, calling code needs to ensure that
# PORTAGE_BUILDDIR is already clean and locked here.
+
+ # All the pkg_nofetch goes to stderr since it's considered
+ # to be an error message.
+ fd_pipes = {
+ 0 : sys.stdin.fileno(),
+ 1 : sys.stderr.fileno(),
+ 2 : sys.stderr.fileno(),
+ }
+
ebuild_phase = mysettings.get("EBUILD_PHASE")
try:
mysettings["EBUILD_PHASE"] = "nofetch"
spawn(_shell_quote(EBUILD_SH_BINARY) + \
- " nofetch", mysettings)
+ " nofetch", mysettings, fd_pipes=fd_pipes)
finally:
if ebuild_phase is None:
mysettings.pop("EBUILD_PHASE", None)
else:
mysettings["EBUILD_PHASE"] = ebuild_phase
+ elif listonly:
+ continue
elif not filedict[myfile]:
writemsg("Warning: No mirrors available for file" + \
" '%s'\n" % (myfile), noiselevel=-1)
@@ -5436,8 +5450,7 @@
# Build directory creation isn't required for any of these.
have_build_dirs = False
- if not (mydo in ("digest", "help", "manifest") or \
- (mydo == "fetch" and listonly)):
+ if not mydo in ("digest", "help", "manifest"):
mystatus = prepare_build_dirs(myroot, mysettings, cleanup)
if mystatus:
return mystatus
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-10-12 23:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-12 23:17 [gentoo-commits] portage r11685 - in main/trunk/pym: _emerge portage Zac Medico (zmedico)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox