public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: pym/portage/elog/
@ 2011-07-11 18:00 Zac Medico
  0 siblings, 0 replies; 17+ messages in thread
From: Zac Medico @ 2011-07-11 18:00 UTC (permalink / raw
  To: gentoo-commits

commit:     d20cc273f670d4141ba94a860bfbafa80e223dad
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 11 18:00:33 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Jul 11 18:00:33 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d20cc273

elog/mod_save: ensure parent logdir exists

---
 pym/portage/elog/mod_save.py         |    9 ++++++++-
 pym/portage/elog/mod_save_summary.py |    9 ++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/pym/portage/elog/mod_save.py b/pym/portage/elog/mod_save.py
index 40ba267..36654b3 100644
--- a/pym/portage/elog/mod_save.py
+++ b/pym/portage/elog/mod_save.py
@@ -8,8 +8,9 @@ from portage import os
 from portage import _encodings
 from portage import _unicode_decode
 from portage import _unicode_encode
+from portage.data import portage_gid
 from portage.package.ebuild.prepare_build_dirs import _ensure_log_subdirs
-from portage.util import normalize_path
+from portage.util import ensure_dirs, normalize_path
 
 def process(mysettings, key, logentries, fulltext):
 
@@ -18,6 +19,12 @@ def process(mysettings, key, logentries, fulltext):
 	else:
 		logdir = os.path.join(os.sep, "var", "log", "portage")
 
+	if not os.path.isdir(logdir):
+		# Only initialize group/mode if the directory doesn't
+		# exist, so that we don't override permissions if they
+		# were previously set by the administrator.
+		ensure_dirs(logdir, gid=portage_gid, mode=0o2770)
+
 	cat = mysettings['CATEGORY']
 	pf = mysettings['PF']
 

diff --git a/pym/portage/elog/mod_save_summary.py b/pym/portage/elog/mod_save_summary.py
index 67bd76e..f090dea 100644
--- a/pym/portage/elog/mod_save_summary.py
+++ b/pym/portage/elog/mod_save_summary.py
@@ -8,9 +8,10 @@ from portage import os
 from portage import _encodings
 from portage import _unicode_decode
 from portage import _unicode_encode
+from portage.data import portage_gid
 from portage.localization import _
 from portage.package.ebuild.prepare_build_dirs import _ensure_log_subdirs
-from portage.util import apply_permissions, normalize_path
+from portage.util import apply_permissions, ensure_dirs, normalize_path
 
 def process(mysettings, key, logentries, fulltext):
 	if mysettings.get("PORT_LOGDIR"):
@@ -18,6 +19,12 @@ def process(mysettings, key, logentries, fulltext):
 	else:
 		logdir = os.path.join(os.sep, "var", "log", "portage")
 
+	if not os.path.isdir(logdir):
+		# Only initialize group/mode if the directory doesn't
+		# exist, so that we don't override permissions if they
+		# were previously set by the administrator.
+		ensure_dirs(logdir, gid=portage_gid, mode=0o2770)
+
 	elogdir = os.path.join(logdir, "elog")
 	_ensure_log_subdirs(logdir, elogdir)
 



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/elog/
@ 2011-09-03 23:00 Zac Medico
  0 siblings, 0 replies; 17+ messages in thread
From: Zac Medico @ 2011-09-03 23:00 UTC (permalink / raw
  To: gentoo-commits

commit:     48e99671013b1dec046059724b01324d8aa1086c
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Sep  3 22:59:38 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Sep  3 22:59:38 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=48e99671

elog/mod_save: join /var/log with EPREFIX

---
 pym/portage/elog/mod_save.py         |    2 +-
 pym/portage/elog/mod_save_summary.py |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/pym/portage/elog/mod_save.py b/pym/portage/elog/mod_save.py
index 091bbf8..bfccd77 100644
--- a/pym/portage/elog/mod_save.py
+++ b/pym/portage/elog/mod_save.py
@@ -18,7 +18,7 @@ def process(mysettings, key, logentries, fulltext):
 	if mysettings.get("PORT_LOGDIR"):
 		logdir = normalize_path(mysettings["PORT_LOGDIR"])
 	else:
-		logdir = os.path.join(os.sep, "var", "log", "portage")
+		logdir = os.path.join(mysettings["EPREFIX"], "var", "log", "portage")
 
 	if not os.path.isdir(logdir):
 		# Only initialize group/mode if the directory doesn't

diff --git a/pym/portage/elog/mod_save_summary.py b/pym/portage/elog/mod_save_summary.py
index ab71724..3196d43 100644
--- a/pym/portage/elog/mod_save_summary.py
+++ b/pym/portage/elog/mod_save_summary.py
@@ -18,7 +18,7 @@ def process(mysettings, key, logentries, fulltext):
 	if mysettings.get("PORT_LOGDIR"):
 		logdir = normalize_path(mysettings["PORT_LOGDIR"])
 	else:
-		logdir = os.path.join(os.sep, "var", "log", "portage")
+		logdir = os.path.join(mysettings["EPREFIX"], "var", "log", "portage")
 
 	if not os.path.isdir(logdir):
 		# Only initialize group/mode if the directory doesn't



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/elog/
@ 2011-09-03 23:11 Zac Medico
  0 siblings, 0 replies; 17+ messages in thread
From: Zac Medico @ 2011-09-03 23:11 UTC (permalink / raw
  To: gentoo-commits

commit:     a732c34814c2bbcc25b97a29b0cb73ae625a6bb0
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Sep  3 23:11:10 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Sep  3 23:11:10 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a732c348

elog/mod_echo: send all msg types to stdout

---
 pym/portage/elog/mod_echo.py |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/pym/portage/elog/mod_echo.py b/pym/portage/elog/mod_echo.py
index 5de25bf..59117be 100644
--- a/pym/portage/elog/mod_echo.py
+++ b/pym/portage/elog/mod_echo.py
@@ -18,6 +18,19 @@ def process(mysettings, key, logentries, fulltext):
 	_items.append((mysettings["ROOT"], key, logentries))
 
 def finalize():
+	# For consistency, send all message types to stdout.
+	sys.stdout.flush()
+	sys.stderr.flush()
+	stderr = sys.stderr
+	try:
+		sys.stderr = sys.stdout
+		_finalize()
+	finally:
+		sys.stderr = stderr
+		sys.stdout.flush()
+		sys.stderr.flush()
+
+def _finalize():
 	global _items
 	printer = EOutput()
 	for root, key, logentries in _items:



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/elog/
@ 2011-09-03 23:17 Zac Medico
  0 siblings, 0 replies; 17+ messages in thread
From: Zac Medico @ 2011-09-03 23:17 UTC (permalink / raw
  To: gentoo-commits

commit:     b449f5df29848097b12e161df5d50ceed03a0517
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Sep  3 23:17:04 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Sep  3 23:17:04 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b449f5df

elog/mod_save: join /var/log with os.sep too

---
 pym/portage/elog/mod_save.py         |    3 ++-
 pym/portage/elog/mod_save_summary.py |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/pym/portage/elog/mod_save.py b/pym/portage/elog/mod_save.py
index bfccd77..c69f4a3 100644
--- a/pym/portage/elog/mod_save.py
+++ b/pym/portage/elog/mod_save.py
@@ -18,7 +18,8 @@ def process(mysettings, key, logentries, fulltext):
 	if mysettings.get("PORT_LOGDIR"):
 		logdir = normalize_path(mysettings["PORT_LOGDIR"])
 	else:
-		logdir = os.path.join(mysettings["EPREFIX"], "var", "log", "portage")
+		logdir = os.path.join(os.sep, mysettings["EPREFIX"].lstrip(os.sep),
+			"var", "log", "portage")
 
 	if not os.path.isdir(logdir):
 		# Only initialize group/mode if the directory doesn't

diff --git a/pym/portage/elog/mod_save_summary.py b/pym/portage/elog/mod_save_summary.py
index 3196d43..347f66e 100644
--- a/pym/portage/elog/mod_save_summary.py
+++ b/pym/portage/elog/mod_save_summary.py
@@ -18,7 +18,8 @@ def process(mysettings, key, logentries, fulltext):
 	if mysettings.get("PORT_LOGDIR"):
 		logdir = normalize_path(mysettings["PORT_LOGDIR"])
 	else:
-		logdir = os.path.join(mysettings["EPREFIX"], "var", "log", "portage")
+		logdir = os.path.join(os.sep, mysettings["EPREFIX"].lstrip(os.sep),
+			"var", "log", "portage")
 
 	if not os.path.isdir(logdir):
 		# Only initialize group/mode if the directory doesn't



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/elog/
@ 2011-10-06  1:22 Zac Medico
  0 siblings, 0 replies; 17+ messages in thread
From: Zac Medico @ 2011-10-06  1:22 UTC (permalink / raw
  To: gentoo-commits

commit:     ca7bef7821876791a26a5f9df6938f4c77fe571f
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Oct  6 01:22:35 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Oct  6 01:22:35 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ca7bef78

elog/collect_ebuild_messages: strip trailing \n

This fixes unintended extra blank lines since commit
1c8ff00a26b0e2e3627e9c552374f71235ee6c39.

---
 pym/portage/elog/messages.py |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/pym/portage/elog/messages.py b/pym/portage/elog/messages.py
index 50e0ab1..f5232d3 100644
--- a/pym/portage/elog/messages.py
+++ b/pym/portage/elog/messages.py
@@ -47,6 +47,7 @@ def collect_ebuild_messages(path):
 			encoding=_encodings['fs'], errors='strict'),
 			mode='r', encoding=_encodings['repo.content'], errors='replace')
 		for l in f:
+			l = l.rstrip('\n')
 			if not l:
 				continue
 			try:



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/elog/
@ 2011-10-10 14:22 Zac Medico
  0 siblings, 0 replies; 17+ messages in thread
From: Zac Medico @ 2011-10-10 14:22 UTC (permalink / raw
  To: gentoo-commits

commit:     8a119ea94ecc6668797e3a1358465ef3733f3a3e
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 10 14:21:54 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Oct 10 14:21:54 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=8a119ea9

elog_process: add newlines for bug #386627

This fixes omission of newlines in saved messages since commit
ca7bef7821876791a26a5f9df6938f4c77fe571f.

---
 pym/portage/elog/__init__.py |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/pym/portage/elog/__init__.py b/pym/portage/elog/__init__.py
index 1a8309d..eeb6e71 100644
--- a/pym/portage/elog/__init__.py
+++ b/pym/portage/elog/__init__.py
@@ -52,11 +52,11 @@ def _combine_logentries(logentries):
 		for msgtype, msgcontent in logentries[phase]:
 			if previous_type != msgtype:
 				previous_type = msgtype
-				rValue.append("%s: %s\n" % (msgtype, phase))
+				rValue.append("%s: %s" % (msgtype, phase))
 			for line in msgcontent:
-				rValue.append(line)
-			rValue.append("\n")
-	return "".join(rValue)
+				rValue.append(line.rstrip("\n"))
+			rValue.append("")
+	return "\n".join(rValue)
 
 _elog_mod_imports = {}
 def _load_mod(name):



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/elog/
@ 2011-10-10 14:37 Zac Medico
  0 siblings, 0 replies; 17+ messages in thread
From: Zac Medico @ 2011-10-10 14:37 UTC (permalink / raw
  To: gentoo-commits

commit:     1a00bb2a24bed702ab0703540130d19d669191d0
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 10 14:36:39 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Oct 10 14:36:39 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1a00bb2a

mod_syslog: add newlines for bug #386627

This fixes omission of newlines in syslog messages since commit
ca7bef7821876791a26a5f9df6938f4c77fe571f.

---
 pym/portage/elog/mod_syslog.py |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/pym/portage/elog/mod_syslog.py b/pym/portage/elog/mod_syslog.py
index d71dab4..79b11a6 100644
--- a/pym/portage/elog/mod_syslog.py
+++ b/pym/portage/elog/mod_syslog.py
@@ -1,5 +1,5 @@
 # elog/mod_syslog.py - elog dispatch module
-# Copyright 2006-2007 Gentoo Foundation
+# Copyright 2006-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 import sys
@@ -21,12 +21,11 @@ def process(mysettings, key, logentries, fulltext):
 		if not phase in logentries:
 			continue
 		for msgtype,msgcontent in logentries[phase]:
-			msgtext = "".join(msgcontent)
-			for line in msgtext.splitlines():
+			for line in msgcontent:
 				line = "%s: %s: %s" % (key, phase, line)
-				if sys.hexversion < 0x3000000 and isinstance(msgtext, unicode):
+				if sys.hexversion < 0x3000000 and isinstance(line, unicode):
 					# Avoid TypeError from syslog.syslog()
 					line = line.encode(_encodings['content'], 
 						'backslashreplace')
-				syslog.syslog(_pri[msgtype], line)
+				syslog.syslog(_pri[msgtype], line.rstrip("\n"))
 	syslog.closelog()



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/elog/
@ 2011-10-11 16:56 Zac Medico
  0 siblings, 0 replies; 17+ messages in thread
From: Zac Medico @ 2011-10-11 16:56 UTC (permalink / raw
  To: gentoo-commits

commit:     12cb62465b130c21080281d78f7bfac077c17dfb
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 11 16:56:43 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Oct 11 16:56:43 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=12cb6246

elog_process: fix ridicoulus newlines bug #386771

This fixes a regression since commit 8a119ea94ecc6668797e3a1358465ef3733f3a3e
which added a newline after each character. This boosts efficiency since we no
longer convert a strings to lists of characters.

---
 pym/portage/elog/__init__.py |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/pym/portage/elog/__init__.py b/pym/portage/elog/__init__.py
index eeb6e71..33dac17 100644
--- a/pym/portage/elog/__init__.py
+++ b/pym/portage/elog/__init__.py
@@ -1,7 +1,11 @@
 # elog/__init__.py - elog core functions
-# Copyright 2006-2009 Gentoo Foundation
+# Copyright 2006-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
+import sys
+if sys.hexversion >= 0x3000000:
+	basestring = str
+
 import portage
 portage.proxy.lazyimport.lazyimport(globals(),
 	'portage.util:writemsg',
@@ -53,9 +57,13 @@ def _combine_logentries(logentries):
 			if previous_type != msgtype:
 				previous_type = msgtype
 				rValue.append("%s: %s" % (msgtype, phase))
-			for line in msgcontent:
-				rValue.append(line.rstrip("\n"))
-			rValue.append("")
+			if isinstance(msgcontent, basestring):
+				rValue.append(msgcontent.rstrip("\n"))
+			else:
+				for line in msgcontent:
+					rValue.append(line.rstrip("\n"))
+	if rValue:
+		rValue.append("")
 	return "\n".join(rValue)
 
 _elog_mod_imports = {}



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/elog/
@ 2011-11-18  2:55 Zac Medico
  0 siblings, 0 replies; 17+ messages in thread
From: Zac Medico @ 2011-11-18  2:55 UTC (permalink / raw
  To: gentoo-commits

commit:     87cd5dba474f758e291b87a39366bd7edd748bf7
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 18 02:55:28 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Nov 18 02:55:28 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=87cd5dba

collect_ebuild_messages: validate msg type

This will handle invalid message types like the one that triggers the
KeyError in dblink._elog_process for bug #390833. It will also output
the content of the line in order to help diagnose the source of
corruption.

---
 pym/portage/elog/messages.py |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/pym/portage/elog/messages.py b/pym/portage/elog/messages.py
index f5232d3..98d6206 100644
--- a/pym/portage/elog/messages.py
+++ b/pym/portage/elog/messages.py
@@ -18,6 +18,14 @@ from portage import _unicode_decode
 import io
 import sys
 
+_log_levels = frozenset([
+	"ERROR",
+	"INFO",
+	"LOG",
+	"QA",
+	"WARN",
+])
+
 def collect_ebuild_messages(path):
 	""" Collect elog messages generated by the bash logging function stored 
 		at 'path'.
@@ -52,9 +60,11 @@ def collect_ebuild_messages(path):
 				continue
 			try:
 				msgtype, msg = l.split(" ", 1)
+				if msgtype not in _log_levels:
+					raise ValueError(msgtype)
 			except ValueError:
 				writemsg(_("!!! malformed entry in "
-					"log file: '%s'\n") % filename, noiselevel=-1)
+					"log file: '%s': %s\n") % (filename, l), noiselevel=-1)
 				continue
 
 			if lastmsgtype is None:



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/elog/
@ 2011-11-18  5:33 Zac Medico
  0 siblings, 0 replies; 17+ messages in thread
From: Zac Medico @ 2011-11-18  5:33 UTC (permalink / raw
  To: gentoo-commits

commit:     6917ef66abadfc957da41d69a7dd63289bf4014f
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 18 05:33:37 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Nov 18 05:33:37 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=6917ef66

_make_msgfunction: convert to class

---
 pym/portage/elog/messages.py |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/pym/portage/elog/messages.py b/pym/portage/elog/messages.py
index 98d6206..ba2ed46 100644
--- a/pym/portage/elog/messages.py
+++ b/pym/portage/elog/messages.py
@@ -172,13 +172,17 @@ _functions = { "einfo": ("INFO", "GOOD"),
 		"eerror": ("ERROR", "BAD"),
 }
 
-def _make_msgfunction(level, color):
-	def _elog(msg, phase="other", key=None, out=None):
-		""" Display and log a message assigned to the given key/cpv 
-		    (or unassigned if no key is given).
+class _make_msgfunction(object):
+	__slots__ = ('_color', '_level')
+	def __init__(self, level, color):
+		self._level = level
+		self._color = color
+	def __call__(self, msg, phase="other", key=None, out=None):
+		"""
+		Display and log a message assigned to the given key/cpv.
 		""" 
-		_elog_base(level, msg,  phase=phase, key=key, color=color, out=out)
-	return _elog
+		_elog_base(self._level, msg,  phase=phase,
+			key=key, color=self._color, out=out)
 
 for f in _functions:
 	setattr(sys.modules[__name__], f, _make_msgfunction(_functions[f][0], _functions[f][1]))



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/elog/
@ 2011-11-18 18:20 Zac Medico
  0 siblings, 0 replies; 17+ messages in thread
From: Zac Medico @ 2011-11-18 18:20 UTC (permalink / raw
  To: gentoo-commits

commit:     935694debc955a18a6a93af923f3f98caacf3f74
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 18 18:20:21 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Nov 18 18:20:21 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=935694de

collect_ebuild_messages: handle \r, bug #390833

---
 pym/portage/elog/messages.py |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/pym/portage/elog/messages.py b/pym/portage/elog/messages.py
index ba2ed46..a4897d8 100644
--- a/pym/portage/elog/messages.py
+++ b/pym/portage/elog/messages.py
@@ -54,8 +54,9 @@ def collect_ebuild_messages(path):
 		f = io.open(_unicode_encode(filename,
 			encoding=_encodings['fs'], errors='strict'),
 			mode='r', encoding=_encodings['repo.content'], errors='replace')
-		for l in f:
-			l = l.rstrip('\n')
+		# Use split('\n') since normal line iteration or readlines() will
+		# split on \r characters as shown in bug #390833.
+		for l in f.read().split('\n'):
 			if not l:
 				continue
 			try:



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/elog/
@ 2011-11-25 19:35 Zac Medico
  0 siblings, 0 replies; 17+ messages in thread
From: Zac Medico @ 2011-11-25 19:35 UTC (permalink / raw
  To: gentoo-commits

commit:     9e6364fe049b5cc59e8cb54f683bbd11d45a7504
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 25 19:35:32 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Nov 25 19:35:32 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9e6364fe

elog/mod_syslog: fix 1 char msgs, bug #390965

---
 pym/portage/elog/mod_syslog.py |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/pym/portage/elog/mod_syslog.py b/pym/portage/elog/mod_syslog.py
index 6455841..c8bf441 100644
--- a/pym/portage/elog/mod_syslog.py
+++ b/pym/portage/elog/mod_syslog.py
@@ -7,6 +7,9 @@ import syslog
 from portage.const import EBUILD_PHASES
 from portage import _encodings
 
+if sys.hexversion >= 0x3000000:
+	basestring = str
+
 _pri = {
 	"INFO"   : syslog.LOG_INFO, 
 	"WARN"   : syslog.LOG_WARNING, 
@@ -21,6 +24,8 @@ def process(mysettings, key, logentries, fulltext):
 		if not phase in logentries:
 			continue
 		for msgtype,msgcontent in logentries[phase]:
+			if isinstance(msgcontent, basestring):
+				msgcontent = [msgcontent]
 			for line in msgcontent:
 				line = "%s: %s: %s" % (key, phase, line)
 				if sys.hexversion < 0x3000000 and not isinstance(line, bytes):



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/elog/
@ 2012-11-13 17:49 Zac Medico
  0 siblings, 0 replies; 17+ messages in thread
From: Zac Medico @ 2012-11-13 17:49 UTC (permalink / raw
  To: gentoo-commits

commit:     ca49f2541f6c9a70459a389e86437681881d260d
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 13 17:48:55 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Nov 13 17:48:55 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ca49f254

elog/mod_save: wrap IOException for bug #441948

---
 pym/portage/elog/mod_save.py |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/pym/portage/elog/mod_save.py b/pym/portage/elog/mod_save.py
index c69f4a3..7b1cd46 100644
--- a/pym/portage/elog/mod_save.py
+++ b/pym/portage/elog/mod_save.py
@@ -1,7 +1,8 @@
 # elog/mod_save.py - elog dispatch module
-# Copyright 2006-2011 Gentoo Foundation
+# Copyright 2006-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
+import errno
 import io
 import time
 import portage
@@ -47,11 +48,22 @@ def process(mysettings, key, logentries, fulltext):
 		elogfilename = os.path.join(log_subdir, cat + ':' + elogfilename)
 	_ensure_log_subdirs(logdir, log_subdir)
 
-	elogfile = io.open(_unicode_encode(elogfilename,
-		encoding=_encodings['fs'], errors='strict'),
-		mode='w', encoding=_encodings['content'], errors='backslashreplace')
-	elogfile.write(_unicode_decode(fulltext))
-	elogfile.close()
+	try:
+		with io.open(_unicode_encode(elogfilename,
+			encoding=_encodings['fs'], errors='strict'), mode='w',
+			encoding=_encodings['content'],
+			errors='backslashreplace') as elogfile:
+			elogfile.write(_unicode_decode(fulltext))
+	except IOError as e:
+		func_call = "open('%s', 'w')" % elogfilename
+		if e.errno == errno.EACCES:
+			raise portage.exception.PermissionDenied(func_call)
+		elif e.errno == errno.EPERM:
+			raise portage.exception.OperationNotPermitted(func_call)
+		elif e.errno == errno.EROFS:
+			raise portage.exception.ReadOnlyFileSystem(func_call)
+		else:
+			raise
 
 	# Copy group permission bits from parent directory.
 	elogdir_st = os.stat(log_subdir)


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/elog/
@ 2012-11-13 17:57 Zac Medico
  0 siblings, 0 replies; 17+ messages in thread
From: Zac Medico @ 2012-11-13 17:57 UTC (permalink / raw
  To: gentoo-commits

commit:     0f51adcadce66e5ecdac4ce42148d725c6b7227d
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 13 17:57:26 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Nov 13 17:57:26 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=0f51adca

elog/mod_save_summary: wrap IOError, bug #441948

---
 pym/portage/elog/mod_save_summary.py |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/pym/portage/elog/mod_save_summary.py b/pym/portage/elog/mod_save_summary.py
index 347f66e..3ad1dd3 100644
--- a/pym/portage/elog/mod_save_summary.py
+++ b/pym/portage/elog/mod_save_summary.py
@@ -1,7 +1,8 @@
 # elog/mod_save_summary.py - elog dispatch module
-# Copyright 2006-2011 Gentoo Foundation
+# Copyright 2006-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
+import errno
 import io
 import time
 import portage
@@ -37,9 +38,21 @@ def process(mysettings, key, logentries, fulltext):
 
 	# TODO: Locking
 	elogfilename = elogdir+"/summary.log"
-	elogfile = io.open(_unicode_encode(elogfilename,
-		encoding=_encodings['fs'], errors='strict'),
-		mode='a', encoding=_encodings['content'], errors='backslashreplace')
+	try:
+		elogfile = io.open(_unicode_encode(elogfilename,
+			encoding=_encodings['fs'], errors='strict'),
+			mode='a', encoding=_encodings['content'],
+			errors='backslashreplace')
+	except IOError as e:
+		func_call = "open('%s', 'a')" % elogfilename
+		if e.errno == errno.EACCES:
+			raise portage.exception.PermissionDenied(func_call)
+		elif e.errno == errno.EPERM:
+			raise portage.exception.OperationNotPermitted(func_call)
+		elif e.errno == errno.EROFS:
+			raise portage.exception.ReadOnlyFileSystem(func_call)
+		else:
+			raise
 
 	# Copy group permission bits from parent directory.
 	elogdir_st = os.stat(elogdir)


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/elog/
@ 2015-12-28  0:54 Zac Medico
  0 siblings, 0 replies; 17+ messages in thread
From: Zac Medico @ 2015-12-28  0:54 UTC (permalink / raw
  To: gentoo-commits

commit:     022f0ba6fb75aba80d801772b4e622d44db2d668
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 28 00:50:12 2015 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Dec 28 00:50:24 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=022f0ba6

elog/mod_save: fix CATEGORY KeyError (bug 569942)

Fixes: 39d81c514c33 ("[...]config.__getitem__(): Partially drop backward compatibility for nonexistent keys.")
X-Gentoo-Bug: 569942
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=569942

 pym/portage/elog/mod_save.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/pym/portage/elog/mod_save.py b/pym/portage/elog/mod_save.py
index 7b1cd46..829ec6c 100644
--- a/pym/portage/elog/mod_save.py
+++ b/pym/portage/elog/mod_save.py
@@ -33,8 +33,7 @@ def process(mysettings, key, logentries, fulltext):
 			uid = portage_uid
 		ensure_dirs(logdir, uid=uid, gid=portage_gid, mode=0o2770)
 
-	cat = mysettings['CATEGORY']
-	pf = mysettings['PF']
+	cat, pf = portage.catsplit(key)
 
 	elogfilename = pf + ":" + _unicode_decode(
 		time.strftime("%Y%m%d-%H%M%S", time.gmtime(time.time())),


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/elog/
@ 2017-08-17  7:30 Michał Górny
  0 siblings, 0 replies; 17+ messages in thread
From: Michał Górny @ 2017-08-17  7:30 UTC (permalink / raw
  To: gentoo-commits

commit:     a62ebb4a2f759da85aaab7a214c3f8c4ac7f4d64
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 16 10:08:32 2017 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Aug 17 07:30:08 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=a62ebb4a

elog mod_echo: Print log path if PORT_LOGDIR is used

Include the path to the log file if PORT_LOGDIR is being used
(and therefore the log is going to be preserved past the build). This is
useful when elog messages contain QA warnings or other errors that
require reporting a bug. In such case, having a path to the log is
handy.

After this commit, the mod_echo output becomes:

 * Messages for package dev-foo/bar-1:
 * Log file: /var/log/portage/dev-foo:bar-1:20170816-100533.log

 * test

Reviewed-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/portage/elog/mod_echo.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/pym/portage/elog/mod_echo.py b/pym/portage/elog/mod_echo.py
index f9cc53788..bb34a1e44 100644
--- a/pym/portage/elog/mod_echo.py
+++ b/pym/portage/elog/mod_echo.py
@@ -1,5 +1,5 @@
 # elog/mod_echo.py - elog dispatch module
-# Copyright 2007-2014 Gentoo Foundation
+# Copyright 2007-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 from __future__ import print_function
@@ -16,7 +16,12 @@ if sys.hexversion >= 0x3000000:
 _items = []
 def process(mysettings, key, logentries, fulltext):
 	global _items
-	_items.append((mysettings["ROOT"], key, logentries))
+	logfile = None
+	# output logfile explicitly only if it isn't in tempdir, otherwise
+	# it will be removed anyway
+	if "PORT_LOGDIR" in mysettings:
+		logfile = mysettings["PORTAGE_LOG_FILE"]
+	_items.append((mysettings["ROOT"], key, logentries, logfile))
 
 def finalize():
 	# For consistency, send all message types to stdout.
@@ -34,7 +39,7 @@ def finalize():
 def _finalize():
 	global _items
 	printer = EOutput()
-	for root, key, logentries in _items:
+	for root, key, logentries, logfile in _items:
 		print()
 		if root == "/":
 			printer.einfo(_("Messages for package %s:") %
@@ -42,6 +47,8 @@ def _finalize():
 		else:
 			printer.einfo(_("Messages for package %(pkg)s merged to %(root)s:") %
 				{"pkg": colorize("INFORM", key), "root": root})
+		if logfile is not None:
+			printer.einfo(_("Log file: %s") % colorize("INFORM", logfile))
 		print()
 		for phase in EBUILD_PHASES:
 			if phase not in logentries:


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/elog/
@ 2017-10-09 19:08 Zac Medico
  0 siblings, 0 replies; 17+ messages in thread
From: Zac Medico @ 2017-10-09 19:08 UTC (permalink / raw
  To: gentoo-commits

commit:     fc69af818c5208ef153ca0c41ac8784afba7e30e
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Oct  9 18:57:02 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Oct  9 19:05:38 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=fc69af81

elog mod_echo: fix PORTAGE_LOG_FILE KeyError (bug 633842)

In some cases such as Scheduler._calc_resume_list, the
elog_process function can be called when mysettings is
not in a suitable state to use the PORTAGE_LOG_FILE
variable.

Fixes: a62ebb4a2f75 ("elog mod_echo: Print log path if PORT_LOGDIR is used")
Bug: https://bugs.gentoo.org/show_bug.cgi?id=633842

 pym/portage/elog/mod_echo.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pym/portage/elog/mod_echo.py b/pym/portage/elog/mod_echo.py
index bb34a1e44..fb86547a4 100644
--- a/pym/portage/elog/mod_echo.py
+++ b/pym/portage/elog/mod_echo.py
@@ -19,7 +19,9 @@ def process(mysettings, key, logentries, fulltext):
 	logfile = None
 	# output logfile explicitly only if it isn't in tempdir, otherwise
 	# it will be removed anyway
-	if "PORT_LOGDIR" in mysettings:
+	if (key == mysettings.mycpv and
+		"PORT_LOGDIR" in mysettings and
+		"PORTAGE_LOG_FILE" in mysettings):
 		logfile = mysettings["PORTAGE_LOG_FILE"]
 	_items.append((mysettings["ROOT"], key, logentries, logfile))
 


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2017-10-09 19:08 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-09 19:08 [gentoo-commits] proj/portage:master commit in: pym/portage/elog/ Zac Medico
  -- strict thread matches above, loose matches on Subject: below --
2017-08-17  7:30 Michał Górny
2015-12-28  0:54 Zac Medico
2012-11-13 17:57 Zac Medico
2012-11-13 17:49 Zac Medico
2011-11-25 19:35 Zac Medico
2011-11-18 18:20 Zac Medico
2011-11-18  5:33 Zac Medico
2011-11-18  2:55 Zac Medico
2011-10-11 16:56 Zac Medico
2011-10-10 14:37 Zac Medico
2011-10-10 14:22 Zac Medico
2011-10-06  1:22 Zac Medico
2011-09-03 23:17 Zac Medico
2011-09-03 23:11 Zac Medico
2011-09-03 23:00 Zac Medico
2011-07-11 18:00 Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox