public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2018-03-04  2:38 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2018-03-04  2:38 UTC (permalink / raw
  To: gentoo-commits

commit:     ad72389ed8067d740dd0e3f975a33f0c1cbfd8b5
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Sun Mar  4 02:25:34 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Mar  4 02:37:09 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=ad72389e

movefile: Fix preservation of security.capability xattr

Call _apply_stat() before copying extended attributes, because
_apply_stat() calls os.chown() which results in deleting
security.capability extended attribute.

Bug: https://bugs.gentoo.org/649418

 pym/portage/util/movefile.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index 37c809eb5..5477a669f 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2013 Gentoo Foundation
+# Copyright 2010-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 from __future__ import absolute_import, unicode_literals
@@ -272,6 +272,7 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 				errors='strict')
 			try: # For safety copy then move it over.
 				_copyfile(src_bytes, dest_tmp_bytes)
+				_apply_stat(sstat, dest_tmp_bytes)
 				if xattr_enabled:
 					try:
 						_copyxattr(src_bytes, dest_tmp_bytes,
@@ -286,7 +287,6 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 						for line in msg:
 							writemsg("!!! %s\n" % (line,), noiselevel=-1)
 						raise
-				_apply_stat(sstat, dest_tmp_bytes)
 				_rename(dest_tmp_bytes, dest_bytes)
 				_os.unlink(src_bytes)
 			except SystemExit as e:


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2018-04-02 17:11 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2018-04-02 17:11 UTC (permalink / raw
  To: gentoo-commits

commit:     6d822cbc2a7a68e39583991b3f69ff76b032d585
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 19 07:37:38 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Apr  2 16:53:23 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=6d822cbc

Add ExponentialBackoff and RandomExponentialBackoff

This will be useful as parameters for retry decorators.

 pym/portage/util/backoff.py | 53 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/pym/portage/util/backoff.py b/pym/portage/util/backoff.py
new file mode 100644
index 000000000..ee39007ef
--- /dev/null
+++ b/pym/portage/util/backoff.py
@@ -0,0 +1,53 @@
+# Copyright 2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+__all__ = (
+	'ExponentialBackoff',
+	'RandomExponentialBackoff',
+)
+
+import random
+import sys
+
+
+class ExponentialBackoff(object):
+	"""
+	An object that when called with number of previous tries, calculates
+	an exponential delay for the next try.
+	"""
+	def __init__(self, multiplier=1, base=2, limit=sys.maxsize):
+		"""
+		@param multiplier: constant multiplier
+		@type multiplier: int or float
+		@param base: maximum number of tries
+		@type base: int or float
+		@param limit: maximum number of seconds to delay
+		@type limit: int or float
+		"""
+		self._multiplier = multiplier
+		self._base = base
+		self._limit = limit
+
+	def __call__(self, tries):
+		"""
+		Given a number of previous tries, calculate the amount of time
+		to delay the next try.
+
+		@param tries: number of previous tries
+		@type tries: int
+		@return: amount of time to delay the next try
+		@rtype: int
+		"""
+		try:
+			return min(self._limit, self._multiplier * (self._base ** tries))
+		except OverflowError:
+			return self._limit
+
+
+class RandomExponentialBackoff(ExponentialBackoff):
+	"""
+	Equivalent to ExponentialBackoff, with an extra multiplier that uses
+	a random distribution between 0 and 1.
+	"""
+	def __call__(self, tries):
+		return random.random() * super(RandomExponentialBackoff, self).__call__(tries)


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2018-03-28  6:52 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2018-03-28  6:52 UTC (permalink / raw
  To: gentoo-commits

commit:     8f9cff73321b3ee5957357448819b505932e0e5c
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun May 22 06:40:13 2016 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Mar 28 06:28:17 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=8f9cff73

{,PKG_}INSTALL_MASK: Support exclusions (bug 651214)

Allow INSTALL_MASK patterns to start with '-' to indicate that
a specific match is to be excluded from being masked. In this case,
the last matching pattern determines whether the file is actually
filtered out or kept.

Bug: https://bugs.gentoo.org/651214

 pym/portage/util/install_mask.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/pym/portage/util/install_mask.py b/pym/portage/util/install_mask.py
index 506e63c1f..1667d883a 100644
--- a/pym/portage/util/install_mask.py
+++ b/pym/portage/util/install_mask.py
@@ -35,19 +35,21 @@ class InstallMask(object):
 		"""
 		ret = False
 		for pattern in self._install_mask:
+			# if pattern starts with -, possibly exclude this path
+			is_inclusive = not pattern.startswith('-')
+			if not is_inclusive:
+				pattern = pattern[1:]
 			# absolute path pattern
 			if pattern.startswith('/'):
 				# match either exact path or one of parent dirs
 				# the latter is done via matching pattern/*
 				if (fnmatch.fnmatch(path, pattern[1:])
 						or fnmatch.fnmatch(path, pattern[1:] + '/*')):
-					ret = True
-					break
+					ret = is_inclusive
 			# filename
 			else:
 				if fnmatch.fnmatch(os.path.basename(path), pattern):
-					ret = True
-					break
+					ret = is_inclusive
 		return ret
 
 


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2017-08-21 16:50 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2017-08-21 16:50 UTC (permalink / raw
  To: gentoo-commits

commit:     78273a404ea6244eab4180dff2bd1847609ac09a
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 21 16:10:57 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Aug 21 16:16:05 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=78273a40

digraph: search for relevant priority in descending order

It's more likely that a higher valued priority will not be
ignored, therefore search in descending order.

 pym/portage/util/digraph.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pym/portage/util/digraph.py b/pym/portage/util/digraph.py
index bf20d5d4e..d279b7867 100644
--- a/pym/portage/util/digraph.py
+++ b/pym/portage/util/digraph.py
@@ -170,7 +170,7 @@ class digraph(object):
 		children = []
 		if hasattr(ignore_priority, '__call__'):
 			for child, priorities in self.nodes[node][0].items():
-				for priority in priorities:
+				for priority in reversed(priorities):
 					if not ignore_priority(priority):
 						children.append(child)
 						break
@@ -187,7 +187,7 @@ class digraph(object):
 		parents = []
 		if hasattr(ignore_priority, '__call__'):
 			for parent, priorities in self.nodes[node][1].items():
-				for priority in priorities:
+				for priority in reversed(priorities):
 					if not ignore_priority(priority):
 						parents.append(parent)
 						break
@@ -212,7 +212,7 @@ class digraph(object):
 			for node in self.order:
 				is_leaf_node = True
 				for child, priorities in self.nodes[node][0].items():
-					for priority in priorities:
+					for priority in reversed(priorities):
 						if not ignore_priority(priority):
 							is_leaf_node = False
 							break
@@ -246,7 +246,7 @@ class digraph(object):
 			for node in self.order:
 				is_root_node = True
 				for parent, priorities in self.nodes[node][1].items():
-					for priority in priorities:
+					for priority in reversed(priorities):
 						if not ignore_priority(priority):
 							is_root_node = False
 							break


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2017-08-21 15:59 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2017-08-21 15:59 UTC (permalink / raw
  To: gentoo-commits

commit:     6098513ec399bd6949d6ae852be9ee83dcb24a2f
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 20 21:30:22 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Aug 21 15:58:42 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=6098513e

digraph.add: sort priorities with bisect.insort

Reported-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
Reviewed-by: Manuel Rüger <mrueg <AT> gentoo.org>

 pym/portage/util/digraph.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pym/portage/util/digraph.py b/pym/portage/util/digraph.py
index ba0e81c07..bf20d5d4e 100644
--- a/pym/portage/util/digraph.py
+++ b/pym/portage/util/digraph.py
@@ -5,6 +5,7 @@ from __future__ import unicode_literals
 
 __all__ = ['digraph']
 
+import bisect
 from collections import deque
 import sys
 
@@ -46,8 +47,7 @@ class digraph(object):
 			self.nodes[parent][0][node] = priorities
 
 		if not priorities or priorities[-1] is not priority:
-			priorities.append(priority)
-			priorities.sort()
+			bisect.insort(priorities, priority)
 
 	def discard(self, node):
 		"""


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2017-02-23 16:33 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2017-02-23 16:33 UTC (permalink / raw
  To: gentoo-commits

commit:     f4b0714010f1237280fd48dcb65989679917d20a
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 23 10:50:36 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Feb 23 15:59:43 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=f4b07140

grabfile_package: support -* in profile "packages" files (bug 610670)

Support -* in order to make it easier to create profiles for
minimal systems (especially those built entirely from binary
packages).

X-Gentoo-Bug: 610670
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=610670
Acked-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/portage/util/__init__.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index c2c871ffb..45710ba72 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -478,13 +478,20 @@ def grabfile_package(myfilename, compatlevel=0, recursive=0,
 		eapi = read_corresponding_eapi_file(
 			myfilename, default=eapi_default)
 	mybasename = os.path.basename(myfilename)
+	is_packages_file = mybasename == 'packages'
 	atoms = []
 	for pkg, source_file in pkgs:
 		pkg_orig = pkg
 		# for packages and package.mask files
 		if pkg[:1] == "-":
+			if is_packages_file and pkg == '-*':
+				if remember_source_file:
+					atoms.append((pkg, source_file))
+				else:
+					atoms.append(pkg)
+				continue
 			pkg = pkg[1:]
-		if pkg[:1] == '*' and mybasename == 'packages':
+		if pkg[:1] == '*' and is_packages_file:
 			pkg = pkg[1:]
 		try:
 			pkg = Atom(pkg, allow_wildcard=allow_wildcard,


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2017-02-21 17:44 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2017-02-21 17:44 UTC (permalink / raw
  To: gentoo-commits

commit:     de0a26200b05b67cbeb1b8449acde18381fbb64b
Author:     Manuel Rüger <mrueg <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 20 15:08:44 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Feb 21 17:18:06 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=de0a2620

compression_probe: support zstandard (zstd) decompression (bug 609462)

X-Gentoo-Bug: 609462
X-Gentoo-Bug-Url: https://bugs.gentoo.org/show_bug.cgi?id=609462

 pym/portage/util/compression_probe.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/pym/portage/util/compression_probe.py b/pym/portage/util/compression_probe.py
index 74f74b163..754621016 100644
--- a/pym/portage/util/compression_probe.py
+++ b/pym/portage/util/compression_probe.py
@@ -18,6 +18,7 @@ _decompressors = {
 	"lzip": "lzip -d",
 	"lzop": "lzop -d",
 	"xz": "xz -d",
+	"zstd": "zstd -d",
 }
 
 _compression_re = re.compile(b'^(' +
@@ -26,7 +27,8 @@ _compression_re = re.compile(b'^(' +
 	b'(?P<lz4>(?:\x04\x22\x4d\x18|\x02\x21\x4c\x18))|' +
 	b'(?P<lzip>LZIP)|' +
 	b'(?P<lzop>\x89LZO\x00\x0d\x0a\x1a\x0a)|' +
-	b'(?P<xz>\xfd\x37\x7a\x58\x5a\x00))')
+	b'(?P<xz>\xfd\x37\x7a\x58\x5a\x00)|' +
+	b'(?P<zstd>([\x22-\x28]\xb5\x2f\xfd)))')
 
 _max_compression_re_len = 9
 
@@ -41,6 +43,7 @@ def compression_probe(f):
 		lzip
 		lzop
 		xz
+		zstd
 
 	@param f: a file path, or file-like object
 	@type f: str or file


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2017-01-22 18:46 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2017-01-22 18:46 UTC (permalink / raw
  To: gentoo-commits

commit:     b3401efea5820c525c57a1b52c38404054593e0a
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 22 18:24:07 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Jan 22 18:24:47 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=b3401efe

env-update: skip os.access call when ldconfig is None (bug 606832)

Since commit 1bc49bead14ddd31c94921fe9c3d1972f0737056, env_update
would raise the following exception with crossdev configurations
when ${CHOST}-ldconfig is not available:

    TypeError: access: can't specify None for path argument

Fixes: 1bc49bead14d ("env-update: call ldconfig if found in EROOT")
X-Gentoo-Bug: 606832
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=606832

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

diff --git a/pym/portage/util/env_update.py b/pym/portage/util/env_update.py
index fde2f66..0321010 100644
--- a/pym/portage/util/env_update.py
+++ b/pym/portage/util/env_update.py
@@ -312,7 +312,9 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env,
 	else:
 		ldconfig = os.path.join(eroot, "sbin", "ldconfig")
 
-	if not (os.access(ldconfig, os.X_OK) and os.path.isfile(ldconfig)):
+	if ldconfig is None:
+		pass
+	elif not (os.access(ldconfig, os.X_OK) and os.path.isfile(ldconfig)):
 		ldconfig = None
 
 	# Only run ldconfig as needed


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2017-01-07 23:07 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2017-01-07 23:07 UTC (permalink / raw
  To: gentoo-commits

commit:     1bc49bead14ddd31c94921fe9c3d1972f0737056
Author:     Benda Xu <heroxbd <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 20 00:12:35 2016 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Jan  7 22:47:32 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=1bc49bea

env-update: call ldconfig if found in EROOT

prefix-standalone has a glibc installed by portage with ldconfig
under EROOT/sbin.  It should be called during env-update.

For prefix-rpath, host glibc is used and env-update should not
care about ldconfig.  In this case, no ldconfig is in EROOT/sbin
and ldconfig is skipped.

X-Gentoo-Bug: 532100
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=532100

 pym/portage/util/env_update.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/pym/portage/util/env_update.py b/pym/portage/util/env_update.py
index c0a93a8..fde2f66 100644
--- a/pym/portage/util/env_update.py
+++ b/pym/portage/util/env_update.py
@@ -306,13 +306,17 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env,
 		if not libdir_contents_changed:
 			makelinks = False
 
-	ldconfig = "/sbin/ldconfig"
 	if "CHOST" in settings and "CBUILD" in settings and \
 		settings["CHOST"] != settings["CBUILD"]:
 		ldconfig = find_binary("%s-ldconfig" % settings["CHOST"])
+	else:
+		ldconfig = os.path.join(eroot, "sbin", "ldconfig")
+
+	if not (os.access(ldconfig, os.X_OK) and os.path.isfile(ldconfig)):
+		ldconfig = None
 
 	# Only run ldconfig as needed
-	if makelinks and ldconfig and not eprefix:
+	if makelinks and ldconfig:
 		# ldconfig has very different behaviour between FreeBSD and Linux
 		if ostype == "Linux" or ostype.lower().endswith("gnu"):
 			# We can't update links if we haven't cleaned other versions first, as


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2016-09-18 22:26 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2016-09-18 22:26 UTC (permalink / raw
  To: gentoo-commits

commit:     a000c492b9f12a43b75c2613323e29a472732259
Author:     Mikhail Pukhlikov <cynede <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 16 10:47:22 2016 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Sep 18 22:13:18 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=a000c492

writeable_check: add additional checks to mountinfo parsing function

 pym/portage/util/writeable_check.py | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/pym/portage/util/writeable_check.py b/pym/portage/util/writeable_check.py
index b698ea1..26fe199 100644
--- a/pym/portage/util/writeable_check.py
+++ b/pym/portage/util/writeable_check.py
@@ -57,14 +57,22 @@ def linux_ro_checker(dir_list):
 				# there can be a variable number of fields
 				# to the left of the ' - ', after the attr's, so split it there
 				mount = line.split(' - ', 1)
-				_dir, attr1 = mount[0].split()[4:6]
+				try:
+					_dir, attr1 = mount[0].split()[4:6]
+				except ValueError:
+					# If it raises ValueError we can simply ignore the line.
+					continue
 				# check for situation with invalid entries for /home and /root in /proc/self/mountinfo
 				# root path is missing sometimes on WSL
 				# for example: 16 1 0:16 / /root rw,noatime - lxfs  rw
-				try:
-					attr2 = mount[1].split()[2]
-				except IndexError:
-					attr2 = mount[1].split()[1]
+				if len(mount) > 1:
+					try:
+						attr2 = mount[1].split()[2]
+					except IndexError:
+						try:
+							attr2 = mount[1].split()[1]
+						except IndexError:
+							attr2 = mount[1]
 				if attr1.startswith('ro') or attr2.startswith('ro'):
 					ro_filesystems.add(_dir)
 


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2016-09-18 22:26 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2016-09-18 22:26 UTC (permalink / raw
  To: gentoo-commits

commit:     9b31cd9f2823d742ce3431e480561244f00f1744
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 18 22:10:54 2016 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Sep 18 22:13:45 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=9b31cd9f

writeable_check: warn about invalid mountinfo lines (bug 594284)

X-Gentoo-bug: 594284
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=594284

 pym/portage/util/writeable_check.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/pym/portage/util/writeable_check.py b/pym/portage/util/writeable_check.py
index 26fe199..e5b14c0 100644
--- a/pym/portage/util/writeable_check.py
+++ b/pym/portage/util/writeable_check.py
@@ -44,6 +44,7 @@ def linux_ro_checker(dir_list):
 	read-only, may be empty.
 	"""
 	ro_filesystems = set()
+	invalids = []
 
 	try:
 		with io.open("/proc/self/mountinfo", mode='r',
@@ -61,6 +62,7 @@ def linux_ro_checker(dir_list):
 					_dir, attr1 = mount[0].split()[4:6]
 				except ValueError:
 					# If it raises ValueError we can simply ignore the line.
+					invalids.append(line)
 					continue
 				# check for situation with invalid entries for /home and /root in /proc/self/mountinfo
 				# root path is missing sometimes on WSL
@@ -72,7 +74,11 @@ def linux_ro_checker(dir_list):
 						try:
 							attr2 = mount[1].split()[1]
 						except IndexError:
-							attr2 = mount[1]
+							invalids.append(line)
+							continue
+				else:
+					invalids.append(line)
+					continue
 				if attr1.startswith('ro') or attr2.startswith('ro'):
 					ro_filesystems.add(_dir)
 
@@ -83,6 +89,10 @@ def linux_ro_checker(dir_list):
 			level=logging.WARNING, noiselevel=-1)
 		return []
 
+	for line in invalids:
+		writemsg_level(_("!!! /proc/self/mountinfo contains unrecognized line: %s\n")
+			% line.rstrip(), level=logging.WARNING, noiselevel=-1)
+
 	ro_devs = {}
 	for x in ro_filesystems:
 		try:


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2016-09-18 22:26 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2016-09-18 22:26 UTC (permalink / raw
  To: gentoo-commits

commit:     2593cb2c5d56e373c6c6e4f4663f25241e0e79b7
Author:     Mikhail Pukhlikov <cynede <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 16 08:59:53 2016 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Sep 18 22:13:04 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=2593cb2c

writeable_check: handle invalid entries in /proc/self/mountinfo

That fixes Gentoo installation won WLS
Source: https://github.com/Microsoft/BashOnWindows/issues/992#issuecomment-244460439
Can reproduce on two machines

 pym/portage/util/writeable_check.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/pym/portage/util/writeable_check.py b/pym/portage/util/writeable_check.py
index ac6c039..b698ea1 100644
--- a/pym/portage/util/writeable_check.py
+++ b/pym/portage/util/writeable_check.py
@@ -58,7 +58,13 @@ def linux_ro_checker(dir_list):
 				# to the left of the ' - ', after the attr's, so split it there
 				mount = line.split(' - ', 1)
 				_dir, attr1 = mount[0].split()[4:6]
-				attr2 = mount[1].split()[2]
+				# check for situation with invalid entries for /home and /root in /proc/self/mountinfo
+				# root path is missing sometimes on WSL
+				# for example: 16 1 0:16 / /root rw,noatime - lxfs  rw
+				try:
+					attr2 = mount[1].split()[2]
+				except IndexError:
+					attr2 = mount[1].split()[1]
 				if attr1.startswith('ro') or attr2.startswith('ro'):
 					ro_filesystems.add(_dir)
 


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2016-09-14 23:14 Brian Dolbec
  0 siblings, 0 replies; 134+ messages in thread
From: Brian Dolbec @ 2016-09-14 23:14 UTC (permalink / raw
  To: gentoo-commits

commit:     3f8f3263a316159359d4137d77c7be2c80fc9d57
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed May 25 12:48:32 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Sep 14 21:53:47 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=3f8f3263

pym/portage/util/locale.py: fix decoding for python2 plus some locales

When using python2 with some locales, like turkish, chr() is passed values not in
range(128) which cannot be decoded as ASCII, thus throwing a UnicodeDecodeError
exception.  We use _unicode_decode() from portage.util to address this.

Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>

 pym/portage/util/locale.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pym/portage/util/locale.py b/pym/portage/util/locale.py
index 2a15ea1..093eb86 100644
--- a/pym/portage/util/locale.py
+++ b/pym/portage/util/locale.py
@@ -15,7 +15,7 @@ import textwrap
 import traceback
 
 import portage
-from portage.util import writemsg_level
+from portage.util import _unicode_decode, writemsg_level
 from portage.util._ctypes import find_library, LoadLibrary
 
 
@@ -62,7 +62,7 @@ def _check_locale(silent):
 			"as LC_CTYPE in make.conf.")
 		msg = [l for l in textwrap.wrap(msg, 70)]
 		msg.append("")
-		chars = lambda l: ''.join(chr(x) for x in l)
+		chars = lambda l: ''.join(_unicode_decode(chr(x)) for x in l)
 		if uc != ruc:
 			msg.extend([
 				"  %s -> %s" % (chars(lc), chars(ruc)),


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2015-11-22 20:53 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2015-11-22 20:53 UTC (permalink / raw
  To: gentoo-commits

commit:     59f2371c58ea6942ad441d8238600c21cda1c014
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 22 20:51:10 2015 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Nov 22 20:51:27 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=59f2371c

portage.util.locale: fix python2.7 setlocale ValueError (bug 566372)

The locale.setlocale function raises ValueError with python2.7 if it
is given a unicode argument.

X-Gentoo-Bug: 566372
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=566372

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

diff --git a/pym/portage/util/locale.py b/pym/portage/util/locale.py
index 05b3979..2a15ea1 100644
--- a/pym/portage/util/locale.py
+++ b/pym/portage/util/locale.py
@@ -14,6 +14,7 @@ import os
 import textwrap
 import traceback
 
+import portage
 from portage.util import writemsg_level
 from portage.util._ctypes import find_library, LoadLibrary
 
@@ -102,7 +103,8 @@ def check_locale(silent=False, env=None):
 		try:
 			if env is not None:
 				try:
-					locale.setlocale(locale.LC_CTYPE, mylocale)
+					locale.setlocale(locale.LC_CTYPE,
+						portage._native_string(mylocale))
 				except locale.Error:
 					os._exit(2)
 


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2015-11-21 18:12 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2015-11-21 18:12 UTC (permalink / raw
  To: gentoo-commits

commit:     ab7efe823ace977d8b46f324bdcbf44dcb7ca6d9
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 21 18:11:17 2015 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Nov 21 18:11:43 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=ab7efe82

portage.util.locale: enable absolute_import (bug 566372)

Since commit e5ba8d096e56495a9b516cea818d48e104d62bca,
absolute_import is required for python2 compatibility.

Fixes: e5ba8d096e56 ("EAPI 6: Enforce posixish LC_CTYPE")
X-Gentoo-Bug: 566372
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=566372

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

diff --git a/pym/portage/util/locale.py b/pym/portage/util/locale.py
index c3332ea..05b3979 100644
--- a/pym/portage/util/locale.py
+++ b/pym/portage/util/locale.py
@@ -6,7 +6,7 @@ Function to check whether the current used LC_CTYPE handles case
 transformations of ASCII characters in a way compatible with the POSIX
 locale.
 """
-from __future__ import unicode_literals
+from __future__ import absolute_import, unicode_literals
 
 import locale
 import logging
@@ -26,7 +26,6 @@ locale_categories = (
 	'LC_PAPER', 'LC_TELEPHONE',
 )
 
-
 _check_locale_cache = {}
 
 


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2015-11-16  1:29 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2015-11-16  1:29 UTC (permalink / raw
  To: gentoo-commits

commit:     b7a07159e472912170d69d3520b188115b810561
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 16 01:28:55 2015 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Nov 16 01:29:23 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=b7a07159

util/locale: Fix IndentationError in check_locale

Fixes: 90ccd027ee56 ("util/locale: Cache check_locale() results for specific locales")

 pym/portage/util/locale.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pym/portage/util/locale.py b/pym/portage/util/locale.py
index 58ecb2a..c3332ea 100644
--- a/pym/portage/util/locale.py
+++ b/pym/portage/util/locale.py
@@ -96,6 +96,7 @@ def check_locale(silent=False, env=None):
 		try:
 			return _check_locale_cache[mylocale]
 		except KeyError:
+			pass
 
 	pid = os.fork()
 	if pid == 0:


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2015-11-15 22:54 Michał Górny
  0 siblings, 0 replies; 134+ messages in thread
From: Michał Górny @ 2015-11-15 22:54 UTC (permalink / raw
  To: gentoo-commits

commit:     90ccd027ee56f4ff0afaf67825aceea92ce633a5
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 15 22:49:33 2015 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Nov 15 22:49:33 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=90ccd027

util/locale: Cache check_locale() results for specific locales

 pym/portage/util/locale.py | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/pym/portage/util/locale.py b/pym/portage/util/locale.py
index 27a2806..58ecb2a 100644
--- a/pym/portage/util/locale.py
+++ b/pym/portage/util/locale.py
@@ -27,6 +27,9 @@ locale_categories = (
 )
 
 
+_check_locale_cache = {}
+
+
 def _check_locale(silent):
 	"""
 	The inner locale check function.
@@ -82,17 +85,22 @@ def check_locale(silent=False, env=None):
 	can not be executed due to platform limitations.
 	"""
 
+	if env is not None:
+		for v in ("LC_ALL", "LC_CTYPE", "LANG"):
+			if v in env:
+				mylocale = env[v]
+				break
+		else:
+			mylocale = "C"
+
+		try:
+			return _check_locale_cache[mylocale]
+		except KeyError:
+
 	pid = os.fork()
 	if pid == 0:
 		try:
 			if env is not None:
-				for v in ("LC_ALL", "LC_CTYPE", "LANG"):
-					if v in env:
-						mylocale = env[v]
-						break
-				else:
-					mylocale = "C"
-
 				try:
 					locale.setlocale(locale.LC_CTYPE, mylocale)
 				except locale.Error:
@@ -109,11 +117,15 @@ def check_locale(silent=False, env=None):
 
 	pid2, ret = os.waitpid(pid, 0)
 	assert pid == pid2
+	pyret = None
 	if os.WIFEXITED(ret):
 		ret = os.WEXITSTATUS(ret)
 		if ret != 2:
-			return ret == 0
-	return None
+			pyret = ret == 0
+
+	if env is not None:
+		_check_locale_cache[mylocale] = pyret
+	return pyret
 
 
 def split_LC_ALL(env):


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2015-10-06 20:24 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2015-10-06 20:24 UTC (permalink / raw
  To: gentoo-commits

commit:     597987aac1677e132b80ed2404697acf0188af7a
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Oct  6 20:14:54 2015 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Oct  6 20:23:07 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=597987aa

apply_secpass_permissions: avoid accessing portage.data.secpass when possible

This fixes PermissionDenied errors triggered when portage config files
and repos have restricted access permissions.

Fixes: b7baeeec3ab6 ("unpack: use chmod-lite helper for bug 554084")

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

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 2b7ff8d..b739257 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -1241,7 +1241,9 @@ def apply_secpass_permissions(filename, uid=-1, gid=-1, mode=-1, mask=-1,
 
 	all_applied = True
 
-	if portage.data.secpass < 2:
+	# Avoid accessing portage.data.secpass when possible, since
+	# it triggers config loading (undesirable for chmod-lite).
+	if (uid != -1 or gid != -1) and portage.data.secpass < 2:
 
 		if uid != -1 and \
 		uid != stat_cached.st_uid:


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2015-06-05  1:59 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2015-06-05  1:59 UTC (permalink / raw
  To: gentoo-commits

commit:     c363731ecf59f74386001ba56ba0d7a73de7f2f4
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun May 31 20:51:42 2015 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Jun  5 01:30:06 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=c363731e

movefile: enable absolute_import for Python 2 (bug 550886)

Since commit 1032cbf4c218741df1c57767fead2d00cc6321d9, with Python 2,
movefile imports portage.util.xattr instead of xattr. Fix it by
enabling absolute_import.

Fixes: 1032cbf4c218 ("quickpkg: support FEATURES=xattr (bug 550006)")
X-Gentoo-Bug: 550886
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=550886

 pym/portage/util/movefile.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index d00f624..1000569 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -1,7 +1,7 @@
 # Copyright 2010-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-from __future__ import unicode_literals
+from __future__ import absolute_import, unicode_literals
 
 __all__ = ['movefile']
 


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2015-05-04  6:43 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2015-05-04  6:43 UTC (permalink / raw
  To: gentoo-commits

commit:     1375a55bd6f9a35ee1a4b4ec78b84f830cfb41a9
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon May  4 05:55:20 2015 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon May  4 06:41:58 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=1375a55b

varexpand: fix IndexError (bug 548556)

This handles two cases where varexpand incremented the index without
checking bounds.

X-Gentoo-Bug: 548556
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=548556
X-Gentoo-forum-thread: https://forums.gentoo.org/viewtopic-t-1016432.html
Acked-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/portage/util/__init__.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 48cd1b7..c0b509b 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -850,8 +850,20 @@ def varexpand(mystring, mydict=None, error_leader=None):
 					continue
 			elif current == "$":
 				pos += 1
+				if pos == length:
+					# shells handle this like \$
+					newstring.append(current)
+					continue
+
 				if mystring[pos] == "{":
 					pos += 1
+					if pos == length:
+						msg = _varexpand_unexpected_eof_msg
+						if error_leader is not None:
+							msg = error_leader() + msg
+						writemsg(msg + "\n", noiselevel=-1)
+						return ""
+
 					braced = True
 				else:
 					braced = False


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2015-04-11 16:02 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2015-04-11 16:02 UTC (permalink / raw
  To: gentoo-commits

commit:     43e23d69fe2eab78295807afc159715bef74fa19
Author:     Mike Hiretsky <mh <AT> calculate <DOT> ru>
AuthorDate: Fri Apr 10 17:10:27 2015 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Apr 11 15:59:29 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=43e23d69

new_protect_filename: fix _unicode_decode TypeError with symlink (bug 546176)

Since commit 02417188225758b1822d176abd8902a92300a371, new_protect_filename
has had a faulty _unicode_decode call that triggers a TypeError when
handling symlinks.

Fixes: 024171882257 ("CONFIG_PROTECT: protect symlinks, bug #485598")
X-Gentoo-Bug: 546176
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=546176
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
Acked-by: Alexander Berntsen <bernalex <AT> gentoo.org>

 pym/portage/util/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index aeb951e..4b82e71 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -1705,7 +1705,7 @@ def new_protect_filename(mydest, newmd5=None, force=False):
 					if e.errno != errno.ENOENT:
 						raise
 				else:
-					pfile_link = _unicode_decode(
+					pfile_link = _unicode_decode(pfile_link,
 						encoding=_encodings['merge'], errors='replace')
 					if pfile_link == newmd5:
 						return old_pfile


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2015-01-22 17:09 Brian Dolbec
  0 siblings, 0 replies; 134+ messages in thread
From: Brian Dolbec @ 2015-01-22 17:09 UTC (permalink / raw
  To: gentoo-commits

commit:     5808da4e04aabe18b8b14b5fa7ae1311e84f14aa
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 22 16:59:57 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Jan 22 17:08:02 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=5808da4e

portage/util/__init__.py: Fix typo in new_protect_filename()  Bug 537298

Also fix missed rename from _os_merge to os, where os was defined to be _os_merge.

---
 pym/portage/util/__init__.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 61fe787..9d1876f 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -1685,7 +1685,7 @@ def new_protect_filename(mydest, newmd5=None, force=False):
 	old_pfile = normalize_path(os.path.join(real_dirname, last_pfile))
 	if last_pfile and newmd5:
 		try:
-			old_pfile_st = _os_merge.lstat(old_pfile)
+			old_pfile_st = os.lstat(old_pfile)
 		except OSError as e:
 			if e.errno != errno.ENOENT:
 				raise
@@ -1694,7 +1694,7 @@ def new_protect_filename(mydest, newmd5=None, force=False):
 				try:
 					# Read symlink target as bytes, in case the
 					# target path has a bad encoding.
-					pfile_link = _os.readlink(_unicode_encode(old_pfile,
+					pfile_link = os.readlink(_unicode_encode(old_pfile,
 						encoding=_encodings['merge'], errors='strict'))
 				except OSError:
 					if e.errno != errno.ENOENT:


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2015-01-22 17:09 Brian Dolbec
  0 siblings, 0 replies; 134+ messages in thread
From: Brian Dolbec @ 2015-01-22 17:09 UTC (permalink / raw
  To: gentoo-commits

commit:     2ac29b026d84c389089dec8166414e7df1e81827
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 22 17:05:14 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Jan 22 17:08:02 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2ac29b02

portage/util/__init__.py: Fix leading whitespace errors

---
 pym/portage/util/__init__.py | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 9d1876f..b6f5787 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -43,8 +43,8 @@ from portage import _unicode_encode
 from portage import _unicode_decode
 from portage.const import VCS_DIRS
 from portage.exception import InvalidAtom, PortageException, FileNotFound, \
-       IsADirectory, OperationNotPermitted, ParseError, PermissionDenied, \
-	   ReadOnlyFileSystem
+	IsADirectory, OperationNotPermitted, ParseError, PermissionDenied, \
+	ReadOnlyFileSystem
 from portage.localization import _
 from portage.proxy.objectproxy import ObjectProxy
 from portage.cache.mappings import UserDict
@@ -427,7 +427,7 @@ def read_corresponding_eapi_file(filename, default="0"):
 def grabdict_package(myfilename, juststrings=0, recursive=0, allow_wildcard=False, allow_repo=False,
 	verify_eapi=False, eapi=None, eapi_default="0"):
 	""" Does the same thing as grabdict except it validates keys
-	    with isvalidatom()"""
+		with isvalidatom()"""
 
 	if recursive:
 		file_list = _recursive_file_list(myfilename)
@@ -1001,24 +1001,24 @@ def unique_array(s):
 	return u
 
 def unique_everseen(iterable, key=None):
-    """
-    List unique elements, preserving order. Remember all elements ever seen.
-    Taken from itertools documentation.
-    """
-    # unique_everseen('AAAABBBCCDAABBB') --> A B C D
-    # unique_everseen('ABBCcAD', str.lower) --> A B C D
-    seen = set()
-    seen_add = seen.add
-    if key is None:
-        for element in filterfalse(seen.__contains__, iterable):
-            seen_add(element)
-            yield element
-    else:
-        for element in iterable:
-            k = key(element)
-            if k not in seen:
-                seen_add(k)
-                yield element
+	"""
+	List unique elements, preserving order. Remember all elements ever seen.
+	Taken from itertools documentation.
+	"""
+	# unique_everseen('AAAABBBCCDAABBB') --> A B C D
+	# unique_everseen('ABBCcAD', str.lower) --> A B C D
+	seen = set()
+	seen_add = seen.add
+	if key is None:
+		for element in filterfalse(seen.__contains__, iterable):
+			seen_add(element)
+			yield element
+	else:
+		for element in iterable:
+			k = key(element)
+			if k not in seen:
+				seen_add(k)
+				yield element
 
 def apply_permissions(filename, uid=-1, gid=-1, mode=-1, mask=-1,
 	stat_cached=None, follow_links=True):


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2015-01-18 18:04 Michał Górny
  0 siblings, 0 replies; 134+ messages in thread
From: Michał Górny @ 2015-01-18 18:04 UTC (permalink / raw
  To: gentoo-commits

commit:     e30ad8803d82f11776f2da55b6650dee715154fa
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 17 11:10:23 2015 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Jan 18 18:04:24 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e30ad880

compression_probe: support lz4, lzip, lzop

---
 pym/portage/util/compression_probe.py | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/pym/portage/util/compression_probe.py b/pym/portage/util/compression_probe.py
index 1dc3547..74f74b1 100644
--- a/pym/portage/util/compression_probe.py
+++ b/pym/portage/util/compression_probe.py
@@ -14,14 +14,22 @@ from portage.exception import FileNotFound, PermissionDenied
 _decompressors = {
 	"bzip2": "${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d}",
 	"gzip": "gzip -d",
+	"lz4": "lz4 -d",
+	"lzip": "lzip -d",
+	"lzop": "lzop -d",
 	"xz": "xz -d",
 }
 
 _compression_re = re.compile(b'^(' +
 	b'(?P<bzip2>\x42\x5a\x68\x39)|' +
 	b'(?P<gzip>\x1f\x8b)|' +
+	b'(?P<lz4>(?:\x04\x22\x4d\x18|\x02\x21\x4c\x18))|' +
+	b'(?P<lzip>LZIP)|' +
+	b'(?P<lzop>\x89LZO\x00\x0d\x0a\x1a\x0a)|' +
 	b'(?P<xz>\xfd\x37\x7a\x58\x5a\x00))')
 
+_max_compression_re_len = 9
+
 def compression_probe(f):
 	"""
 	Identify the compression type of a file. Returns one of the
@@ -29,6 +37,9 @@ def compression_probe(f):
 
 		bzip2
 		gzip
+		lz4
+		lzip
+		lzop
 		xz
 
 	@param f: a file path, or file-like object
@@ -59,7 +70,7 @@ def compression_probe(f):
 
 def _compression_probe_file(f):
 
-	m = _compression_re.match(f.read(6))
+	m = _compression_re.match(f.read(_max_compression_re_len))
 	if m is not None:
 		for k, v in m.groupdict().items():
 			if v is not None:


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2014-12-02 19:07 Brian Dolbec
  0 siblings, 0 replies; 134+ messages in thread
From: Brian Dolbec @ 2014-12-02 19:07 UTC (permalink / raw
  To: gentoo-commits

commit:     84c45d5e3e8da1669b196d6a567491e34f9a2ec6
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Dec  2 19:02:18 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Dec  2 19:02:18 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=84c45d5e

portage/util/writeable_check.py: Fix IndexError:  bug 527486

X-Gentoo-Bug: 527486
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=527486

---
 pym/portage/util/writeable_check.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/portage/util/writeable_check.py b/pym/portage/util/writeable_check.py
index 429691c..445b2c2 100644
--- a/pym/portage/util/writeable_check.py
+++ b/pym/portage/util/writeable_check.py
@@ -55,7 +55,7 @@ def linux_ro_checker(dir_list):
 				#       _dir ^ ^ attr1                     ^ attr2
 				# there can be a variable number of fields
 				# to the left of the ' - ', after the attr's, so split it there
-				mount = line.split(' - ')
+				mount = line.split(' - ', 1)
 				_dir, attr1 = mount[0].split()[4:6]
 				attr2 = mount[1].split()[2]
 				if attr1.startswith('ro') or attr2.startswith('ro'):


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2014-04-04 23:01 Brian Dolbec
  0 siblings, 0 replies; 134+ messages in thread
From: Brian Dolbec @ 2014-04-04 23:01 UTC (permalink / raw
  To: gentoo-commits

commit:     ad1d3b4d4c8061285cc53b1b99105182a4acafec
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Apr  4 00:08:18 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Apr  4 22:53:22 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ad1d3b4d

writeable_check.py: Fix RO check (bug 505428)

Use /proc/self/mountinfo which only contains the relevant chroot mounts.
Mountinfo changes are thanks to jcallen for the valuable info he provided.

---
 pym/portage/util/writeable_check.py | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/pym/portage/util/writeable_check.py b/pym/portage/util/writeable_check.py
index e6ddce6..429691c 100644
--- a/pym/portage/util/writeable_check.py
+++ b/pym/portage/util/writeable_check.py
@@ -13,7 +13,6 @@ from __future__ import unicode_literals
 
 import io
 import logging
-import re
 
 from portage import _encodings
 from portage.util import writemsg_level
@@ -34,8 +33,8 @@ def get_ro_checker():
 
 def linux_ro_checker(dir_list):
 	"""
-	Use /proc/mounts to check that no directories installed by the ebuild are set
-	to be installed to a read-only filesystem.
+	Use /proc/self/mountinfo to check that no directories installed by the
+	ebuild are set to be installed to a read-only filesystem.
 
 	@param dir_list: A list of directories installed by the ebuild.
 	@type dir_list: List
@@ -46,18 +45,26 @@ def linux_ro_checker(dir_list):
 	ro_filesystems = set()
 
 	try:
-		with io.open("/proc/mounts", mode='r', encoding=_encodings['content'],
-			errors='replace') as f:
-			roregex = re.compile(r'(\A|,)ro(\Z|,)')
+		with io.open("/proc/self/mountinfo", mode='r',
+			encoding=_encodings['content'], errors='replace') as f:
 			for line in f:
-				if roregex.search(line.split(" ")[3].strip()) is not None:
-					romount = line.split(" ")[1].strip()
-					ro_filesystems.add(romount)
+				# we're interested in dir and both attr fileds which always
+				# start with either 'ro' or 'rw'
+				# example line:
+				# 14 1 8:3 / / rw,noatime - ext3 /dev/root rw,errors=continue,commit=5,barrier=1,data=writeback
+				#       _dir ^ ^ attr1                     ^ attr2
+				# there can be a variable number of fields
+				# to the left of the ' - ', after the attr's, so split it there
+				mount = line.split(' - ')
+				_dir, attr1 = mount[0].split()[4:6]
+				attr2 = mount[1].split()[2]
+				if attr1.startswith('ro') or attr2.startswith('ro'):
+					ro_filesystems.add(_dir)
 
-	# If /proc/mounts can't be read, assume that there are no RO
+	# If /proc/self/mountinfo can't be read, assume that there are no RO
 	# filesystems and return.
 	except EnvironmentError:
-		writemsg_level(_("!!! /proc/mounts cannot be read"),
+		writemsg_level(_("!!! /proc/self/mountinfo cannot be read"),
 			level=logging.WARNING, noiselevel=-1)
 		return []
 


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2014-02-05 19:42 Sebastian Luther
  0 siblings, 0 replies; 134+ messages in thread
From: Sebastian Luther @ 2014-02-05 19:42 UTC (permalink / raw
  To: gentoo-commits

commit:     94201ef142659bd4baec08e30bc2c7c3dd1b8683
Author:     Sebastian Luther <SebastianLuther <AT> gmx <DOT> de>
AuthorDate: Mon Jan 27 23:03:45 2014 +0000
Commit:     Sebastian Luther <SebastianLuther <AT> gmx <DOT> de >
CommitDate: Wed Feb  5 19:39:21 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=94201ef1

Add digraph.discard

---
 pym/portage/util/digraph.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/pym/portage/util/digraph.py b/pym/portage/util/digraph.py
index fc1fb86..4a9cb43 100644
--- a/pym/portage/util/digraph.py
+++ b/pym/portage/util/digraph.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2013 Gentoo Foundation
+# Copyright 2010-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 from __future__ import unicode_literals
@@ -47,6 +47,16 @@ class digraph(object):
 		priorities.append(priority)
 		priorities.sort()
 
+	def discard(self, node):
+		"""
+		Like remove(), except it doesn't raises KeyError if the
+		node doesn't exist.
+		"""
+		try:
+			self.remove(node)
+		except KeyError:
+			pass
+
 	def remove(self, node):
 		"""Removes the specified node from the digraph, also removing
 		and ties to other nodes in the digraph. Raises KeyError if the


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2013-10-16 23:25 Brian Dolbec
  0 siblings, 0 replies; 134+ messages in thread
From: Brian Dolbec @ 2013-10-16 23:25 UTC (permalink / raw
  To: gentoo-commits

commit:     1afdc13a842d43acf4bc10649c18a0bbcdbd6073
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 16 23:24:25 2013 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Oct 16 23:24:25 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1afdc13a

fix typo causing a "os" is not defined test error.

---
 pym/portage/util/movefile.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index 4f158cd..452e77f 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -129,7 +129,7 @@ else:
 						(_unicode_decode(dest), _unicode_decode(attr)))
 	else:
 		try:
-			with open(os.devnull, 'wb') as f:
+			with open(_os.devnull, 'wb') as f:
 				subprocess.call(["getfattr", "--version"], stdout=f)
 				subprocess.call(["setfattr", "--version"], stdout=f)
 		except OSError:


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2013-10-16 20:47 Mike Frysinger
  0 siblings, 0 replies; 134+ messages in thread
From: Mike Frysinger @ 2013-10-16 20:47 UTC (permalink / raw
  To: gentoo-commits

commit:     fbe5409a3bebeee9c729a21e2c88a3f93c26e992
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 16 18:41:02 2013 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Wed Oct 16 20:33:01 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=fbe5409a

movefile: simplify xattr fallback logic

The "with open()" construct handles exceptions just fine.

---
 pym/portage/util/movefile.py | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index 65d81c6..4f158cd 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -128,15 +128,11 @@ else:
 						"does not support extended attribute '%s'") %
 						(_unicode_decode(dest), _unicode_decode(attr)))
 	else:
-		_devnull = open("/dev/null", "wb")
 		try:
-			subprocess.call(["getfattr", "--version"], stdout=_devnull)
-			subprocess.call(["setfattr", "--version"], stdout=_devnull)
-			_has_getfattr_and_setfattr = True
+			with open(os.devnull, 'wb') as f:
+				subprocess.call(["getfattr", "--version"], stdout=f)
+				subprocess.call(["setfattr", "--version"], stdout=f)
 		except OSError:
-			_has_getfattr_and_setfattr = False
-		_devnull.close()
-		if _has_getfattr_and_setfattr:
 			def _copyxattr(src, dest, exclude=None):
 				# TODO: implement exclude
 				getfattr_process = subprocess.Popen(["getfattr", "-d", "--absolute-names", src], stdout=subprocess.PIPE)


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2013-10-15 21:56 Mike Frysinger
  0 siblings, 0 replies; 134+ messages in thread
From: Mike Frysinger @ 2013-10-15 21:56 UTC (permalink / raw
  To: gentoo-commits

commit:     b4bb9ff47731fd406ca4f5c73bede321d6d8e873
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 15 21:55:57 2013 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Tue Oct 15 21:56:24 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b4bb9ff4

pym/util: clean up style a bit

Shouldn't be any functional changes here.

---
 pym/portage/util/ExtractKernelVersion.py |  6 +--
 pym/portage/util/SlotObject.py           |  1 -
 pym/portage/util/__init__.py             | 92 ++++++++++++++++----------------
 pym/portage/util/_info_files.py          | 20 +++----
 pym/portage/util/_urlopen.py             |  2 +-
 pym/portage/util/digraph.py              | 24 ++++-----
 pym/portage/util/env_update.py           |  8 +--
 pym/portage/util/lafilefixer.py          | 10 ++--
 pym/portage/util/movefile.py             | 24 ++++-----
 9 files changed, 93 insertions(+), 94 deletions(-)

diff --git a/pym/portage/util/ExtractKernelVersion.py b/pym/portage/util/ExtractKernelVersion.py
index 69bd58a..af4a4fe 100644
--- a/pym/portage/util/ExtractKernelVersion.py
+++ b/pym/portage/util/ExtractKernelVersion.py
@@ -61,18 +61,18 @@ def ExtractKernelVersion(base_dir):
 
 	# Grab a list of files named localversion* and sort them
 	localversions = os.listdir(base_dir)
-	for x in range(len(localversions)-1,-1,-1):
+	for x in range(len(localversions) - 1, -1, -1):
 		if localversions[x][:12] != "localversion":
 			del localversions[x]
 	localversions.sort()
 
 	# Append the contents of each to the version string, stripping ALL whitespace
 	for lv in localversions:
-		version += "".join( " ".join( grabfile( base_dir+ "/" + lv ) ).split() )
+		version += "".join(" ".join(grabfile(base_dir + "/" + lv)).split())
 
 	# Check the .config for a CONFIG_LOCALVERSION and append that too, also stripping whitespace
 	kernelconfig = getconfig(base_dir+"/.config")
 	if kernelconfig and "CONFIG_LOCALVERSION" in kernelconfig:
 		version += "".join(kernelconfig["CONFIG_LOCALVERSION"].split())
 
-	return (version,None)
+	return (version, None)

diff --git a/pym/portage/util/SlotObject.py b/pym/portage/util/SlotObject.py
index a59dfc1..4bb6822 100644
--- a/pym/portage/util/SlotObject.py
+++ b/pym/portage/util/SlotObject.py
@@ -48,4 +48,3 @@ class SlotObject(object):
 				setattr(obj, myattr, getattr(self, myattr))
 
 		return obj
-

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index e94849f..24553da 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -64,7 +64,7 @@ def initialize_logger(level=logging.WARN):
 	"""
 	logging.basicConfig(level=logging.WARN, format='[%(levelname)-4s] %(message)s')
 
-def writemsg(mystr,noiselevel=0,fd=None):
+def writemsg(mystr, noiselevel=0, fd=None):
 	"""Prints out warning and debug messages based on the noiselimit setting"""
 	global noiselimit
 	if fd is None:
@@ -82,7 +82,7 @@ def writemsg(mystr,noiselevel=0,fd=None):
 		fd.write(mystr)
 		fd.flush()
 
-def writemsg_stdout(mystr,noiselevel=0):
+def writemsg_stdout(mystr, noiselevel=0):
 	"""Prints messages stdout based on the noiselimit setting"""
 	writemsg(mystr, noiselevel=noiselevel, fd=sys.stdout)
 
@@ -107,7 +107,7 @@ def writemsg_level(msg, level=0, noiselevel=0):
 	writemsg(msg, noiselevel=noiselevel, fd=fd)
 
 def normalize_path(mypath):
-	""" 
+	"""
 	os.path.normpath("//foo") returns "//foo" instead of "/foo"
 	We dislike this behavior so we create our own normpath func
 	to fix it.
@@ -127,8 +127,8 @@ def grabfile(myfilename, compat_level=0, recursive=0, remember_source_file=False
 	"""This function grabs the lines in a file, normalizes whitespace and returns lines in a list; if a line
 	begins with a #, it is ignored, as are empty lines"""
 
-	mylines=grablines(myfilename, recursive, remember_source_file=True)
-	newlines=[]
+	mylines = grablines(myfilename, recursive, remember_source_file=True)
+	newlines = []
 
 	for x, source_file in mylines:
 		#the split/join thing removes leading and trailing whitespace, and converts any whitespace in the line
@@ -146,10 +146,10 @@ def grabfile(myfilename, compat_level=0, recursive=0, remember_source_file=False
 		myline = " ".join(myline)
 		if not myline:
 			continue
-		if myline[0]=="#":
+		if myline[0] == "#":
 			# Check if we have a compat-level string. BC-integration data.
 			# '##COMPAT==>N<==' 'some string attached to it'
-			mylinetest = myline.split("<==",1)
+			mylinetest = myline.split("<==", 1)
 			if len(mylinetest) == 2:
 				myline_potential = mylinetest[1]
 				mylinetest = mylinetest[0].split("##COMPAT==>")
@@ -166,7 +166,7 @@ def grabfile(myfilename, compat_level=0, recursive=0, remember_source_file=False
 			newlines.append(myline)
 	return newlines
 
-def map_dictlist_vals(func,myDict):
+def map_dictlist_vals(func, myDict):
 	"""Performs a function on each value of each key in a dictlist.
 	Returns a new dictlist."""
 	new_dl = {}
@@ -180,7 +180,7 @@ def stack_dictlist(original_dicts, incremental=0, incrementals=[], ignore_none=0
 	Stacks an array of dict-types into one array. Optionally merging or
 	overwriting matching key/value pairs for the dict[key]->list.
 	Returns a single dict. Higher index in lists is preferenced.
-	
+
 	Example usage:
 	   >>> from portage.util import stack_dictlist
 		>>> print stack_dictlist( [{'a':'b'},{'x':'y'}])
@@ -195,7 +195,7 @@ def stack_dictlist(original_dicts, incremental=0, incrementals=[], ignore_none=0
 		>>> { 'KEYWORDS':['alpha'] }
 		>>> print stack_dictlist( [a,b], incrementals=['KEYWORDS'])
 		>>> { 'KEYWORDS':['alpha'] }
-	
+
 	@param original_dicts a list of (dictionary objects or None)
 	@type list
 	@param incremental True or false depending on whether new keys should overwrite
@@ -206,7 +206,7 @@ def stack_dictlist(original_dicts, incremental=0, incrementals=[], ignore_none=0
 	@type list
 	@param ignore_none Appears to be ignored, but probably was used long long ago.
 	@type boolean
-	
+
 	"""
 	final_dict = {}
 	for mydict in original_dicts:
@@ -215,7 +215,7 @@ def stack_dictlist(original_dicts, incremental=0, incrementals=[], ignore_none=0
 		for y in mydict:
 			if not y in final_dict:
 				final_dict[y] = []
-			
+
 			for thing in mydict[y]:
 				if thing:
 					if incremental or y in incrementals:
@@ -342,7 +342,7 @@ def stack_lists(lists, incremental=1, remember_source_file=False,
 def grabdict(myfilename, juststrings=0, empty=0, recursive=0, incremental=1):
 	"""
 	This function grabs the lines in a file, normalizes whitespace and returns lines in a dictionary
-	
+
 	@param myfilename: file to process
 	@type myfilename: string (path)
 	@param juststrings: only return strings
@@ -358,9 +358,9 @@ def grabdict(myfilename, juststrings=0, empty=0, recursive=0, incremental=1):
 	1.  Returns the lines in a file in a dictionary, for example:
 		'sys-apps/portage x86 amd64 ppc'
 		would return
-		{ "sys-apps/portage" : [ 'x86', 'amd64', 'ppc' ]
+		{"sys-apps/portage" : ['x86', 'amd64', 'ppc']}
 	"""
-	newdict={}
+	newdict = {}
 	for x in grablines(myfilename, recursive):
 		#the split/join thing removes leading and trailing whitespace, and converts any whitespace in the line
 		#into single spaces.
@@ -537,7 +537,7 @@ def _recursive_file_list(path):
 				yield fullpath
 
 def grablines(myfilename, recursive=0, remember_source_file=False):
-	mylines=[]
+	mylines = []
 	if recursive:
 		for f in _recursive_file_list(myfilename):
 			mylines.extend(grablines(f, recursive=False,
@@ -561,7 +561,7 @@ def grablines(myfilename, recursive=0, remember_source_file=False):
 				raise
 	return mylines
 
-def writedict(mydict,myfilename,writekey=True):
+def writedict(mydict, myfilename, writekey=True):
 	"""Writes out a dict to a file; writekey=0 mode doesn't write out
 	the key and assumes all values are strings, not lists."""
 	lines = []
@@ -769,10 +769,10 @@ def varexpand(mystring, mydict=None, error_leader=None):
 	This code is used by the configfile code, as well as others (parser)
 	This would be a good bunch of code to port to C.
 	"""
-	numvars=0
-	#in single, double quotes
-	insing=0
-	indoub=0
+	numvars = 0
+	# in single, double quotes
+	insing = 0
+	indoub = 0
 	pos = 0
 	length = len(mystring)
 	newstring = []
@@ -784,7 +784,7 @@ def varexpand(mystring, mydict=None, error_leader=None):
 			else:
 				newstring.append("'") # Quote removal is handled by shlex.
 				insing=not insing
-			pos=pos+1
+			pos += 1
 			continue
 		elif current == '"':
 			if (insing):
@@ -792,9 +792,9 @@ def varexpand(mystring, mydict=None, error_leader=None):
 			else:
 				newstring.append('"') # Quote removal is handled by shlex.
 				indoub=not indoub
-			pos=pos+1
+			pos += 1
 			continue
-		if (not insing): 
+		if not insing:
 			#expansion time
 			if current == "\n":
 				#convert newlines to spaces
@@ -809,7 +809,7 @@ def varexpand(mystring, mydict=None, error_leader=None):
 				# escaped newline characters. Note that we don't handle
 				# escaped quotes here, since getconfig() uses shlex
 				# to handle that earlier.
-				if (pos+1>=len(mystring)):
+				if pos + 1 >= len(mystring):
 					newstring.append(current)
 					break
 				else:
@@ -831,15 +831,15 @@ def varexpand(mystring, mydict=None, error_leader=None):
 						newstring.append(mystring[pos - 2:pos])
 					continue
 			elif current == "$":
-				pos=pos+1
-				if mystring[pos]=="{":
-					pos=pos+1
-					braced=True
+				pos += 1
+				if mystring[pos] == "{":
+					pos += 1
+					braced = True
 				else:
-					braced=False
-				myvstart=pos
+					braced = False
+				myvstart = pos
 				while mystring[pos] in _varexpand_word_chars:
-					if (pos+1)>=len(mystring):
+					if pos + 1 >= len(mystring):
 						if braced:
 							msg = _varexpand_unexpected_eof_msg
 							if error_leader is not None:
@@ -847,20 +847,20 @@ def varexpand(mystring, mydict=None, error_leader=None):
 							writemsg(msg + "\n", noiselevel=-1)
 							return ""
 						else:
-							pos=pos+1
+							pos += 1
 							break
-					pos=pos+1
-				myvarname=mystring[myvstart:pos]
+					pos += 1
+				myvarname = mystring[myvstart:pos]
 				if braced:
-					if mystring[pos]!="}":
+					if mystring[pos] != "}":
 						msg = _varexpand_unexpected_eof_msg
 						if error_leader is not None:
 							msg = error_leader() + msg
 						writemsg(msg + "\n", noiselevel=-1)
 						return ""
 					else:
-						pos=pos+1
-				if len(myvarname)==0:
+						pos += 1
+				if len(myvarname) == 0:
 					msg = "$"
 					if braced:
 						msg += "{}"
@@ -869,7 +869,7 @@ def varexpand(mystring, mydict=None, error_leader=None):
 						msg = error_leader() + msg
 					writemsg(msg + "\n", noiselevel=-1)
 					return ""
-				numvars=numvars+1
+				numvars += 1
 				if myvarname in mydict:
 					newstring.append(mydict[myvarname])
 			else:
@@ -884,9 +884,9 @@ def varexpand(mystring, mydict=None, error_leader=None):
 # broken and removed, but can still be imported
 pickle_write = None
 
-def pickle_read(filename,default=None,debug=0):
+def pickle_read(filename, default=None, debug=0):
 	if not os.access(filename, os.R_OK):
-		writemsg(_("pickle_read(): File not readable. '")+filename+"'\n",1)
+		writemsg(_("pickle_read(): File not readable. '") + filename + "'\n", 1)
 		return default
 	data = None
 	try:
@@ -895,12 +895,12 @@ def pickle_read(filename,default=None,debug=0):
 		mypickle = pickle.Unpickler(myf)
 		data = mypickle.load()
 		myf.close()
-		del mypickle,myf
-		writemsg(_("pickle_read(): Loaded pickle. '")+filename+"'\n",1)
+		del mypickle, myf
+		writemsg(_("pickle_read(): Loaded pickle. '") + filename + "'\n", 1)
 	except SystemExit as e:
 		raise
 	except Exception as e:
-		writemsg(_("!!! Failed to load pickle: ")+str(e)+"\n",1)
+		writemsg(_("!!! Failed to load pickle: ") + str(e) + "\n", 1)
 		data = default
 	return data
 
@@ -1681,9 +1681,9 @@ def find_updated_config_files(target_root, config_protect):
 	"""
 	Return a tuple of configuration files that needs to be updated.
 	The tuple contains lists organized like this:
-	[ protected_dir, file_list ]
+		[protected_dir, file_list]
 	If the protected config isn't a protected_dir but a procted_file, list is:
-	[ protected_file, None ]
+		[protected_file, None]
 	If no configuration files needs to be updated, None is returned
 	"""
 

diff --git a/pym/portage/util/_info_files.py b/pym/portage/util/_info_files.py
index 0e3a210..fabf74b 100644
--- a/pym/portage/util/_info_files.py
+++ b/pym/portage/util/_info_files.py
@@ -14,9 +14,9 @@ def chk_updated_info_files(root, infodirs, prev_mtimes):
 
 	if os.path.exists("/usr/bin/install-info"):
 		out = portage.output.EOutput()
-		regen_infodirs=[]
+		regen_infodirs = []
 		for z in infodirs:
-			if z=='':
+			if z == '':
 				continue
 			inforoot = portage.util.normalize_path(root + z)
 			if os.path.isdir(inforoot) and \
@@ -37,11 +37,11 @@ def chk_updated_info_files(root, infodirs, prev_mtimes):
 				out.einfo("Regenerating GNU info directory index...")
 
 			dir_extensions = ("", ".gz", ".bz2")
-			icount=0
-			badcount=0
+			icount = 0
+			badcount = 0
 			errmsg = ""
 			for inforoot in regen_infodirs:
-				if inforoot=='':
+				if inforoot == '':
 					continue
 
 				if not os.path.isdir(inforoot) or \
@@ -89,20 +89,20 @@ def chk_updated_info_files(root, infodirs, prev_mtimes):
 						myso = portage._unicode_decode(
 							proc.communicate()[0]).rstrip("\n")
 						proc.wait()
-					existsstr="already exists, for file `"
+					existsstr = "already exists, for file `"
 					if myso:
-						if re.search(existsstr,myso):
+						if re.search(existsstr, myso):
 							# Already exists... Don't increment the count for this.
 							pass
-						elif myso[:44]=="install-info: warning: no info dir entry in ":
+						elif myso[:44] == "install-info: warning: no info dir entry in ":
 							# This info file doesn't contain a DIR-header: install-info produces this
 							# (harmless) warning (the --quiet switch doesn't seem to work).
 							# Don't increment the count for this.
 							pass
 						else:
-							badcount=badcount+1
+							badcount += 1
 							errmsg += myso + "\n"
-					icount=icount+1
+					icount += 1
 
 				if moved_old_dir and not os.path.exists(dir_file):
 					# We didn't generate a new dir file, so put the old file

diff --git a/pym/portage/util/_urlopen.py b/pym/portage/util/_urlopen.py
index 768ccb8..15f041a 100644
--- a/pym/portage/util/_urlopen.py
+++ b/pym/portage/util/_urlopen.py
@@ -23,7 +23,7 @@ if sys.hexversion >= 0x3000000:
 
 # to account for the difference between TIMESTAMP of the index' contents
 #  and the file-'mtime'
-TIMESTAMP_TOLERANCE=5
+TIMESTAMP_TOLERANCE = 5
 
 def urlopen(url, if_modified_since=None):
 	parse_result = urllib_parse.urlparse(url)

diff --git a/pym/portage/util/digraph.py b/pym/portage/util/digraph.py
index f752e28..fc1fb86 100644
--- a/pym/portage/util/digraph.py
+++ b/pym/portage/util/digraph.py
@@ -17,24 +17,24 @@ class digraph(object):
 
 	def __init__(self):
 		"""Create an empty digraph"""
-		
+
 		# { node : ( { child : priority } , { parent : priority } ) }
 		self.nodes = {}
 		self.order = []
 
 	def add(self, node, parent, priority=0):
 		"""Adds the specified node with the specified parent.
-		
+
 		If the dep is a soft-dep and the node already has a hard
 		relationship to the parent, the relationship is left as hard."""
-		
+
 		if node not in self.nodes:
 			self.nodes[node] = ({}, {}, node)
 			self.order.append(node)
-		
+
 		if not parent:
 			return
-		
+
 		if parent not in self.nodes:
 			self.nodes[parent] = ({}, {}, parent)
 			self.order.append(parent)
@@ -51,15 +51,15 @@ class digraph(object):
 		"""Removes the specified node from the digraph, also removing
 		and ties to other nodes in the digraph. Raises KeyError if the
 		node doesn't exist."""
-		
+
 		if node not in self.nodes:
 			raise KeyError(node)
-		
+
 		for parent in self.nodes[node][1]:
 			del self.nodes[parent][0][node]
 		for child in self.nodes[node][0]:
 			del self.nodes[child][1][node]
-		
+
 		del self.nodes[node]
 		self.order.remove(node)
 
@@ -158,10 +158,10 @@ class digraph(object):
 
 	def leaf_nodes(self, ignore_priority=None):
 		"""Return all nodes that have no children
-		
+
 		If ignore_soft_deps is True, soft deps are not counted as
 		children in calculations."""
-		
+
 		leaf_nodes = []
 		if ignore_priority is None:
 			for node in self.order:
@@ -192,10 +192,10 @@ class digraph(object):
 
 	def root_nodes(self, ignore_priority=None):
 		"""Return all nodes that have no parents.
-		
+
 		If ignore_soft_deps is True, soft deps are not counted as
 		parents in calculations."""
-		
+
 		root_nodes = []
 		if ignore_priority is None:
 			for node in self.order:

diff --git a/pym/portage/util/env_update.py b/pym/portage/util/env_update.py
index e9c06c5..5fddaac 100644
--- a/pym/portage/util/env_update.py
+++ b/pym/portage/util/env_update.py
@@ -171,9 +171,9 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env,
 		myld = io.open(_unicode_encode(ldsoconf_path,
 			encoding=_encodings['fs'], errors='strict'),
 			mode='r', encoding=_encodings['content'], errors='replace')
-		myldlines=myld.readlines()
+		myldlines = myld.readlines()
 		myld.close()
-		oldld=[]
+		oldld = []
 		for x in myldlines:
 			#each line has at least one char (a newline)
 			if x[:1] == "#":
@@ -321,7 +321,7 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env,
 			writemsg_level(_(">>> Regenerating %setc/ld.so.cache...\n") % \
 				(target_root,))
 			os.system("cd / ; %s -X -r '%s'" % (ldconfig, target_root))
-		elif ostype in ("FreeBSD","DragonFly"):
+		elif ostype in ("FreeBSD", "DragonFly"):
 			writemsg_level(_(">>> Regenerating %svar/run/ld-elf.so.hints...\n") % \
 				target_root)
 			os.system(("cd / ; %s -elf -i " + \
@@ -340,7 +340,7 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env,
 	outfile = atomic_ofstream(os.path.join(eroot, "etc", "profile.env"))
 	outfile.write(penvnotice)
 
-	env_keys = [ x for x in env if x != "LDPATH" ]
+	env_keys = [x for x in env if x != "LDPATH"]
 	env_keys.sort()
 	for k in env_keys:
 		v = env[k]

diff --git a/pym/portage/util/lafilefixer.py b/pym/portage/util/lafilefixer.py
index 54ff20d..2562d9a 100644
--- a/pym/portage/util/lafilefixer.py
+++ b/pym/portage/util/lafilefixer.py
@@ -11,7 +11,7 @@ from portage.exception import InvalidData
 #	This an re-implementaion of dev-util/lafilefixer-0.5.
 #	rewrite_lafile() takes the contents of an lafile as a string
 #	It then parses the dependency_libs and inherited_linker_flags
-#	entries. 
+#	entries.
 #	We insist on dependency_libs being present. inherited_linker_flags
 #	is optional.
 #	There are strict rules about the syntax imposed by libtool's libltdl.
@@ -21,7 +21,7 @@ from portage.exception import InvalidData
 #	lafilefixer does).
 #	What it does:
 #		* Replaces all .la files with absolut paths in dependency_libs with
-#		  corresponding -l* and -L* entries 
+#		  corresponding -l* and -L* entries
 #		  (/usr/lib64/libfoo.la -> -L/usr/lib64 -lfoo)
 #		* Moves various flags (see flag_re below) to inherited_linker_flags,
 #		  if such an entry was present.
@@ -36,7 +36,7 @@ from portage.exception import InvalidData
 dep_libs_re = re.compile(b"dependency_libs='(?P<value>[^']*)'$")
 inh_link_flags_re = re.compile(b"inherited_linker_flags='(?P<value>[^']*)'$")
 
-#regexes for replacing stuff in -L entries. 
+#regexes for replacing stuff in -L entries.
 #replace 'X11R6/lib' and 'local/lib' with 'lib', no idea what's this about.
 X11_local_sub = re.compile(b"X11R6/lib|local/lib")
 #get rid of the '..'
@@ -129,11 +129,11 @@ def rewrite_lafile(contents):
 			#This allows us to place all -L entries at the beginning
 			#of 'dependency_libs'.
 			ladir = dep_libs_entry
-			
+
 			ladir = X11_local_sub.sub(b"lib", ladir)
 			ladir = pkgconfig_sub1.sub(b"usr", ladir)
 			ladir = pkgconfig_sub2.sub(b"\g<usrlib>", ladir)
-			
+
 			if ladir not in libladir:
 				libladir.append(ladir)
 

diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index e9b01be..65d81c6 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -16,7 +16,7 @@ import textwrap
 
 import portage
 from portage import bsd_chflags, _encodings, _os_overrides, _selinux, \
-	_unicode_decode, _unicode_encode, _unicode_func_wrapper,\
+	_unicode_decode, _unicode_encode, _unicode_func_wrapper, \
 	_unicode_module_wrapper
 from portage.const import MOVE_BINARY
 from portage.exception import OperationNotSupported
@@ -181,7 +181,7 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 
 	try:
 		if not sstat:
-			sstat=os.lstat(src)
+			sstat = os.lstat(src)
 
 	except SystemExit as e:
 		raise
@@ -191,12 +191,12 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 		writemsg("!!! %s\n" % (e,), noiselevel=-1)
 		return None
 
-	destexists=1
+	destexists = 1
 	try:
-		dstat=os.lstat(dest)
+		dstat = os.lstat(dest)
 	except (OSError, IOError):
-		dstat=os.lstat(os.path.dirname(dest))
-		destexists=0
+		dstat = os.lstat(os.path.dirname(dest))
+		destexists = 0
 
 	if bsd_chflags:
 		if destexists and dstat.st_flags != 0:
@@ -211,7 +211,7 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 		if stat.S_ISLNK(dstat[stat.ST_MODE]):
 			try:
 				os.unlink(dest)
-				destexists=0
+				destexists = 0
 			except SystemExit as e:
 				raise
 			except Exception as e:
@@ -219,7 +219,7 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 
 	if stat.S_ISLNK(sstat[stat.ST_MODE]):
 		try:
-			target=os.readlink(src)
+			target = os.readlink(src)
 			if mysettings and "D" in mysettings and \
 				target.startswith(mysettings["D"]):
 				target = target[len(mysettings["D"])-1:]
@@ -238,7 +238,7 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 				if e.errno not in (errno.ENOENT, errno.EEXIST) or \
 					target != os.readlink(dest):
 					raise
-			lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID])
+			lchown(dest, sstat[stat.ST_UID], sstat[stat.ST_GID])
 
 			try:
 				_os.unlink(src_bytes)
@@ -304,7 +304,7 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 					pass
 				break
 
-	renamefailed=1
+	renamefailed = 1
 	if hardlinked:
 		renamefailed = False
 	if not hardlinked and (selinux_enabled or sstat.st_dev == dstat.st_dev):
@@ -312,8 +312,8 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 			if selinux_enabled:
 				selinux.rename(src, dest)
 			else:
-				os.rename(src,dest)
-			renamefailed=0
+				os.rename(src, dest)
+			renamefailed = 0
 		except OSError as e:
 			if e.errno != errno.EXDEV:
 				# Some random error.


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2013-09-16 16:51 Arfrever Frehtes Taifersar Arahesis
  0 siblings, 0 replies; 134+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2013-09-16 16:51 UTC (permalink / raw
  To: gentoo-commits

commit:     7fff387a4f3b96b64f209a80421d8f2bc60fea95
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Mon Sep 16 16:47:59 2013 +0000
Commit:     Arfrever Frehtes Taifersar Arahesis <arfrever.fta <AT> gmail <DOT> com>
CommitDate: Mon Sep 16 16:47:59 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7fff387a

portage.util.atomic_ofstream.__init__(): Fix compatibility with Python <2.6.5.
Reported by Stephen Klimaszewski.

---
 pym/portage/util/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 264e093..8f311bf 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -1248,7 +1248,7 @@ class atomic_ofstream(ObjectProxy):
 				object.__setattr__(self, '_file',
 					open_func(_unicode_encode(tmp_name,
 						encoding=_encodings['fs'], errors='strict'),
-						mode=mode, **kargs))
+						mode=mode, **portage._native_kwargs(kargs)))
 				return
 			except IOError as e:
 				if canonical_path == filename:


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2013-09-15  9:36 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2013-09-15  9:36 UTC (permalink / raw
  To: gentoo-commits

commit:     a98be6fc2e7dfbf2dfff90bcecb672beb2a0a71e
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 15 09:36:12 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Sep 15 09:36:12 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a98be6fc

_copyxattr: ignore EOPNOTSUPP from os.listxattr()

This will fix bug #484540.

---
 pym/portage/util/movefile.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index 8ce80f1..e9b01be 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -72,7 +72,12 @@ if hasattr(_os, "getxattr"):
 	# Python >=3.3 and GNU/Linux
 	def _copyxattr(src, dest, exclude=None):
 
-		attrs = _os.listxattr(src)
+		try:
+			attrs = _os.listxattr(src)
+		except OSError as e:
+			if e.errno != OperationNotSupported.errno:
+				raise
+			attrs = ()
 		if attrs:
 			if exclude is not None and isinstance(attrs[0], bytes):
 				exclude = exclude.encode(_encodings['fs'])


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2013-09-15  0:51 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2013-09-15  0:51 UTC (permalink / raw
  To: gentoo-commits

commit:     269593bc545ddb1df95985039b47b1201d1691ab
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 15 00:51:07 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Sep 15 00:51:07 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=269593bc

_copyxattr: ignore EOPNOTSUPP from xattr.list()

---
 pym/portage/util/movefile.py | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index 1f92b59..8ce80f1 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -100,16 +100,10 @@ else:
 
 			try:
 				attrs = xattr.list(src)
-				raise_exception = False
 			except IOError as e:
-				raise_exception = True
 				if e.errno != OperationNotSupported.errno:
 					raise
-			if raise_exception:
-				raise OperationNotSupported(
-					_("Filesystem containing file '%s' "
-					"does not support listing of extended attributes") %
-					(_unicode_decode(src),))
+				attrs = ()
 
 			if attrs:
 				if exclude is not None and isinstance(attrs[0], bytes):


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2013-09-11 14:07 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2013-09-11 14:07 UTC (permalink / raw
  To: gentoo-commits

commit:     772c91f412758ced0a43b32b31841c49e136ecc8
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 11 14:06:33 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Sep 11 14:06:33 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=772c91f4

_ctypes: use_errno=True for ctypes.get_errno()

---
 pym/portage/util/_ctypes.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/portage/util/_ctypes.py b/pym/portage/util/_ctypes.py
index 4e5aa2a..aeceebc 100644
--- a/pym/portage/util/_ctypes.py
+++ b/pym/portage/util/_ctypes.py
@@ -41,7 +41,7 @@ def LoadLibrary(name):
 	handle = _library_handles.get(name)
 
 	if handle is None and ctypes is not None:
-		handle = ctypes.cdll.LoadLibrary(name)
+		handle = ctypes.CDLL(name, use_errno=True)
 		_library_handles[name] = handle
 
 	return handle


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2013-09-03 20:03 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2013-09-03 20:03 UTC (permalink / raw
  To: gentoo-commits

commit:     d6d555e0b43d0beee617952267406c305edecb05
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Sep  3 20:03:17 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Sep  3 20:03:17 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d6d555e0

_copyxattr: handle EOPNOTSUPP from xattr.list()

---
 pym/portage/util/movefile.py | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index 4ac4535..1f92b59 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -98,7 +98,19 @@ else:
 	if xattr is not None:
 		def _copyxattr(src, dest, exclude=None):
 
-			attrs = xattr.list(src)
+			try:
+				attrs = xattr.list(src)
+				raise_exception = False
+			except IOError as e:
+				raise_exception = True
+				if e.errno != OperationNotSupported.errno:
+					raise
+			if raise_exception:
+				raise OperationNotSupported(
+					_("Filesystem containing file '%s' "
+					"does not support listing of extended attributes") %
+					(_unicode_decode(src),))
+
 			if attrs:
 				if exclude is not None and isinstance(attrs[0], bytes):
 					exclude = exclude.encode(_encodings['fs'])


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2013-08-27 19:32 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2013-08-27 19:32 UTC (permalink / raw
  To: gentoo-commits

commit:     d2447ceada5e2e56ced9cfe25c15a88ba8074969
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 27 19:28:44 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Aug 27 19:30:45 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d2447cea

grabdict_package: use recursive name for errors

This will fix bug #482650.

---
 pym/portage/util/__init__.py | 43 +++++++++++++++++++++++++++----------------
 1 file changed, 27 insertions(+), 16 deletions(-)

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 92a2187..264e093 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -428,24 +428,35 @@ def grabdict_package(myfilename, juststrings=0, recursive=0, allow_wildcard=Fals
 	verify_eapi=False, eapi=None):
 	""" Does the same thing as grabdict except it validates keys
 	    with isvalidatom()"""
-	pkgs=grabdict(myfilename, juststrings, empty=1, recursive=recursive)
-	if not pkgs:
-		return pkgs
-	if verify_eapi and eapi is None:
-		eapi = read_corresponding_eapi_file(myfilename)
 
-	# We need to call keys() here in order to avoid the possibility of
-	# "RuntimeError: dictionary changed size during iteration"
-	# when an invalid atom is deleted.
+	if recursive:
+		file_list = _recursive_file_list(myfilename)
+	else:
+		file_list = [myfilename]
+
 	atoms = {}
-	for k, v in pkgs.items():
-		try:
-			k = Atom(k, allow_wildcard=allow_wildcard, allow_repo=allow_repo, eapi=eapi)
-		except InvalidAtom as e:
-			writemsg(_("--- Invalid atom in %s: %s\n") % (myfilename, e),
-				noiselevel=-1)
-		else:
-			atoms[k] = v
+	for filename in file_list:
+		d = grabdict(filename, juststrings=False,
+			empty=True, recursive=False, incremental=True)
+		if not d:
+			continue
+		if verify_eapi and eapi is None:
+			eapi = read_corresponding_eapi_file(myfilename)
+
+		for k, v in d.items():
+			try:
+				k = Atom(k, allow_wildcard=allow_wildcard,
+					allow_repo=allow_repo, eapi=eapi)
+			except InvalidAtom as e:
+				writemsg(_("--- Invalid atom in %s: %s\n") % (filename, e),
+					noiselevel=-1)
+			else:
+				atoms.setdefault(k, []).extend(v)
+
+	if juststrings:
+		for k, v in atoms.items():
+			atoms[k] = " ".join(v)
+
 	return atoms
 
 def grabfile_package(myfilename, compatlevel=0, recursive=0, allow_wildcard=False, allow_repo=False,


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2013-08-13 18:17 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2013-08-13 18:17 UTC (permalink / raw
  To: gentoo-commits

commit:     7b3a58ee5d5aab8e12edaf65aa2ef68c4d85e8a3
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 13 18:16:45 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Aug 13 18:16:45 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7b3a58ee

Fix last commit.

---
 pym/portage/util/_desktop_entry.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/portage/util/_desktop_entry.py b/pym/portage/util/_desktop_entry.py
index efd2136..0b49547 100644
--- a/pym/portage/util/_desktop_entry.py
+++ b/pym/portage/util/_desktop_entry.py
@@ -81,7 +81,7 @@ def validate_desktop_entry(path):
 			if msg.startswith('hint: ') or msg in _ignored_errors:
 				continue
 			if 'for key "NotShowIn" in group "Desktop Entry"' in msg or \
-				'for key "OnlyShowIn" in group "Desktop Entry"':
+				'for key "OnlyShowIn" in group "Desktop Entry"' in msg:
 				exempt = False
 				for s in _ShowIn_exemptions:
 					if s in msg:


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2013-08-13 15:46 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2013-08-13 15:46 UTC (permalink / raw
  To: gentoo-commits

commit:     4e0c84bf0fd50dcaf88f09b21ab32b13841648ff
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 13 15:46:28 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Aug 13 15:46:28 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=4e0c84bf

validate_desktop_entry: allow OnlyShowIn Pantheon

This will fix bug #480586.

---
 pym/portage/util/_desktop_entry.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/pym/portage/util/_desktop_entry.py b/pym/portage/util/_desktop_entry.py
index 29e154d..efd2136 100644
--- a/pym/portage/util/_desktop_entry.py
+++ b/pym/portage/util/_desktop_entry.py
@@ -51,7 +51,7 @@ _ignored_errors = (
 		'warning: key "Encoding" in group "Desktop Entry" is deprecated'
 )
 
-_NotShowIn_exemptions = (
+_ShowIn_exemptions = (
 	# See bug #480586.
 	'contains an unregistered value "Pantheon"',
 )
@@ -80,9 +80,10 @@ def validate_desktop_entry(path):
 			# "hint:" output is new in desktop-file-utils-0.21
 			if msg.startswith('hint: ') or msg in _ignored_errors:
 				continue
-			if 'for key "NotShowIn" in group "Desktop Entry"' in msg:
+			if 'for key "NotShowIn" in group "Desktop Entry"' in msg or \
+				'for key "OnlyShowIn" in group "Desktop Entry"':
 				exempt = False
-				for s in _NotShowIn_exemptions:
+				for s in _ShowIn_exemptions:
 					if s in msg:
 						exempt = True
 						break


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2013-08-12  3:01 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2013-08-12  3:01 UTC (permalink / raw
  To: gentoo-commits

commit:     f98127d2569048c5d29d1734f2f7f8ba64c85242
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 12 03:01:08 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Aug 12 03:01:08 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f98127d2

validate_desktop_entry: handle NotShowIn Pantheon

This will fix bug #480586.

---
 pym/portage/util/_desktop_entry.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/pym/portage/util/_desktop_entry.py b/pym/portage/util/_desktop_entry.py
index a46d582..29e154d 100644
--- a/pym/portage/util/_desktop_entry.py
+++ b/pym/portage/util/_desktop_entry.py
@@ -51,6 +51,11 @@ _ignored_errors = (
 		'warning: key "Encoding" in group "Desktop Entry" is deprecated'
 )
 
+_NotShowIn_exemptions = (
+	# See bug #480586.
+	'contains an unregistered value "Pantheon"',
+)
+
 def validate_desktop_entry(path):
 	args = ["desktop-file-validate", path]
 
@@ -75,6 +80,14 @@ def validate_desktop_entry(path):
 			# "hint:" output is new in desktop-file-utils-0.21
 			if msg.startswith('hint: ') or msg in _ignored_errors:
 				continue
+			if 'for key "NotShowIn" in group "Desktop Entry"' in msg:
+				exempt = False
+				for s in _NotShowIn_exemptions:
+					if s in msg:
+						exempt = True
+						break
+				if exempt:
+					continue
 			filtered_output.append(line)
 		output_lines = filtered_output
 


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2013-08-03  9:39 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2013-08-03  9:39 UTC (permalink / raw
  To: gentoo-commits

commit:     7a0380fdd44b83242bf6d5fe491834ace460c21e
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Aug  3 09:39:00 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Aug  3 09:39:00 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7a0380fd

_argparse: improve parse_* method compatibility

---
 pym/portage/util/_argparse.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/pym/portage/util/_argparse.py b/pym/portage/util/_argparse.py
index a9cdc9e..6ca7852 100644
--- a/pym/portage/util/_argparse.py
+++ b/pym/portage/util/_argparse.py
@@ -9,6 +9,8 @@ except ImportError:
 	# Compatibility with Python 2.6 and 3.1
 	from optparse import OptionGroup, OptionParser
 
+	from portage.localization import _
+
 	class ArgumentParser(object):
 		def __init__(self, **kwargs):
 			add_help = kwargs.pop("add_help", None)
@@ -17,8 +19,6 @@ except ImportError:
 			parser = OptionParser(**kwargs)
 			self._parser = parser
 			self.add_argument = parser.add_option
-			self.parse_known_args = parser.parse_args
-			self.parse_args = parser.parse_args
 			self.print_help = parser.print_help
 			self.error = parser.error
 
@@ -27,6 +27,16 @@ except ImportError:
 			self._parser.add_option_group(optiongroup)
 			return _ArgumentGroup(optiongroup)
 
+		def parse_known_args(self, args=None, namespace=None):
+			return self._parser.parse_args(args, namespace)
+
+		def parse_args(self, args=None, namespace=None):
+			args, argv = self.parse_known_args(args, namespace)
+			if argv:
+				msg = _('unrecognized arguments: %s')
+				self.error(msg % ' '.join(argv))
+			return args
+
 	class _ArgumentGroup(object):
 		def __init__(self, optiongroup):
 			self.add_argument = optiongroup.add_option


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2013-08-02 23:03 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2013-08-02 23:03 UTC (permalink / raw
  To: gentoo-commits

commit:     8c63deea651dfa38de89fcb5b011d77afa938d23
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Aug  2 23:03:00 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Aug  2 23:03:00 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=8c63deea

_argparse: add ArgumentParser.error()

---
 pym/portage/util/_argparse.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pym/portage/util/_argparse.py b/pym/portage/util/_argparse.py
index a44afed..2f915dc 100644
--- a/pym/portage/util/_argparse.py
+++ b/pym/portage/util/_argparse.py
@@ -19,6 +19,7 @@ except ImportError:
 			self.add_argument = parser.add_option
 			self.parse_known_args = parser.parse_args
 			self.parse_args = parser.parse_args
+			self.error = parser.error
 
 		def add_argument_group(self, title=None, **kwargs):
 			optiongroup = OptionGroup(self._parser, title, **kwargs)


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2013-08-02 18:06 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2013-08-02 18:06 UTC (permalink / raw
  To: gentoo-commits

commit:     bfdc03077c6b85df207c6109a57a7af7d5e5676a
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Aug  2 18:03:49 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Aug  2 18:03:49 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=bfdc0307

_argparse: support add_argument_group

---
 pym/portage/util/_argparse.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/pym/portage/util/_argparse.py b/pym/portage/util/_argparse.py
index 4227f4c..a44afed 100644
--- a/pym/portage/util/_argparse.py
+++ b/pym/portage/util/_argparse.py
@@ -7,7 +7,7 @@ try:
 	from argparse import ArgumentParser
 except ImportError:
 	# Compatibility with Python 2.6 and 3.1
-	from optparse import OptionParser
+	from optparse import OptionGroup, OptionParser
 
 	class ArgumentParser(object):
 		def __init__(self, **kwargs):
@@ -15,6 +15,16 @@ except ImportError:
 			if add_help is not None:
 				kwargs["add_help_option"] = add_help
 			parser = OptionParser(**kwargs)
+			self._parser = parser
 			self.add_argument = parser.add_option
 			self.parse_known_args = parser.parse_args
 			self.parse_args = parser.parse_args
+
+		def add_argument_group(self, title=None, **kwargs):
+			optiongroup = OptionGroup(self._parser, title, **kwargs)
+			self._parser.add_option_group(optiongroup)
+			return _ArgumentGroup(optiongroup)
+
+	class _ArgumentGroup(object):
+		def __init__(self, optiongroup):
+			self.add_argument = optiongroup.add_option


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2013-07-02 17:15 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2013-07-02 17:15 UTC (permalink / raw
  To: gentoo-commits

commit:     c2f13f5539a08b8b4a9dc881226ed4632fbe24f8
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Jul  2 17:15:18 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Jul  2 17:15:18 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c2f13f55

_copyxattr: report attribute name in error

The specific attribute name is often relevant. For example, an issue
with system.nfs4_acl was reported in bug #475496.

---
 pym/portage/util/movefile.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index f33e67c..c915997 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -87,7 +87,9 @@ if hasattr(_os, "getxattr"):
 			except OSError:
 				raise_exception = True
 			if raise_exception:
-				raise OperationNotSupported("Filesystem containing file '%s' does not support extended attributes" % dest)
+				raise OperationNotSupported(_("Filesystem containing file '%s' "
+					"does not support extended attribute '%s'") %
+					(_unicode_decode(dest), _unicode_decode(attr)))
 else:
 	try:
 		import xattr
@@ -111,7 +113,9 @@ else:
 				except IOError:
 					raise_exception = True
 				if raise_exception:
-					raise OperationNotSupported("Filesystem containing file '%s' does not support extended attributes" % dest)
+					raise OperationNotSupported(_("Filesystem containing file '%s' "
+						"does not support extended attribute '%s'") %
+						(_unicode_decode(dest), _unicode_decode(attr)))
 	else:
 		_devnull = open("/dev/null", "wb")
 		try:


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2013-06-28  1:46 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2013-06-28  1:46 UTC (permalink / raw
  To: gentoo-commits

commit:     23145c9f13947eeed17ae25ea80b8a667b0a3f5f
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 28 01:45:42 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Jun 28 01:45:42 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=23145c9f

getconfig: share recursion code with grablines

---
 pym/portage/util/__init__.py | 111 +++++++++++++++++++------------------------
 1 file changed, 48 insertions(+), 63 deletions(-)

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index f4d5395..546262e 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -488,25 +488,51 @@ def grabfile_package(myfilename, compatlevel=0, recursive=0, allow_wildcard=Fals
 def _recursive_basename_filter(f):
 	return not f.startswith(".") and not f.endswith("~")
 
-def grablines(myfilename, recursive=0, remember_source_file=False):
-	mylines=[]
-	if recursive and os.path.isdir(myfilename):
-		if os.path.basename(myfilename) in VCS_DIRS:
-			return mylines
+def _recursive_file_list(path):
+	# path may be a regular file or a directory
+
+	def onerror(e):
+		if e.errno == PermissionDenied.errno:
+			raise PermissionDenied(path)
+
+	stack = [os.path.split(path)]
+
+	while stack:
+		parent, fname = stack.pop()
+		fullpath = os.path.join(parent, fname)
+
 		try:
-			dirlist = os.listdir(myfilename)
+			st = os.stat(fullpath)
 		except OSError as e:
-			if e.errno == PermissionDenied.errno:
-				raise PermissionDenied(myfilename)
-			elif e.errno in (errno.ENOENT, errno.ESTALE):
-				return mylines
-			else:
-				raise
-		dirlist.sort()
-		for f in dirlist:
-			if _recursive_basename_filter(f):
-				mylines.extend(grablines(
-					os.path.join(myfilename, f), recursive, remember_source_file))
+			onerror(e)
+			continue
+
+		if stat.S_ISDIR(st.st_mode):
+			if fname in VCS_DIRS or not _recursive_basename_filter(fname):
+				continue
+			try:
+				children = os.listdir(fullpath)
+			except OSError as e:
+				onerror(e)
+				continue
+
+			# Sort in reverse, since we pop from the end of the stack.
+			# Include regular files in the stack, so files are sorted
+			# together with directories.
+			children.sort(reverse=True)
+			stack.extend((fullpath, x) for x in children)
+
+		elif stat.S_ISREG(st.st_mode):
+			if _recursive_basename_filter(fname):
+				yield fullpath
+
+def grablines(myfilename, recursive=0, remember_source_file=False):
+	mylines=[]
+	if recursive:
+		for f in _recursive_file_list(myfilename):
+			mylines.extend(grablines(f, recursive=False,
+				remember_source_file=remember_source_file))
+
 	else:
 		try:
 			myfile = io.open(_unicode_encode(myfilename,
@@ -585,18 +611,6 @@ _invalid_var_name_re = re.compile(r'^\d|\W')
 def getconfig(mycfg, tolerant=False, allow_sourcing=False, expand=True,
 	recursive=False):
 
-	is_dir = False
-	if recursive:
-		try:
-			is_dir = stat.S_ISDIR(os.stat(mycfg).st_mode)
-		except OSError as e:
-			if e.errno == PermissionDenied.errno:
-				raise PermissionDenied(mycfg)
-			elif e.errno in (errno.ENOENT, errno.ESTALE, errno.EISDIR):
-				return None
-			else:
-				raise
-
 	if isinstance(expand, dict):
 		# Some existing variable definitions have been
 		# passed in, for use in substitutions.
@@ -606,47 +620,18 @@ def getconfig(mycfg, tolerant=False, allow_sourcing=False, expand=True,
 		expand_map = {}
 	mykeys = {}
 
-	if recursive and is_dir:
+	if recursive:
 		# Emulate source commands so that syntax error messages
 		# can display real file names and line numbers.
-		def onerror(e):
-			if e.errno == PermissionDenied.errno:
-				raise PermissionDenied(mycfg)
-
-		recursive_files = []
-		for parent, dirs, files in os.walk(mycfg, onerror=onerror):
-			try:
-				parent = _unicode_decode(parent,
-					encoding=_encodings['fs'], errors='strict')
-			except UnicodeDecodeError:
-				continue
-			for fname_enc in dirs[:]:
-				try:
-					fname = _unicode_decode(fname_enc,
-						encoding=_encodings['fs'], errors='strict')
-				except UnicodeDecodeError:
-					dirs.remove(fname_enc)
-					continue
-				if fname in VCS_DIRS or not _recursive_basename_filter(fname):
-					dirs.remove(fname_enc)
-			for fname in files:
-				try:
-					fname = _unicode_decode(fname,
-						encoding=_encodings['fs'], errors='strict')
-				except UnicodeDecodeError:
-					pass
-				else:
-					if _recursive_basename_filter(fname):
-						fname = os.path.join(parent, fname)
-						if os.path.isfile(fname):
-							recursive_files.append(fname)
-		recursive_files.sort()
 		if not expand:
 			expand_map = False
-		for fname in recursive_files:
+		fname = None
+		for fname in _recursive_file_list(mycfg):
 			mykeys.update(getconfig(fname, tolerant=tolerant,
 				allow_sourcing=allow_sourcing, expand=expand_map,
 				recursive=False) or {})
+		if fname is None:
+			return None
 		return mykeys
 
 	f = None


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2013-06-27 21:32 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2013-06-27 21:32 UTC (permalink / raw
  To: gentoo-commits

commit:     4f525d2eb71175fb540106152c17145d5a506d60
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 27 21:31:49 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Jun 27 21:31:49 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=4f525d2e

util.listir: simplify and optimize

Use zip() to simplify, and fix "list = list + foo" usage to use
list.extend() or equivalent.

---
 pym/portage/util/listdir.py | 87 ++++++++++++++++++++++-----------------------
 1 file changed, 43 insertions(+), 44 deletions(-)

diff --git a/pym/portage/util/listdir.py b/pym/portage/util/listdir.py
index 61a025a..2012e14 100644
--- a/pym/portage/util/listdir.py
+++ b/pym/portage/util/listdir.py
@@ -5,6 +5,10 @@ __all__ = ['cacheddir', 'listdir']
 
 import errno
 import stat
+import sys
+
+if sys.hexversion < 0x3000000:
+	from itertools import izip as zip
 
 from portage import os
 from portage.const import VCS_DIRS
@@ -21,7 +25,6 @@ dircache = {}
 
 def cacheddir(my_original_path, ignorecvs, ignorelist, EmptyOnError, followSymlinks=True):
 	mypath = normalize_path(my_original_path)
-	cached_mtime, list, ftype = -1, [], []
 	try:
 		pathstat = os.stat(mypath)
 		if not stat.S_ISDIR(pathstat.st_mode):
@@ -35,14 +38,14 @@ def cacheddir(my_original_path, ignorecvs, ignorelist, EmptyOnError, followSymli
 		return [], []
 	else:
 		try:
-			list = os.listdir(mypath)
+			fpaths = os.listdir(mypath)
 		except EnvironmentError as e:
 			if e.errno != errno.EACCES:
 				raise
 			del e
 			raise PermissionDenied(mypath)
 		ftype = []
-		for x in list:
+		for x in fpaths:
 			try:
 				if followSymlinks:
 					pathstat = os.stat(mypath+"/"+x)
@@ -60,19 +63,20 @@ def cacheddir(my_original_path, ignorecvs, ignorelist, EmptyOnError, followSymli
 			except (IOError, OSError):
 				ftype.append(3)
 
-	ret_list = []
-	ret_ftype = []
-	for x in range(0, len(list)):
-		if list[x] in ignorelist:
-			pass
-		elif ignorecvs:
-			if list[x][:2] != ".#" and \
-				not (ftype[x] == 1 and list[x] in VCS_DIRS):
-				ret_list.append(list[x])
-				ret_ftype.append(ftype[x])
-		else:
-			ret_list.append(list[x])
-			ret_ftype.append(ftype[x])
+	if ignorelist or ignorecvs:
+		ret_list = []
+		ret_ftype = []
+		for file_path, file_type in zip(fpaths, ftype):
+			if file_path in ignorelist:
+				pass
+			elif ignorecvs:
+				if file_path[:2] != ".#" and \
+					not (file_type == 1 and file_path in VCS_DIRS):
+					ret_list.append(file_path)
+					ret_ftype.append(file_type)
+	else:
+		ret_list = fpaths
+		ret_ftype = ftype
 
 	return ret_list, ret_ftype
 
@@ -101,40 +105,35 @@ def listdir(mypath, recursive=False, filesonly=False, ignorecvs=False, ignorelis
 	@return: A list of files and directories (or just files or just directories) or an empty list.
 	"""
 
-	list, ftype = cacheddir(mypath, ignorecvs, ignorelist, EmptyOnError, followSymlinks)
+	fpaths, ftype = cacheddir(mypath, ignorecvs, ignorelist, EmptyOnError, followSymlinks)
 
-	if list is None:
-		list=[]
+	if fpaths is None:
+		fpaths = []
 	if ftype is None:
-		ftype=[]
+		ftype = []
 
 	if not (filesonly or dirsonly or recursive):
-		return list
+		return fpaths
 
 	if recursive:
-		x=0
-		while x<len(ftype):
-			if ftype[x] == 1:
-				l,f = cacheddir(mypath+"/"+list[x], ignorecvs, ignorelist, EmptyOnError,
-					followSymlinks)
-
-				l=l[:]
-				for y in range(0,len(l)):
-					l[y]=list[x]+"/"+l[y]
-				list=list+l
-				ftype=ftype+f
-			x+=1
+		stack = list(zip(fpaths, ftype))
+		fpaths = []
+		ftype = []
+		while stack:
+			file_path, file_type = stack.pop()
+			fpaths.append(file_path)
+			ftype.append(file_type)
+			if file_type == 1:
+				subdir_list, subdir_types = cacheddir(
+					os.path.join(mypath, file_path), ignorecvs,
+					ignorelist, EmptyOnError, followSymlinks)
+				stack.extend((os.path.join(file_path, x), x_type)
+					for x, x_type in zip(subdir_list, subdir_types))
+
 	if filesonly:
-		rlist=[]
-		for x in range(0,len(ftype)):
-			if ftype[x]==0:
-				rlist=rlist+[list[x]]
+		fpaths = [x for x, x_type in zip(fpaths, ftype) if x_type == 0]
+
 	elif dirsonly:
-		rlist = []
-		for x in range(0, len(ftype)):
-			if ftype[x] == 1:
-				rlist = rlist + [list[x]]	
-	else:
-		rlist=list
+		fpaths = [x for x, x_type in zip(fpaths, ftype) if x_type == 1]
 
-	return rlist
+	return fpaths


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2013-06-24  4:29 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2013-06-24  4:29 UTC (permalink / raw
  To: gentoo-commits

commit:     a84cdf0a00c44508fe5b72d969429a91ee83304a
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 24 04:29:25 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Jun 24 04:29:25 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a84cdf0a

util/__init__.py: enable unicode_literals

Unicode literals are nice for uniformity, but in this file it's more
complex than usual, since Python 2's shlex does not support unicode.
So, use _native_string() for compatibility in this case.

---
 pym/portage/util/__init__.py | 48 ++++++++++++++++++++++++++------------------
 1 file changed, 28 insertions(+), 20 deletions(-)

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index e4888f6..f4d5395 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -1,6 +1,8 @@
 # Copyright 2004-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
+from __future__ import unicode_literals
+
 __all__ = ['apply_permissions', 'apply_recursive_permissions',
 	'apply_secpass_permissions', 'apply_stat_permissions', 'atomic_ofstream',
 	'cmp_sort_key', 'ConfigProtect', 'dump_traceback', 'ensure_dirs',
@@ -671,15 +673,19 @@ def getconfig(mycfg, tolerant=False, allow_sourcing=False, expand=True,
 		if f is not None:
 			f.close()
 
+	# Since this file has unicode_literals enabled, and Python 2's
+	# shlex implementation does not support unicode, the following code
+	# uses _native_string() to encode unicode literals when necessary.
+
 	# Workaround for avoiding a silent error in shlex that is
 	# triggered by a source statement at the end of the file
 	# without a trailing newline after the source statement.
-	if content and content[-1] != '\n':
-		content += '\n'
+	if content and content[-1] != portage._native_string('\n'):
+		content += portage._native_string('\n')
 
 	# Warn about dos-style line endings since that prevents
 	# people from being able to source them with bash.
-	if '\r' in content:
+	if portage._native_string('\r') in content:
 		writemsg(("!!! " + _("Please use dos2unix to convert line endings " + \
 			"in config file: '%s'") + "\n") % mycfg, noiselevel=-1)
 
@@ -690,27 +696,30 @@ def getconfig(mycfg, tolerant=False, allow_sourcing=False, expand=True,
 		# attribute is properly set.
 		lex = _getconfig_shlex(instream=content, infile=mycfg, posix=True,
 			portage_tolerant=tolerant)
-		lex.wordchars = string.digits + string.ascii_letters + \
-			"~!@#$%*_\:;?,./-+{}"
-		lex.quotes="\"'"
+		lex.wordchars = portage._native_string(string.digits +
+			string.ascii_letters + "~!@#$%*_\:;?,./-+{}")
+		lex.quotes = portage._native_string("\"'")
 		if allow_sourcing:
-			lex.source="source"
-		while 1:
-			key=lex.get_token()
+			lex.source = portage._native_string("source")
+
+		while True:
+			key = _unicode_decode(lex.get_token())
 			if key == "export":
-				key = lex.get_token()
+				key = _unicode_decode(lex.get_token())
 			if key is None:
 				#normal end of file
-				break;
-			equ=lex.get_token()
-			if (equ==''):
+				break
+
+			equ = _unicode_decode(lex.get_token())
+			if not equ:
 				msg = lex.error_leader() + _("Unexpected EOF")
 				if not tolerant:
 					raise ParseError(msg)
 				else:
 					writemsg("%s\n" % msg, noiselevel=-1)
 					return mykeys
-			elif (equ!='='):
+
+			elif equ != "=":
 				msg = lex.error_leader() + \
 					_("Invalid token '%s' (not '=')") % (equ,)
 				if not tolerant:
@@ -718,7 +727,8 @@ def getconfig(mycfg, tolerant=False, allow_sourcing=False, expand=True,
 				else:
 					writemsg("%s\n" % msg, noiselevel=-1)
 					return mykeys
-			val=lex.get_token()
+
+			val = _unicode_decode(lex.get_token())
 			if val is None:
 				msg = lex.error_leader() + \
 					_("Unexpected end of config file: variable '%s'") % (key,)
@@ -727,8 +737,6 @@ def getconfig(mycfg, tolerant=False, allow_sourcing=False, expand=True,
 				else:
 					writemsg("%s\n" % msg, noiselevel=-1)
 					return mykeys
-			key = _unicode_decode(key)
-			val = _unicode_decode(val)
 
 			if _invalid_var_name_re.search(key) is not None:
 				msg = lex.error_leader() + \
@@ -749,7 +757,7 @@ def getconfig(mycfg, tolerant=False, allow_sourcing=False, expand=True,
 	except Exception as e:
 		if isinstance(e, ParseError) or lex is None:
 			raise
-		msg = _unicode_decode("%s%s") % (lex.error_leader(), e)
+		msg = "%s%s" % (lex.error_leader(), e)
 		writemsg("%s\n" % msg, noiselevel=-1)
 		raise
 
@@ -1501,9 +1509,9 @@ class LazyItemsDict(UserDict):
 			lazy_item = self.lazy_items.get(k)
 			if lazy_item is not None:
 				if not lazy_item.singleton:
-					raise TypeError(_unicode_decode("LazyItemsDict " + \
+					raise TypeError("LazyItemsDict " + \
 						"deepcopy is unsafe with lazy items that are " + \
-						"not singletons: key=%s value=%s") % (k, lazy_item,))
+						"not singletons: key=%s value=%s" % (k, lazy_item,))
 			UserDict.__setitem__(result, k_copy, deepcopy(self[k], memo))
 		return result
 


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2013-06-24  2:27 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2013-06-24  2:27 UTC (permalink / raw
  To: gentoo-commits

commit:     352365f9e9a7a7cd2b6d2ddcf3ef9ec717575863
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 24 02:27:37 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Jun 24 02:27:37 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=352365f9

getconfig: convert source IOError to ParseError

---
 pym/portage/util/__init__.py | 32 ++++++++++++++++++++++++--------
 1 file changed, 24 insertions(+), 8 deletions(-)

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 69459b8..e4888f6 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -550,13 +550,32 @@ def shlex_split(s):
 		rval = [_unicode_decode(x) for x in rval]
 	return rval
 
-class _tolerant_shlex(shlex.shlex):
+class _getconfig_shlex(shlex.shlex):
+
+	def __init__(self, portage_tolerant=False, **kwargs):
+		shlex.shlex.__init__(self, **kwargs)
+		self.__portage_tolerant = portage_tolerant
+
 	def sourcehook(self, newfile):
 		try:
 			return shlex.shlex.sourcehook(self, newfile)
 		except EnvironmentError as e:
-			writemsg(_("!!! Parse error in '%s': source command failed: %s\n") % \
-				(self.infile, str(e)), noiselevel=-1)
+			if e.errno == PermissionDenied.errno:
+				raise PermissionDenied(newfile)
+			if e.errno not in (errno.ENOENT, errno.ENOTDIR):
+				writemsg("open('%s', 'r'): %s\n" % (newfile, e), noiselevel=-1)
+				raise
+
+			msg = self.error_leader()
+			if e.errno == errno.ENOTDIR:
+				msg += _("%s: Not a directory") % newfile
+			else:
+				msg += _("%s: No such file or directory") % newfile
+
+			if self.__portage_tolerant:
+				writemsg("%s\n" % msg, noiselevel=-1)
+			else:
+				raise ParseError(msg)
 			return (newfile, io.StringIO())
 
 _invalid_var_name_re = re.compile(r'^\d|\W')
@@ -666,14 +685,11 @@ def getconfig(mycfg, tolerant=False, allow_sourcing=False, expand=True,
 
 	lex = None
 	try:
-		if tolerant:
-			shlex_class = _tolerant_shlex
-		else:
-			shlex_class = shlex.shlex
 		# The default shlex.sourcehook() implementation
 		# only joins relative paths when the infile
 		# attribute is properly set.
-		lex = shlex_class(content, infile=mycfg, posix=True)
+		lex = _getconfig_shlex(instream=content, infile=mycfg, posix=True,
+			portage_tolerant=tolerant)
 		lex.wordchars = string.digits + string.ascii_letters + \
 			"~!@#$%*_\:;?,./-+{}"
 		lex.quotes="\"'"


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2013-05-14  0:30 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2013-05-14  0:30 UTC (permalink / raw
  To: gentoo-commits

commit:     54259007c1cb4ba0d41a19f6cb32e923c29b8b74
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue May 14 00:30:05 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue May 14 00:30:05 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=54259007

env_update: ensure_dirs, encode filename

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

diff --git a/pym/portage/util/env_update.py b/pym/portage/util/env_update.py
index cf95467..e9c06c5 100644
--- a/pym/portage/util/env_update.py
+++ b/pym/portage/util/env_update.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2012 Gentoo Foundation
+# Copyright 2010-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 __all__ = ['env_update']
@@ -210,8 +210,7 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env,
 	# Update prelink.conf if we are prelink-enabled
 	if prelink_capable:
 		prelink_d = os.path.join(eroot, 'etc', 'prelink.conf.d')
-		if not os.path.isdir(prelink_d):
-			os.makedirs(prelink_d)
+		ensure_dirs(prelink_d)
 		newprelink = atomic_ofstream(os.path.join(prelink_d, 'portage.conf'))
 		newprelink.write("# prelink.conf autogenerated by env-update; make all changes to\n")
 		newprelink.write("# contents of /etc/env.d directory\n")
@@ -247,7 +246,8 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env,
 		# point it to the new stuff until the prelink package re-installs.
 		prelink_conf = os.path.join(eroot, 'etc', 'prelink.conf')
 		try:
-			with open(prelink_conf, 'rb') as f:
+			with open(_unicode_encode(prelink_conf,
+				encoding=_encodings['fs'], errors='strict'), 'rb') as f:
 				if f.readline() == b'# prelink.conf autogenerated by env-update; make all changes to\n':
 					f = atomic_ofstream(prelink_conf)
 					f.write('-c /etc/prelink.conf.d/*.conf\n')


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2013-05-13 15:27 Mike Frysinger
  0 siblings, 0 replies; 134+ messages in thread
From: Mike Frysinger @ 2013-05-13 15:27 UTC (permalink / raw
  To: gentoo-commits

commit:     a2ad553d45b7489976104d3bfc664e00138ceeae
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sat May 11 19:31:48 2013 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon May 13 00:47:27 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a2ad553d

env-update: change prelink to use /etc/prelink.conf.d/portage.conf

Newer prelinks can support /etc/prelink.conf.d/ files.  So that prelink
can install /etc/prelink.conf and manage it itself, have env-update only
write /etc/prelink.conf.d/portage.conf instead of clobbering the main
/etc/prelink.conf file.

This should be backwards compatible as portage will conditionally change
/etc/prelink.conf to use the new /etc/prelink.conf.d/ too.

URL: http://bugs.gentoo.org/266855
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 pym/portage/util/env_update.py |   61 +++++++++++++++++++++++++---------------
 1 files changed, 38 insertions(+), 23 deletions(-)

diff --git a/pym/portage/util/env_update.py b/pym/portage/util/env_update.py
index 4c1fbf8..cf95467 100644
--- a/pym/portage/util/env_update.py
+++ b/pym/portage/util/env_update.py
@@ -194,20 +194,35 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env,
 			myfd.write(x + "\n")
 		myfd.close()
 
+	potential_lib_dirs = set()
+	for lib_dir_glob in ('usr/lib*', 'lib*'):
+		x = os.path.join(eroot, lib_dir_glob)
+		for y in glob.glob(_unicode_encode(x,
+			encoding=_encodings['fs'], errors='strict')):
+			try:
+				y = _unicode_decode(y,
+					encoding=_encodings['fs'], errors='strict')
+			except UnicodeDecodeError:
+				continue
+			if os.path.basename(y) != 'libexec':
+				potential_lib_dirs.add(y[len(eroot):])
+
 	# Update prelink.conf if we are prelink-enabled
 	if prelink_capable:
-		newprelink = atomic_ofstream(os.path.join(
-			eroot, "etc", "prelink.conf"))
+		prelink_d = os.path.join(eroot, 'etc', 'prelink.conf.d')
+		if not os.path.isdir(prelink_d):
+			os.makedirs(prelink_d)
+		newprelink = atomic_ofstream(os.path.join(prelink_d, 'portage.conf'))
 		newprelink.write("# prelink.conf autogenerated by env-update; make all changes to\n")
 		newprelink.write("# contents of /etc/env.d directory\n")
 
-		for x in ["/bin","/sbin","/usr/bin","/usr/sbin","/lib","/usr/lib"]:
-			newprelink.write("-l %s\n" % (x,));
-		prelink_paths = []
-		prelink_paths += specials.get("LDPATH", [])
-		prelink_paths += specials.get("PATH", [])
-		prelink_paths += specials.get("PRELINK_PATH", [])
-		prelink_path_mask = specials.get("PRELINK_PATH_MASK", [])
+		for x in sorted(potential_lib_dirs) + ['bin', 'sbin']:
+			newprelink.write('-l /%s\n' % (x,));
+		prelink_paths = set()
+		prelink_paths |= set(specials.get('LDPATH', []))
+		prelink_paths |= set(specials.get('PATH', []))
+		prelink_paths |= set(specials.get('PRELINK_PATH', []))
+		prelink_path_mask = specials.get('PRELINK_PATH_MASK', [])
 		for x in prelink_paths:
 			if not x:
 				continue
@@ -228,24 +243,24 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env,
 			newprelink.write("-b %s\n" % (x,))
 		newprelink.close()
 
+		# Migration code path.  If /etc/prelink.conf was generated by us, then
+		# point it to the new stuff until the prelink package re-installs.
+		prelink_conf = os.path.join(eroot, 'etc', 'prelink.conf')
+		try:
+			with open(prelink_conf, 'rb') as f:
+				if f.readline() == b'# prelink.conf autogenerated by env-update; make all changes to\n':
+					f = atomic_ofstream(prelink_conf)
+					f.write('-c /etc/prelink.conf.d/*.conf\n')
+					f.close()
+		except IOError as e:
+			if e.errno != errno.ENOENT:
+				raise
+
 	current_time = long(time.time())
 	mtime_changed = False
 
-	potential_lib_dirs = []
-	for lib_dir_glob in ['usr/lib*', 'lib*']:
-		x = os.path.join(eroot, lib_dir_glob)
-		for y in glob.glob(_unicode_encode(x,
-			encoding=_encodings['fs'], errors='strict')):
-			try:
-				y = _unicode_decode(y,
-					encoding=_encodings['fs'], errors='strict')
-			except UnicodeDecodeError:
-				continue
-			if os.path.basename(y) != "libexec":
-				potential_lib_dirs.append(y[len(eroot):])
-
 	lib_dirs = set()
-	for lib_dir in set(specials["LDPATH"] + potential_lib_dirs):
+	for lib_dir in set(specials['LDPATH']) | potential_lib_dirs:
 		x = os.path.join(eroot, lib_dir.lstrip(os.sep))
 		try:
 			newldpathtime = os.stat(x)[stat.ST_MTIME]


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2013-04-16 14:01 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2013-04-16 14:01 UTC (permalink / raw
  To: gentoo-commits

commit:     4d9c8b5ca0a7c13066b3e08ed6700cbd0939ec72
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 16 14:00:45 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Apr 16 14:00:45 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=4d9c8b5c

movefile: remove source symlink/hardlink after mv

---
 pym/portage/util/movefile.py |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index 8a7a2b6..f33e67c 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -224,6 +224,12 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 					target != os.readlink(dest):
 					raise
 			lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID])
+
+			try:
+				_os.unlink(src_bytes)
+			except OSError:
+				pass
+
 			if sys.hexversion >= 0x3030000:
 				try:
 					os.utime(dest, ns=(sstat.st_mtime_ns, sstat.st_mtime_ns), follow_symlinks=False)
@@ -277,6 +283,10 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 					writemsg("!!! %s\n" % (e,), noiselevel=-1)
 					return None
 				hardlinked = True
+				try:
+					_os.unlink(src_bytes)
+				except OSError:
+					pass
 				break
 
 	renamefailed=1


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2013-03-27 15:02 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2013-03-27 15:02 UTC (permalink / raw
  To: gentoo-commits

commit:     284ec5d603c713509534fe6230964decf8a7468a
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 27 15:02:12 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Mar 27 15:02:12 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=284ec5d6

getconfig: handle recursive PermissionDenied

---
 pym/portage/util/__init__.py |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 59d4fa4..7c16b7b 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -564,6 +564,18 @@ _invalid_var_name_re = re.compile(r'^\d|\W')
 def getconfig(mycfg, tolerant=False, allow_sourcing=False, expand=True,
 	recursive=False):
 
+	is_dir = False
+	if recursive:
+		try:
+			is_dir = stat.S_ISDIR(os.stat(mycfg).st_mode)
+		except OSError as e:
+			if e.errno == PermissionDenied.errno:
+				raise PermissionDenied(mycfg)
+			elif e.errno in (errno.ENOENT, errno.ESTALE, errno.EISDIR):
+				return None
+			else:
+				raise
+
 	if isinstance(expand, dict):
 		# Some existing variable definitions have been
 		# passed in, for use in substitutions.
@@ -573,11 +585,15 @@ def getconfig(mycfg, tolerant=False, allow_sourcing=False, expand=True,
 		expand_map = {}
 	mykeys = {}
 
-	if recursive and os.path.isdir(mycfg):
-		# Use source commands so that syntax error messages
+	if recursive and is_dir:
+		# Emulate source commands so that syntax error messages
 		# can display real file names and line numbers.
+		def onerror(e):
+			if e.errno == PermissionDenied.errno:
+				raise PermissionDenied(mycfg)
+
 		recursive_files = []
-		for parent, dirs, files in os.walk(mycfg):
+		for parent, dirs, files in os.walk(mycfg, onerror=onerror):
 			try:
 				parent = _unicode_decode(parent,
 					encoding=_encodings['fs'], errors='strict')


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2013-03-19  8:00 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2013-03-19  8:00 UTC (permalink / raw
  To: gentoo-commits

commit:     21dacb02653dab1eccd962dd44e79c5cb1b674fb
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 19 08:00:00 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Mar 19 08:00:00 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=21dacb02

append_repo: use Atom.with_repo()

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

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 5c5e113..dafc3e3 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -253,10 +253,10 @@ def append_repo(atom_list, repo_name, remember_source_file=False):
 	If an atom already has a repo part, then it is preserved (see bug #461948).
 	"""
 	if remember_source_file:
-		return [(atom.repo is not None and atom or Atom(atom + "::" + repo_name, allow_wildcard=True, allow_repo=True), source) \
+		return [(atom.repo is not None and atom or atom.with_repo(repo_name), source) \
 			for atom, source in atom_list]
 	else:
-		return [atom.repo is not None and atom or Atom(atom + "::" + repo_name, allow_wildcard=True, allow_repo=True) \
+		return [atom.repo is not None and atom or atom.with_repo(repo_name) \
 			for atom in atom_list]
 
 def stack_lists(lists, incremental=1, remember_source_file=False,


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2013-03-19  6:38 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2013-03-19  6:38 UTC (permalink / raw
  To: gentoo-commits

commit:     05eac1c00d668fd8f36e8dabc656eaa3cdeabdcf
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 19 06:37:52 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Mar 19 06:37:52 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=05eac1c0

append_repo: preserve existing repo atom

This will fix bug #461948.

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

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 1736ad6..5c5e113 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -250,12 +250,13 @@ def stack_dicts(dicts, incremental=0, incrementals=[], ignore_none=0):
 def append_repo(atom_list, repo_name, remember_source_file=False):
 	"""
 	Takes a list of valid atoms without repo spec and appends ::repo_name.
+	If an atom already has a repo part, then it is preserved (see bug #461948).
 	"""
 	if remember_source_file:
-		return [(Atom(atom + "::" + repo_name, allow_wildcard=True, allow_repo=True), source) \
+		return [(atom.repo is not None and atom or Atom(atom + "::" + repo_name, allow_wildcard=True, allow_repo=True), source) \
 			for atom, source in atom_list]
 	else:
-		return [Atom(atom + "::" + repo_name, allow_wildcard=True, allow_repo=True) \
+		return [atom.repo is not None and atom or Atom(atom + "::" + repo_name, allow_wildcard=True, allow_repo=True) \
 			for atom in atom_list]
 
 def stack_lists(lists, incremental=1, remember_source_file=False,


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2013-03-19  6:22 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2013-03-19  6:22 UTC (permalink / raw
  To: gentoo-commits

commit:     3856debfede50480eb1308365d157285dfa178d8
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 19 06:22:32 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Mar 19 06:22:32 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3856debf

cmp_sort_key: reference functools.cmp_to_key()

---
 pym/portage/util/__init__.py |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 3287569..1736ad6 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -848,6 +848,9 @@ class cmp_sort_key(object):
 	list.sort(), making it easier to port code for python-3.0 compatibility.
 	It works by generating key objects which use the given cmp function to
 	implement their __lt__ method.
+
+	Beginning with Python 2.7 and 3.2, equivalent functionality is provided
+	by functools.cmp_to_key().
 	"""
 	__slots__ = ("_cmp_func",)
 


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2013-03-19  5:56 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2013-03-19  5:56 UTC (permalink / raw
  To: gentoo-commits

commit:     4b0248e3f3110f52222fffab67dac12f06b0cd66
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 19 05:55:57 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Mar 19 05:55:57 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=4b0248e3

grabfile_package: unicode(), not str() for py2

---
 pym/portage/util/__init__.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 5085a8b..3287569 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -46,6 +46,11 @@ from portage.localization import _
 from portage.proxy.objectproxy import ObjectProxy
 from portage.cache.mappings import UserDict
 
+if sys.hexversion >= 0x3000000:
+	_unicode = str
+else:
+	_unicode = unicode
+
 noiselimit = 0
 
 def initialize_logger(level=logging.WARN):
@@ -463,7 +468,7 @@ def grabfile_package(myfilename, compatlevel=0, recursive=0, allow_wildcard=Fals
 			writemsg(_("--- Invalid atom in %s: %s\n") % (source_file, e),
 				noiselevel=-1)
 		else:
-			if pkg_orig == str(pkg):
+			if pkg_orig == _unicode(pkg):
 				# normal atom, so return as Atom instance
 				if remember_source_file:
 					atoms.append((pkg, source_file))


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2013-01-10 14:47 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2013-01-10 14:47 UTC (permalink / raw
  To: gentoo-commits

commit:     8451f343034831bfc8dd06dd55fbce40b320882c
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 10 14:41:15 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Jan 10 14:41:15 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=8451f343

Revert "_ctypes: don't cache library, bug #448858"

This reverts commit 9e37cca4f54260bd8c45a3041fcee00938c71649.
As noted in bug #448858, comment #14, dlclose is not called
automatically, so we may as well cache our library handles.
In order to protect ourselves, we use a fork since commit
7ebb2f54877edb28621c33e380f8777b1b1dc201.

---
 pym/portage/util/_ctypes.py |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/pym/portage/util/_ctypes.py b/pym/portage/util/_ctypes.py
index f419b19..4e5aa2a 100644
--- a/pym/portage/util/_ctypes.py
+++ b/pym/portage/util/_ctypes.py
@@ -31,15 +31,17 @@ def find_library(name):
 		return None
 	return filename
 
+_library_handles = {}
+
 def LoadLibrary(name):
 	"""
 	Calls ctypes.cdll.LoadLibrary(name) if the ctypes module is available,
-	and otherwise returns None. Results are not cached, since that can
-	cause problems when libraries are updated (see bug #448858).
+	and otherwise returns None. Results are cached for future invocations.
 	"""
-	handle = None
+	handle = _library_handles.get(name)
 
-	if ctypes is not None:
+	if handle is None and ctypes is not None:
 		handle = ctypes.cdll.LoadLibrary(name)
+		_library_handles[name] = handle
 
 	return handle


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-12-28 22:31 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-12-28 22:31 UTC (permalink / raw
  To: gentoo-commits

commit:     9e37cca4f54260bd8c45a3041fcee00938c71649
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 28 22:31:10 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Dec 28 22:31:10 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9e37cca4

_ctypes: don't cache library, bug #448858

---
 pym/portage/util/_ctypes.py |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/pym/portage/util/_ctypes.py b/pym/portage/util/_ctypes.py
index 4e5aa2a..f419b19 100644
--- a/pym/portage/util/_ctypes.py
+++ b/pym/portage/util/_ctypes.py
@@ -31,17 +31,15 @@ def find_library(name):
 		return None
 	return filename
 
-_library_handles = {}
-
 def LoadLibrary(name):
 	"""
 	Calls ctypes.cdll.LoadLibrary(name) if the ctypes module is available,
-	and otherwise returns None. Results are cached for future invocations.
+	and otherwise returns None. Results are not cached, since that can
+	cause problems when libraries are updated (see bug #448858).
 	"""
-	handle = _library_handles.get(name)
+	handle = None
 
-	if handle is None and ctypes is not None:
+	if ctypes is not None:
 		handle = ctypes.cdll.LoadLibrary(name)
-		_library_handles[name] = handle
 
 	return handle


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-11-30  2:10 Arfrever Frehtes Taifersar Arahesis
  0 siblings, 0 replies; 134+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2012-11-30  2:10 UTC (permalink / raw
  To: gentoo-commits

commit:     a9645e8b16eb693ad160a0ec21797c31eb5b09a0
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Fri Nov 30 02:09:00 2012 +0000
Commit:     Arfrever Frehtes Taifersar Arahesis <arfrever.fta <AT> gmail <DOT> com>
CommitDate: Fri Nov 30 02:09:00 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a9645e8b

portage.util.movefile.movefile(): Try to preserve mtime of symlinks with Python >=3.3.

---
 pym/portage/util/movefile.py |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index 98cf86a..57375f2 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -162,11 +162,17 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 					target != os.readlink(dest):
 					raise
 			lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID])
-			# utime() only works on the target of a symlink, so it's not
-			# possible to preserve mtime on symlinks.
 			if sys.hexversion >= 0x3030000:
-				return os.stat(dest, follow_symlinks=False).st_mtime_ns
+				try:
+					os.utime(dest, ns=(sstat.st_mtime_ns, sstat.st_mtime_ns), follow_symlinks=False)
+				except NotImplementedError:
+					# utimensat() and lutimes() missing in libc.
+					return os.stat(dest, follow_symlinks=False).st_mtime_ns
+				else:
+					return sstat.st_mtime_ns
 			else:
+				# utime() in Python <3.3 only works on the target of a symlink, so it's not
+				# possible to preserve mtime on symlinks.
 				return os.lstat(dest)[stat.ST_MTIME]
 		except SystemExit as e:
 			raise


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-11-29 20:32 Arfrever Frehtes Taifersar Arahesis
  0 siblings, 0 replies; 134+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2012-11-29 20:32 UTC (permalink / raw
  To: gentoo-commits

commit:     90abd1ee06f66fe094c87763e501a64be82915c5
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Thu Nov 29 20:30:35 2012 +0000
Commit:     Arfrever Frehtes Taifersar Arahesis <arfrever.fta <AT> gmail <DOT> com>
CommitDate: Thu Nov 29 20:30:35 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=90abd1ee

Fix return value of portage.util.movefile.movefile() for symlinks with Python >=3.3.

---
 pym/portage/util/movefile.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index b9c4183..98cf86a 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -163,8 +163,11 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 					raise
 			lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID])
 			# utime() only works on the target of a symlink, so it's not
-			# possible to perserve mtime on symlinks.
-			return os.lstat(dest)[stat.ST_MTIME]
+			# possible to preserve mtime on symlinks.
+			if sys.hexversion >= 0x3030000:
+				return os.stat(dest, follow_symlinks=False).st_mtime_ns
+			else:
+				return os.lstat(dest)[stat.ST_MTIME]
 		except SystemExit as e:
 			raise
 		except Exception as e:


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-11-15  3:41 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-11-15  3:41 UTC (permalink / raw
  To: gentoo-commits

commit:     bbbb9c8459dd51a564de16636d1246b585bf6733
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 15 03:41:15 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Nov 15 03:41:15 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=bbbb9c84

validate_desktop_entry: ignore Encoding key

See bug #443100.

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

diff --git a/pym/portage/util/_desktop_entry.py b/pym/portage/util/_desktop_entry.py
index 54b0950..24bf154 100644
--- a/pym/portage/util/_desktop_entry.py
+++ b/pym/portage/util/_desktop_entry.py
@@ -47,6 +47,7 @@ _ignored_errors = (
 		# Ignore error for emacs.desktop:
 		# https://bugs.freedesktop.org/show_bug.cgi?id=35844#c6
 		'error: (will be fatal in the future): value "TextEditor" in key "Categories" in group "Desktop Entry" requires another category to be present among the following categories: Utility',
+		'warning: key "Encoding" in group "Desktop Entry" is deprecated'
 )
 
 def validate_desktop_entry(path):


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-10-28 19:26 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-10-28 19:26 UTC (permalink / raw
  To: gentoo-commits

commit:     ad24e372f5059dc1d6688e0fd01fb4fdb38f2908
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 28 19:25:58 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Oct 28 19:25:58 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ad24e372

validate_desktop_entry: handle df-utils-0.21 hint

---
 pym/portage/util/_desktop_entry.py |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/pym/portage/util/_desktop_entry.py b/pym/portage/util/_desktop_entry.py
index 2973d12..54b0950 100644
--- a/pym/portage/util/_desktop_entry.py
+++ b/pym/portage/util/_desktop_entry.py
@@ -62,7 +62,9 @@ def validate_desktop_entry(path):
 	if output_lines:
 		filtered_output = []
 		for line in output_lines:
-			if line[len(path)+2:] in _ignored_errors:
+			msg = line[len(path)+2:]
+			# "hint:" output is new in desktop-file-utils-0.21
+			if msg.startswith('hint: ') or msg in _ignored_errors:
 				continue
 			filtered_output.append(line)
 		output_lines = filtered_output


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-10-25  8:35 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-10-25  8:35 UTC (permalink / raw
  To: gentoo-commits

commit:     978f3c6d514f0fcf9329d536cc43cf1230e23112
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 25 08:34:37 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Oct 25 08:34:37 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=978f3c6d

Add portage.util._ctypes module, for bug #439584.

---
 pym/portage/util/_ctypes.py |   47 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/pym/portage/util/_ctypes.py b/pym/portage/util/_ctypes.py
new file mode 100644
index 0000000..4e5aa2a
--- /dev/null
+++ b/pym/portage/util/_ctypes.py
@@ -0,0 +1,47 @@
+# Copyright 2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+try:
+	import ctypes
+	import ctypes.util
+except ImportError:
+	ctypes = None
+else:
+	try:
+		ctypes.cdll
+	except AttributeError:
+		ctypes = None
+
+_library_names = {}
+
+def find_library(name):
+	"""
+	Calls ctype.util.find_library() if the ctypes module is available,
+	and otherwise returns None. Results are cached for future invocations.
+	"""
+	filename = _library_names.get(name)
+	if filename is None:
+		if ctypes is not None:
+			filename = ctypes.util.find_library(name)
+			if filename is None:
+				filename = False
+			_library_names[name] = filename
+
+	if filename is False:
+		return None
+	return filename
+
+_library_handles = {}
+
+def LoadLibrary(name):
+	"""
+	Calls ctypes.cdll.LoadLibrary(name) if the ctypes module is available,
+	and otherwise returns None. Results are cached for future invocations.
+	"""
+	handle = _library_handles.get(name)
+
+	if handle is None and ctypes is not None:
+		handle = ctypes.cdll.LoadLibrary(name)
+		_library_handles[name] = handle
+
+	return handle


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-09-24  3:01 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-09-24  3:01 UTC (permalink / raw
  To: gentoo-commits

commit:     3cf984f540e99df61ae24246fe76ed56afb277aa
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 24 03:00:56 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Sep 24 03:00:56 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3cf984f5

env_update: use eroot variable more

---
 pym/portage/util/env_update.py |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/pym/portage/util/env_update.py b/pym/portage/util/env_update.py
index ac18ad2..4c1fbf8 100644
--- a/pym/portage/util/env_update.py
+++ b/pym/portage/util/env_update.py
@@ -90,7 +90,7 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env,
 	eprefix = settings.get("EPREFIX", "")
 	eprefix_lstrip = eprefix.lstrip(os.sep)
 	eroot = normalize_path(os.path.join(target_root, eprefix_lstrip)).rstrip(os.sep) + os.sep
-	envd_dir = os.path.join(target_root, eprefix_lstrip, "etc", "env.d")
+	envd_dir = os.path.join(eroot, "etc", "env.d")
 	ensure_dirs(envd_dir, mode=0o755)
 	fns = listdir(envd_dir, EmptyOnError=1)
 	fns.sort()
@@ -166,8 +166,7 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env,
 		they won't be overwritten by this dict.update call."""
 		env.update(myconfig)
 
-	ldsoconf_path = os.path.join(
-		target_root, eprefix_lstrip, "etc", "ld.so.conf")
+	ldsoconf_path = os.path.join(eroot, "etc", "ld.so.conf")
 	try:
 		myld = io.open(_unicode_encode(ldsoconf_path,
 			encoding=_encodings['fs'], errors='strict'),
@@ -198,7 +197,7 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env,
 	# Update prelink.conf if we are prelink-enabled
 	if prelink_capable:
 		newprelink = atomic_ofstream(os.path.join(
-			target_root, eprefix_lstrip, "etc", "prelink.conf"))
+			eroot, "etc", "prelink.conf"))
 		newprelink.write("# prelink.conf autogenerated by env-update; make all changes to\n")
 		newprelink.write("# contents of /etc/env.d directory\n")
 
@@ -234,7 +233,7 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env,
 
 	potential_lib_dirs = []
 	for lib_dir_glob in ['usr/lib*', 'lib*']:
-		x = os.path.join(target_root, eprefix_lstrip, lib_dir_glob)
+		x = os.path.join(eroot, lib_dir_glob)
 		for y in glob.glob(_unicode_encode(x,
 			encoding=_encodings['fs'], errors='strict')):
 			try:
@@ -247,7 +246,7 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env,
 
 	lib_dirs = set()
 	for lib_dir in set(specials["LDPATH"] + potential_lib_dirs):
-		x = os.path.join(target_root, eprefix_lstrip, lib_dir.lstrip(os.sep))
+		x = os.path.join(eroot, lib_dir.lstrip(os.sep))
 		try:
 			newldpathtime = os.stat(x)[stat.ST_MTIME]
 			lib_dirs.add(normalize_path(x))
@@ -323,8 +322,7 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env,
 	cenvnotice += "# GO INTO /etc/csh.cshrc NOT /etc/csh.env\n\n"
 
 	#create /etc/profile.env for bash support
-	outfile = atomic_ofstream(os.path.join(
-		target_root, eprefix_lstrip, "etc", "profile.env"))
+	outfile = atomic_ofstream(os.path.join(eroot, "etc", "profile.env"))
 	outfile.write(penvnotice)
 
 	env_keys = [ x for x in env if x != "LDPATH" ]
@@ -338,8 +336,7 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env,
 	outfile.close()
 
 	#create /etc/csh.env for (t)csh support
-	outfile = atomic_ofstream(os.path.join(
-		target_root, eprefix_lstrip, "etc", "csh.env"))
+	outfile = atomic_ofstream(os.path.join(eroot, "etc", "csh.env"))
 	outfile.write(cenvnotice)
 	for x in env_keys:
 		outfile.write("setenv %s '%s'\n" % (x, env[x]))


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-09-24  2:25 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-09-24  2:25 UTC (permalink / raw
  To: gentoo-commits

commit:     1a189611ef19a624f3d180d184faa5fcef17e7bf
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 24 02:25:02 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Sep 24 02:25:02 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1a189611

env_update: scan all dirs starting with "lib"

Also see bug #435834 and commit
7fb9758506341ffc05585fbd18f2be58ef0e16c2.

---
 pym/portage/util/env_update.py |   23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/pym/portage/util/env_update.py b/pym/portage/util/env_update.py
index ace4077..ac18ad2 100644
--- a/pym/portage/util/env_update.py
+++ b/pym/portage/util/env_update.py
@@ -1,16 +1,17 @@
-# Copyright 2010-2011 Gentoo Foundation
+# Copyright 2010-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 __all__ = ['env_update']
 
 import errno
+import glob
 import io
 import stat
 import sys
 import time
 
 import portage
-from portage import os, _encodings, _unicode_encode
+from portage import os, _encodings, _unicode_decode, _unicode_encode
 from portage.checksum import prelink_capable
 from portage.data import ostype
 from portage.exception import ParseError
@@ -88,6 +89,7 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env,
 
 	eprefix = settings.get("EPREFIX", "")
 	eprefix_lstrip = eprefix.lstrip(os.sep)
+	eroot = normalize_path(os.path.join(target_root, eprefix_lstrip)).rstrip(os.sep) + os.sep
 	envd_dir = os.path.join(target_root, eprefix_lstrip, "etc", "env.d")
 	ensure_dirs(envd_dir, mode=0o755)
 	fns = listdir(envd_dir, EmptyOnError=1)
@@ -229,9 +231,22 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env,
 
 	current_time = long(time.time())
 	mtime_changed = False
+
+	potential_lib_dirs = []
+	for lib_dir_glob in ['usr/lib*', 'lib*']:
+		x = os.path.join(target_root, eprefix_lstrip, lib_dir_glob)
+		for y in glob.glob(_unicode_encode(x,
+			encoding=_encodings['fs'], errors='strict')):
+			try:
+				y = _unicode_decode(y,
+					encoding=_encodings['fs'], errors='strict')
+			except UnicodeDecodeError:
+				continue
+			if os.path.basename(y) != "libexec":
+				potential_lib_dirs.append(y[len(eroot):])
+
 	lib_dirs = set()
-	for lib_dir in set(specials["LDPATH"] + \
-		['usr/lib','usr/lib64','usr/lib32','lib','lib64','lib32']):
+	for lib_dir in set(specials["LDPATH"] + potential_lib_dirs):
 		x = os.path.join(target_root, eprefix_lstrip, lib_dir.lstrip(os.sep))
 		try:
 			newldpathtime = os.stat(x)[stat.ST_MTIME]


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-09-13 18:40 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-09-13 18:40 UTC (permalink / raw
  To: gentoo-commits

commit:     32dda00da1d9d33c345896119a7e01fc840df265
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 13 18:40:22 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Sep 13 18:40:22 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=32dda00d

find_updated_config_files: x var name collision

This broke in commit 09de8dc47ec48af2276dfa098dd5e1d3d09ddbdd.

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

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index fee0bc7..e84958a 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -1624,8 +1624,8 @@ def find_updated_config_files(target_root, config_protect):
 			cmd = shlex_split(mycommand)
 			if sys.hexversion < 0x3000000 or sys.hexversion >= 0x3020000:
 				# Python 3.1 does not support bytes in Popen args.
-				cmd = [_unicode_encode(x, encoding=encoding, errors='strict')
-					for x in cmd]
+				cmd = [_unicode_encode(arg, encoding=encoding, errors='strict')
+					for arg in cmd]
 			proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
 				stderr=subprocess.STDOUT)
 			output = _unicode_decode(proc.communicate()[0], encoding=encoding)


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-09-03 19:51 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-09-03 19:51 UTC (permalink / raw
  To: gentoo-commits

commit:     04d156d56e1cf48f0d45d661c5e94e6863549fc2
Author:     Michael Palimaka <kensington <AT> gentoo <DOT> org>
AuthorDate: Mon Sep  3 15:08:36 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Sep  3 19:50:02 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=04d156d5

validate_desktop_entry: filter more KDE noise.

---
 pym/portage/util/_desktop_entry.py |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/pym/portage/util/_desktop_entry.py b/pym/portage/util/_desktop_entry.py
index bafac75..aa730de 100644
--- a/pym/portage/util/_desktop_entry.py
+++ b/pym/portage/util/_desktop_entry.py
@@ -44,13 +44,18 @@ def parse_desktop_entry(path):
 _trivial_warnings = re.compile(r' looks redundant with value ')
 _ignore_kde_key_re = re.compile(r'^\s*(configurationType\s*=|Type\s*=\s*Service)')
 _ignore_kde_types = frozenset(
-	["AkonadiAgent", "AkonadiResource", "Service", "ServiceType"])
+	["AkonadiAgent", "AkonadiResource", "Service", "ServiceType", "XSession"])
 
 # kdebase-data installs files with [Currency Code] sections
 # in /usr/share/locale/currency
 # kdepim-runtime installs files with [Plugin] and [Wizard]
 # sections in /usr/share/apps/akonadi/{plugins,accountwizard}
-_ignore_kde_sections = ("Currency Code", "Plugin", "Wizard")
+# kdm installs files with [KCM Locale], [KDE Desktop Pattern],
+# [KdmGreeterTheme] and [Wallpaper] sections in various directories
+# libkdegames installs files with [KDE Backdeck] sections in
+# /usr/share/apps/carddecks/
+# Various KDE games install files with [KGameTheme] sections
+_ignore_kde_sections = ("Currency Code", "KCM Locale", "KDE Backdeck", "KDE Desktop Pattern", "KDE Desktop Program", "KdmGreeterTheme", "KGameTheme", "Plugin", "Wallpaper", "Wizard")
 
 _ignored_errors = (
 		# Ignore error for emacs.desktop:


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-09-02 19:33 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-09-02 19:33 UTC (permalink / raw
  To: gentoo-commits

commit:     8a61c24952137ee10eac107c681cdc40f876ee33
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Sep  2 19:31:23 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Sep  2 19:33:13 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=8a61c249

validate_desktop_entry: handle emacs.desktop

See <https://bugs.freedesktop.org/show_bug.cgi?id=35844#c6>.

---
 pym/portage/util/_desktop_entry.py |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/pym/portage/util/_desktop_entry.py b/pym/portage/util/_desktop_entry.py
index deb0a35..bafac75 100644
--- a/pym/portage/util/_desktop_entry.py
+++ b/pym/portage/util/_desktop_entry.py
@@ -52,6 +52,12 @@ _ignore_kde_types = frozenset(
 # sections in /usr/share/apps/akonadi/{plugins,accountwizard}
 _ignore_kde_sections = ("Currency Code", "Plugin", "Wizard")
 
+_ignored_errors = (
+		# Ignore error for emacs.desktop:
+		# https://bugs.freedesktop.org/show_bug.cgi?id=35844#c6
+		'error: (will be fatal in the future): value "TextEditor" in key "Categories" in group "Desktop Entry" requires another category to be present among the following categories: Utility',
+)
+
 def validate_desktop_entry(path):
 	args = ["desktop-file-validate", path]
 	if sys.hexversion < 0x3000000 or sys.hexversion >= 0x3020000:
@@ -100,6 +106,14 @@ def validate_desktop_entry(path):
 					del output_lines[:]
 
 	if output_lines:
+		filtered_output = []
+		for line in output_lines:
+				if line[len(path)+2:] in _ignored_errors:
+					continue
+				filtered_output.append(line)
+		output_lines = filtered_output
+
+	if output_lines:
 		output_lines = [line for line in output_lines
 			if _trivial_warnings.search(line) is None]
 


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-09-02 19:31 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-09-02 19:31 UTC (permalink / raw
  To: gentoo-commits

commit:     4c87b98e82d7cf68b4eb91f3aa8c39ccf7eb481d
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Sep  2 19:31:23 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Sep  2 19:31:23 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=4c87b98e

validate_desktop_entry: handle emacs.desktop

See <https://bugs.freedesktop.org/show_bug.cgi?id=35844#c6>.

---
 pym/portage/util/_desktop_entry.py |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/pym/portage/util/_desktop_entry.py b/pym/portage/util/_desktop_entry.py
index deb0a35..803b0fc 100644
--- a/pym/portage/util/_desktop_entry.py
+++ b/pym/portage/util/_desktop_entry.py
@@ -52,6 +52,12 @@ _ignore_kde_types = frozenset(
 # sections in /usr/share/apps/akonadi/{plugins,accountwizard}
 _ignore_kde_sections = ("Currency Code", "Plugin", "Wizard")
 
+_ignored_errors = (
+		# Ignore error for emacs.desktop:
+		# https://bugs.freedesktop.org/show_bug.cgi?id=35844#c6
+       'error: (will be fatal in the future): value "TextEditor" in key "Categories" in group "Desktop Entry" requires another category to be present among the following categories: Utility',
+)
+
 def validate_desktop_entry(path):
 	args = ["desktop-file-validate", path]
 	if sys.hexversion < 0x3000000 or sys.hexversion >= 0x3020000:
@@ -100,6 +106,14 @@ def validate_desktop_entry(path):
 					del output_lines[:]
 
 	if output_lines:
+		filtered_output = []
+		for line in output_lines:
+				if line[len(path)+2:] in _ignored_errors:
+					continue
+				filtered_output.append(line)
+		output_lines = filtered_output
+
+	if output_lines:
 		output_lines = [line for line in output_lines
 			if _trivial_warnings.search(line) is None]
 


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-08-26 21:46 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-08-26 21:46 UTC (permalink / raw
  To: gentoo-commits

commit:     8c8dcc663f90f36a81437a711b086ec3bc5d3eef
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 26 21:45:05 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Aug 26 21:45:49 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=8c8dcc66

validate_desktop_entry: filter more kde noise

This will fix bug #432862.

---
 pym/portage/util/_desktop_entry.py |   60 +++++++++++++++++++++++++++--------
 1 files changed, 46 insertions(+), 14 deletions(-)

diff --git a/pym/portage/util/_desktop_entry.py b/pym/portage/util/_desktop_entry.py
index 8c760c0..deb0a35 100644
--- a/pym/portage/util/_desktop_entry.py
+++ b/pym/portage/util/_desktop_entry.py
@@ -2,6 +2,7 @@
 # Distributed under the terms of the GNU General Public License v2
 
 import io
+import re
 import subprocess
 import sys
 
@@ -11,6 +12,7 @@ except ImportError:
 	from ConfigParser import Error as ConfigParserError, RawConfigParser
 
 from portage import _encodings, _unicode_encode, _unicode_decode
+from portage.util import writemsg
 
 def parse_desktop_entry(path):
 	"""
@@ -39,11 +41,16 @@ def parse_desktop_entry(path):
 
 	return parser
 
-_ignored_service_errors = (
-	'error: required key "Name" in group "Desktop Entry" is not present',
-	'error: key "Actions" is present in group "Desktop Entry", but the type is "Service" while this key is only valid for type "Application"',
-	'error: key "MimeType" is present in group "Desktop Entry", but the type is "Service" while this key is only valid for type "Application"',
-)
+_trivial_warnings = re.compile(r' looks redundant with value ')
+_ignore_kde_key_re = re.compile(r'^\s*(configurationType\s*=|Type\s*=\s*Service)')
+_ignore_kde_types = frozenset(
+	["AkonadiAgent", "AkonadiResource", "Service", "ServiceType"])
+
+# kdebase-data installs files with [Currency Code] sections
+# in /usr/share/locale/currency
+# kdepim-runtime installs files with [Plugin] and [Wizard]
+# sections in /usr/share/apps/akonadi/{plugins,accountwizard}
+_ignore_kde_sections = ("Currency Code", "Plugin", "Wizard")
 
 def validate_desktop_entry(path):
 	args = ["desktop-file-validate", path]
@@ -56,10 +63,19 @@ def validate_desktop_entry(path):
 	proc.wait()
 
 	if output_lines:
+		# Ignore kde extensions for bug #414125 and bug #432862.
 		try:
 			desktop_entry = parse_desktop_entry(path)
 		except ConfigParserError:
-			pass
+			with io.open(_unicode_encode(path,
+				encoding=_encodings['fs'], errors='strict'),
+				mode='r', encoding=_encodings['repo.content'],
+				errors='replace') as f:
+				for line in f:
+					if _ignore_kde_key_re.match(line):
+						# Ignore kde extensions for bug #432862.
+						del output_lines[:]
+						break
 		else:
 			if desktop_entry.has_section("Desktop Entry"):
 				try:
@@ -67,13 +83,29 @@ def validate_desktop_entry(path):
 				except ConfigParserError:
 					pass
 				else:
-					if entry_type == "Service":
-						# Filter false errors for Type=Service (bug #414125).
-						filtered_output = []
-						for line in output_lines:
-							if line[len(path)+2:] in _ignored_service_errors:
-								continue
-							filtered_output.append(line)
-						output_lines = filtered_output
+					if entry_type in _ignore_kde_types:
+						del output_lines[:]
+				try:
+					desktop_entry.get("Desktop Entry", "Hidden")
+				except ConfigParserError:
+					pass
+				else:
+					# The "Hidden" key appears to be unique to special kde
+					# service files (which don't validate well), installed
+					# in /usr/share/kde4/services/ by packages like
+					# nepomuk-core and kurifilter-plugins.
+					del output_lines[:]
+			for section in _ignore_kde_sections:
+				if desktop_entry.has_section(section):
+					del output_lines[:]
+
+	if output_lines:
+		output_lines = [line for line in output_lines
+			if _trivial_warnings.search(line) is None]
 
 	return output_lines
+
+if __name__ == "__main__":
+	for arg in sys.argv[1:]:
+		for line in validate_desktop_entry(arg):
+			writemsg(line + "\n", noiselevel=-1)


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-08-04 19:27 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-08-04 19:27 UTC (permalink / raw
  To: gentoo-commits

commit:     15cd7fa067e68a4b4d2ba7989efa3deab5ce0e10
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Aug  4 19:26:25 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Aug  4 19:26:25 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=15cd7fa0

WhirlpoolAdd: raise TypeError if not bytes

---
 pym/portage/util/whirlpool.py |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/pym/portage/util/whirlpool.py b/pym/portage/util/whirlpool.py
index c696f6f..170ae73 100644
--- a/pym/portage/util/whirlpool.py
+++ b/pym/portage/util/whirlpool.py
@@ -639,6 +639,8 @@ def WhirlpoolInit(ctx):
     return
 
 def WhirlpoolAdd(source, sourceBits, ctx):
+    if not isinstance(source, bytes):
+        raise TypeError("Expected %s, got %s" % (bytes, type(source)))
     if sys.hexversion < 0x3000000:
         source = [ord(s)&0xff for s in source]
 


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-08-02 19:55 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-08-02 19:55 UTC (permalink / raw
  To: gentoo-commits

commit:     69a95739d34b9112a60774ede71eea1661b78f2d
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Aug  2 19:55:09 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Aug  2 19:55:09 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=69a95739

parse_desktop_entry: fix python3 bug #429544

---
 pym/portage/util/_desktop_entry.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/pym/portage/util/_desktop_entry.py b/pym/portage/util/_desktop_entry.py
index 7901780..8c760c0 100644
--- a/pym/portage/util/_desktop_entry.py
+++ b/pym/portage/util/_desktop_entry.py
@@ -31,7 +31,11 @@ def parse_desktop_entry(path):
 		encoding=_encodings['fs'], errors='strict'),
 		mode='r', encoding=_encodings['repo.content'],
 		errors='replace') as f:
-		read_file(f)
+		content = f.read()
+
+	# In Python 3.2, read_file does not support bytes in file names
+	# (see bug #429544), so use StringIO to hide the file name.
+	read_file(io.StringIO(content))
 
 	return parser
 


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-08-02  2:28 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-08-02  2:28 UTC (permalink / raw
  To: gentoo-commits

commit:     fbeb8101b20e232b2e8c55c9554b5fc9c5c72089
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Aug  2 02:28:01 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Aug  2 02:28:01 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=fbeb8101

_urlopen: fix python2 http password breakage

This broke in commit e06cb6d66db37ac7ab77acf65038b1f770c13c96 since
CompressedResponseProcessor did not include password auth support.

BUG: The if_modified_since parameter appears to be ignored when using
http password authentication.

---
 pym/portage/util/_urlopen.py |   40 +++++++++++-----------------------------
 1 files changed, 11 insertions(+), 29 deletions(-)

diff --git a/pym/portage/util/_urlopen.py b/pym/portage/util/_urlopen.py
index bcd8f7c..768ccb8 100644
--- a/pym/portage/util/_urlopen.py
+++ b/pym/portage/util/_urlopen.py
@@ -27,14 +27,20 @@ TIMESTAMP_TOLERANCE=5
 
 def urlopen(url, if_modified_since=None):
 	parse_result = urllib_parse.urlparse(url)
-	try:
-		if parse_result.scheme not in ("http", "https"):
-			return _urlopen(url)
+	if parse_result.scheme not in ("http", "https"):
+		return _urlopen(url)
+	else:
+		netloc = urllib_parse_splituser(parse_result.netloc)[1]
+		url = urllib_parse.urlunparse((parse_result.scheme, netloc, parse_result.path, parse_result.params, parse_result.query, parse_result.fragment))
+		password_manager = urllib_request.HTTPPasswordMgrWithDefaultRealm()
 		request = urllib_request.Request(url)
 		request.add_header('User-Agent', 'Gentoo Portage')
 		if if_modified_since:
 			request.add_header('If-Modified-Since', _timestamp_to_http(if_modified_since))
-		opener = urllib_request.build_opener(CompressedResponseProcessor)
+		if parse_result.username is not None:
+			password_manager.add_password(None, url, parse_result.username, parse_result.password)
+		auth_handler = CompressedResponseProcessor(password_manager)
+		opener = urllib_request.build_opener(auth_handler)
 		hdl = opener.open(request)
 		if hdl.headers.get('last-modified', ''):
 			try:
@@ -44,30 +50,6 @@ def urlopen(url, if_modified_since=None):
 				add_header = hdl.headers.addheader
 			add_header('timestamp', _http_to_timestamp(hdl.headers.get('last-modified')))
 		return hdl
-	except SystemExit:
-		raise
-	except Exception as e:
-		if hasattr(e, 'code') and e.code == 304: # HTTPError 304: not modified
-			raise
-		if sys.hexversion < 0x3000000:
-			raise
-		if parse_result.scheme not in ("http", "https") or \
-			not parse_result.username:
-			raise
-
-	return _new_urlopen(url)
-
-def _new_urlopen(url):
-	# This is experimental code for bug #413983.
-	parse_result = urllib_parse.urlparse(url)
-	netloc = urllib_parse_splituser(parse_result.netloc)[1]
-	url = urllib_parse.urlunparse((parse_result.scheme, netloc, parse_result.path, parse_result.params, parse_result.query, parse_result.fragment))
-	password_manager = urllib_request.HTTPPasswordMgrWithDefaultRealm()
-	if parse_result.username is not None:
-		password_manager.add_password(None, url, parse_result.username, parse_result.password)
-	auth_handler = urllib_request.HTTPBasicAuthHandler(password_manager)
-	opener = urllib_request.build_opener(auth_handler)
-	return opener.open(url)
 
 def _timestamp_to_http(timestamp):
 	dt = datetime.fromtimestamp(float(long(timestamp)+TIMESTAMP_TOLERANCE))
@@ -79,7 +61,7 @@ def _http_to_timestamp(http_datetime_string):
 	timestamp = mktime(tuple)
 	return str(long(timestamp))
 
-class CompressedResponseProcessor(urllib_request.BaseHandler):
+class CompressedResponseProcessor(urllib_request.HTTPBasicAuthHandler):
 	# Handler for compressed responses.
 
 	def http_request(self, req):


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-08-02  2:26 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-08-02  2:26 UTC (permalink / raw
  To: gentoo-commits

commit:     2b1ba77eb17629593ca5b8b2ed6c0f3841c43fb6
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Aug  2 02:26:18 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Aug  2 02:26:18 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2b1ba77e

_urlopen: fix python3 http password breakage

This broke in commit e06cb6d66db37ac7ab77acf65038b1f770c13c96 since
CompressedResponseProcessor did not include password auth support.

BUG: The if_modified_since parameter appears to be ignored when using
http password authentication.

---
 pym/portage/util/_urlopen.py |   40 +++++++++++-----------------------------
 1 files changed, 11 insertions(+), 29 deletions(-)

diff --git a/pym/portage/util/_urlopen.py b/pym/portage/util/_urlopen.py
index bcd8f7c..768ccb8 100644
--- a/pym/portage/util/_urlopen.py
+++ b/pym/portage/util/_urlopen.py
@@ -27,14 +27,20 @@ TIMESTAMP_TOLERANCE=5
 
 def urlopen(url, if_modified_since=None):
 	parse_result = urllib_parse.urlparse(url)
-	try:
-		if parse_result.scheme not in ("http", "https"):
-			return _urlopen(url)
+	if parse_result.scheme not in ("http", "https"):
+		return _urlopen(url)
+	else:
+		netloc = urllib_parse_splituser(parse_result.netloc)[1]
+		url = urllib_parse.urlunparse((parse_result.scheme, netloc, parse_result.path, parse_result.params, parse_result.query, parse_result.fragment))
+		password_manager = urllib_request.HTTPPasswordMgrWithDefaultRealm()
 		request = urllib_request.Request(url)
 		request.add_header('User-Agent', 'Gentoo Portage')
 		if if_modified_since:
 			request.add_header('If-Modified-Since', _timestamp_to_http(if_modified_since))
-		opener = urllib_request.build_opener(CompressedResponseProcessor)
+		if parse_result.username is not None:
+			password_manager.add_password(None, url, parse_result.username, parse_result.password)
+		auth_handler = CompressedResponseProcessor(password_manager)
+		opener = urllib_request.build_opener(auth_handler)
 		hdl = opener.open(request)
 		if hdl.headers.get('last-modified', ''):
 			try:
@@ -44,30 +50,6 @@ def urlopen(url, if_modified_since=None):
 				add_header = hdl.headers.addheader
 			add_header('timestamp', _http_to_timestamp(hdl.headers.get('last-modified')))
 		return hdl
-	except SystemExit:
-		raise
-	except Exception as e:
-		if hasattr(e, 'code') and e.code == 304: # HTTPError 304: not modified
-			raise
-		if sys.hexversion < 0x3000000:
-			raise
-		if parse_result.scheme not in ("http", "https") or \
-			not parse_result.username:
-			raise
-
-	return _new_urlopen(url)
-
-def _new_urlopen(url):
-	# This is experimental code for bug #413983.
-	parse_result = urllib_parse.urlparse(url)
-	netloc = urllib_parse_splituser(parse_result.netloc)[1]
-	url = urllib_parse.urlunparse((parse_result.scheme, netloc, parse_result.path, parse_result.params, parse_result.query, parse_result.fragment))
-	password_manager = urllib_request.HTTPPasswordMgrWithDefaultRealm()
-	if parse_result.username is not None:
-		password_manager.add_password(None, url, parse_result.username, parse_result.password)
-	auth_handler = urllib_request.HTTPBasicAuthHandler(password_manager)
-	opener = urllib_request.build_opener(auth_handler)
-	return opener.open(url)
 
 def _timestamp_to_http(timestamp):
 	dt = datetime.fromtimestamp(float(long(timestamp)+TIMESTAMP_TOLERANCE))
@@ -79,7 +61,7 @@ def _http_to_timestamp(http_datetime_string):
 	timestamp = mktime(tuple)
 	return str(long(timestamp))
 
-class CompressedResponseProcessor(urllib_request.BaseHandler):
+class CompressedResponseProcessor(urllib_request.HTTPBasicAuthHandler):
 	# Handler for compressed responses.
 
 	def http_request(self, req):


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-08-02  2:22 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-08-02  2:22 UTC (permalink / raw
  To: gentoo-commits

commit:     02940e7725e03f0fd23c6f957aa6c9cf3a35713a
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Aug  2 02:20:17 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Aug  2 02:20:17 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=02940e77

_urlopen: fix python3 http password breakage

This broke in commit e06cb6d66db37ac7ab77acf65038b1f770c13c96 since
CompressedResponseProcessor did not include password auth support.

---
 pym/portage/util/_urlopen.py |   40 +++++++++++-----------------------------
 1 files changed, 11 insertions(+), 29 deletions(-)

diff --git a/pym/portage/util/_urlopen.py b/pym/portage/util/_urlopen.py
index bcd8f7c..768ccb8 100644
--- a/pym/portage/util/_urlopen.py
+++ b/pym/portage/util/_urlopen.py
@@ -27,14 +27,20 @@ TIMESTAMP_TOLERANCE=5
 
 def urlopen(url, if_modified_since=None):
 	parse_result = urllib_parse.urlparse(url)
-	try:
-		if parse_result.scheme not in ("http", "https"):
-			return _urlopen(url)
+	if parse_result.scheme not in ("http", "https"):
+		return _urlopen(url)
+	else:
+		netloc = urllib_parse_splituser(parse_result.netloc)[1]
+		url = urllib_parse.urlunparse((parse_result.scheme, netloc, parse_result.path, parse_result.params, parse_result.query, parse_result.fragment))
+		password_manager = urllib_request.HTTPPasswordMgrWithDefaultRealm()
 		request = urllib_request.Request(url)
 		request.add_header('User-Agent', 'Gentoo Portage')
 		if if_modified_since:
 			request.add_header('If-Modified-Since', _timestamp_to_http(if_modified_since))
-		opener = urllib_request.build_opener(CompressedResponseProcessor)
+		if parse_result.username is not None:
+			password_manager.add_password(None, url, parse_result.username, parse_result.password)
+		auth_handler = CompressedResponseProcessor(password_manager)
+		opener = urllib_request.build_opener(auth_handler)
 		hdl = opener.open(request)
 		if hdl.headers.get('last-modified', ''):
 			try:
@@ -44,30 +50,6 @@ def urlopen(url, if_modified_since=None):
 				add_header = hdl.headers.addheader
 			add_header('timestamp', _http_to_timestamp(hdl.headers.get('last-modified')))
 		return hdl
-	except SystemExit:
-		raise
-	except Exception as e:
-		if hasattr(e, 'code') and e.code == 304: # HTTPError 304: not modified
-			raise
-		if sys.hexversion < 0x3000000:
-			raise
-		if parse_result.scheme not in ("http", "https") or \
-			not parse_result.username:
-			raise
-
-	return _new_urlopen(url)
-
-def _new_urlopen(url):
-	# This is experimental code for bug #413983.
-	parse_result = urllib_parse.urlparse(url)
-	netloc = urllib_parse_splituser(parse_result.netloc)[1]
-	url = urllib_parse.urlunparse((parse_result.scheme, netloc, parse_result.path, parse_result.params, parse_result.query, parse_result.fragment))
-	password_manager = urllib_request.HTTPPasswordMgrWithDefaultRealm()
-	if parse_result.username is not None:
-		password_manager.add_password(None, url, parse_result.username, parse_result.password)
-	auth_handler = urllib_request.HTTPBasicAuthHandler(password_manager)
-	opener = urllib_request.build_opener(auth_handler)
-	return opener.open(url)
 
 def _timestamp_to_http(timestamp):
 	dt = datetime.fromtimestamp(float(long(timestamp)+TIMESTAMP_TOLERANCE))
@@ -79,7 +61,7 @@ def _http_to_timestamp(http_datetime_string):
 	timestamp = mktime(tuple)
 	return str(long(timestamp))
 
-class CompressedResponseProcessor(urllib_request.BaseHandler):
+class CompressedResponseProcessor(urllib_request.HTTPBasicAuthHandler):
 	# Handler for compressed responses.
 
 	def http_request(self, req):


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-08-02  0:57 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-08-02  0:57 UTC (permalink / raw
  To: gentoo-commits

commit:     cbebf76d8e5666aad4984f87c2be83d474fe5a7e
Author:     W-Mark Kubacki <wmark <AT> hurrikane <DOT> de>
AuthorDate: Wed Aug  1 18:36:31 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Aug  2 00:54:15 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=cbebf76d

Add support for HTTP compression (bzip2, gzip and deflate).

---
 pym/portage/util/_urlopen.py |   32 +++++++++++++++++++++++++++++++-
 1 files changed, 31 insertions(+), 1 deletions(-)

diff --git a/pym/portage/util/_urlopen.py b/pym/portage/util/_urlopen.py
index 4296188..bcd8f7c 100644
--- a/pym/portage/util/_urlopen.py
+++ b/pym/portage/util/_urlopen.py
@@ -1,6 +1,7 @@
 # Copyright 2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
+import io
 import sys
 from datetime import datetime
 from time import mktime
@@ -33,7 +34,7 @@ def urlopen(url, if_modified_since=None):
 		request.add_header('User-Agent', 'Gentoo Portage')
 		if if_modified_since:
 			request.add_header('If-Modified-Since', _timestamp_to_http(if_modified_since))
-		opener = urllib_request.build_opener()
+		opener = urllib_request.build_opener(CompressedResponseProcessor)
 		hdl = opener.open(request)
 		if hdl.headers.get('last-modified', ''):
 			try:
@@ -77,3 +78,32 @@ def _http_to_timestamp(http_datetime_string):
 	tuple = parsedate(http_datetime_string)
 	timestamp = mktime(tuple)
 	return str(long(timestamp))
+
+class CompressedResponseProcessor(urllib_request.BaseHandler):
+	# Handler for compressed responses.
+
+	def http_request(self, req):
+		req.add_header('Accept-Encoding', 'bzip2,gzip,deflate')
+		return req
+	https_request = http_request
+
+	def http_response(self, req, response):
+		decompressed = None
+		if response.headers.get('content-encoding') == 'bzip2':
+			import bz2
+			decompressed = io.BytesIO(bz2.decompress(response.read()))
+		elif response.headers.get('content-encoding') == 'gzip':
+			from gzip import GzipFile
+			decompressed = GzipFile(fileobj=io.BytesIO(response.read()), mode='r')
+		elif response.headers.get('content-encoding') == 'deflate':
+			import zlib
+			try:
+				decompressed = io.BytesIO(zlib.decompress(response.read()))
+			except zlib.error: # they ignored RFC1950
+				decompressed = io.BytesIO(zlib.decompress(response.read(), -zlib.MAX_WBITS))
+		if decompressed:
+			old_response = response
+			response = urllib_request.addinfourl(decompressed, old_response.headers, old_response.url, old_response.code)
+			response.msg = old_response.msg
+		return response
+	https_response = http_response


^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-06-17 15:22 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-06-17 15:22 UTC (permalink / raw
  To: gentoo-commits

commit:     a4ea52918c3cccaf2459fa2264ab0219071de70a
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 17 15:22:00 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Jun 17 15:22:00 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a4ea5291

grabfile_package: show real file name in error

---
 pym/portage/util/__init__.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 4ffd599..4645be5 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -447,7 +447,7 @@ def grabfile_package(myfilename, compatlevel=0, recursive=0, allow_wildcard=Fals
 		try:
 			pkg = Atom(pkg, allow_wildcard=allow_wildcard, allow_repo=allow_repo, eapi=eapi)
 		except InvalidAtom as e:
-			writemsg(_("--- Invalid atom in %s: %s\n") % (myfilename, e),
+			writemsg(_("--- Invalid atom in %s: %s\n") % (source_file, e),
 				noiselevel=-1)
 		else:
 			if pkg_orig == str(pkg):



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-06-01 21:30 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-06-01 21:30 UTC (permalink / raw
  To: gentoo-commits

commit:     9ed7bf27424890320b933e5d913804738d358bf1
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  1 21:30:37 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Jun  1 21:30:37 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9ed7bf27

grablines: raise PermissionDenied if appropriate

---
 pym/portage/util/__init__.py |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 2e0a32b..4ffd599 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -469,7 +469,15 @@ def grablines(myfilename, recursive=0, remember_source_file=False):
 	if recursive and os.path.isdir(myfilename):
 		if os.path.basename(myfilename) in _ignorecvs_dirs:
 			return mylines
-		dirlist = os.listdir(myfilename)
+		try:
+			dirlist = os.listdir(myfilename)
+		except OSError as e:
+			if e.errno == PermissionDenied.errno:
+				raise PermissionDenied(myfilename)
+			elif e.errno in (errno.ENOENT, errno.ESTALE):
+				return mylines
+			else:
+				raise
 		dirlist.sort()
 		for f in dirlist:
 			if not f.startswith(".") and not f.endswith("~"):
@@ -488,7 +496,10 @@ def grablines(myfilename, recursive=0, remember_source_file=False):
 		except IOError as e:
 			if e.errno == PermissionDenied.errno:
 				raise PermissionDenied(myfilename)
-			pass
+			elif e.errno in (errno.ENOENT, errno.ESTALE):
+				pass
+			else:
+				raise
 	return mylines
 
 def writedict(mydict,myfilename,writekey=True):



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-05-17 20:21 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-05-17 20:21 UTC (permalink / raw
  To: gentoo-commits

commit:     75d5e44211e997dbba91307f27c12f9c83579299
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu May 17 20:20:48 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 17 20:20:48 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=75d5e442

movefile: fix abs symlink adjustment, bug #416431

---
 pym/portage/util/movefile.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index 5ffd16b..10577b5 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -141,9 +141,9 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 	if stat.S_ISLNK(sstat[stat.ST_MODE]):
 		try:
 			target=os.readlink(src)
-			if mysettings and mysettings["D"]:
-				if target.find(mysettings["D"])==0:
-					target=target[len(mysettings["D"]):]
+			if mysettings and "D" in mysettings and \
+				target.startswith(mysettings["D"]):
+				target = target[len(mysettings["D"])-1:]
 			if destexists and not stat.S_ISDIR(dstat[stat.ST_MODE]):
 				os.unlink(dest)
 			try:



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-05-16 23:58 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-05-16 23:58 UTC (permalink / raw
  To: gentoo-commits

commit:     40160122bee77d1c34ed05157546c9d72eadd368
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed May 16 23:57:58 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed May 16 23:57:58 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=40160122

getconfig: only raise ParseError

---
 pym/portage/util/__init__.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 4797f53..2e0a32b 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -607,7 +607,7 @@ def getconfig(mycfg, tolerant=0, allow_sourcing=False, expand=True):
 				msg = lex.error_leader() + \
 					_("Invalid token '%s' (not '=')") % (equ,)
 				if not tolerant:
-					raise Exception(msg)
+					raise ParseError(msg)
 				else:
 					writemsg("%s\n" % msg, noiselevel=-1)
 					return mykeys



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-05-16  0:07 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-05-16  0:07 UTC (permalink / raw
  To: gentoo-commits

commit:     aa109884a0168656c3548cc90ca5a4854f3928c2
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed May 16 00:06:38 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed May 16 00:06:38 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=aa109884

getconfig: use shlex.error_leader() more

This fixes it to show the correct file/line, even when one file sources
another.

---
 pym/portage/util/__init__.py |   45 +++++++++++++++++++++--------------------
 1 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 57e8c37..4797f53 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -41,7 +41,7 @@ from portage import _os_merge
 from portage import _unicode_encode
 from portage import _unicode_decode
 from portage.exception import InvalidAtom, PortageException, FileNotFound, \
-       OperationNotPermitted, PermissionDenied, ReadOnlyFileSystem
+       OperationNotPermitted, ParseError, PermissionDenied, ReadOnlyFileSystem
 from portage.localization import _
 from portage.proxy.objectproxy import ObjectProxy
 from portage.cache.mappings import UserDict
@@ -573,6 +573,7 @@ def getconfig(mycfg, tolerant=0, allow_sourcing=False, expand=True):
 		writemsg(("!!! " + _("Please use dos2unix to convert line endings " + \
 			"in config file: '%s'") + "\n") % mycfg, noiselevel=-1)
 
+	lex = None
 	try:
 		if tolerant:
 			shlex_class = _tolerant_shlex
@@ -596,43 +597,38 @@ def getconfig(mycfg, tolerant=0, allow_sourcing=False, expand=True):
 				break;
 			equ=lex.get_token()
 			if (equ==''):
-				#unexpected end of file
-				#lex.error_leader(self.filename,lex.lineno)
+				msg = lex.error_leader() + _("Unexpected EOF")
 				if not tolerant:
-					writemsg(_("!!! Unexpected end of config file: variable %s\n") % key,
-						noiselevel=-1)
-					raise Exception(_("ParseError: Unexpected EOF: %s: on/before line %s") % (mycfg, lex.lineno))
+					raise ParseError(msg)
 				else:
+					writemsg("%s\n" % msg, noiselevel=-1)
 					return mykeys
 			elif (equ!='='):
-				#invalid token
-				#lex.error_leader(self.filename,lex.lineno)
+				msg = lex.error_leader() + \
+					_("Invalid token '%s' (not '=')") % (equ,)
 				if not tolerant:
-					raise Exception(_("ParseError: Invalid token "
-						"'%s' (not '='): %s: line %s") % \
-						(equ, mycfg, lex.lineno))
+					raise Exception(msg)
 				else:
+					writemsg("%s\n" % msg, noiselevel=-1)
 					return mykeys
 			val=lex.get_token()
 			if val is None:
-				#unexpected end of file
-				#lex.error_leader(self.filename,lex.lineno)
+				msg = lex.error_leader() + \
+					_("Unexpected end of config file: variable '%s'") % (key,)
 				if not tolerant:
-					writemsg(_("!!! Unexpected end of config file: variable %s\n") % key,
-						noiselevel=-1)
-					raise portage.exception.CorruptionError(_("ParseError: Unexpected EOF: %s: line %s") % (mycfg, lex.lineno))
+					raise ParseError(msg)
 				else:
+					writemsg("%s\n" % msg, noiselevel=-1)
 					return mykeys
 			key = _unicode_decode(key)
 			val = _unicode_decode(val)
 
 			if _invalid_var_name_re.search(key) is not None:
+				msg = lex.error_leader() + \
+					_("Invalid variable name '%s'") % (key,)
 				if not tolerant:
-					raise Exception(_(
-						"ParseError: Invalid variable name '%s': line %s") % \
-						(key, lex.lineno - 1))
-				writemsg(_("!!! Invalid variable name '%s': line %s in %s\n") \
-					% (key, lex.lineno - 1, mycfg), noiselevel=-1)
+					raise ParseError(msg)
+				writemsg("%s\n" % msg, noiselevel=-1)
 				continue
 
 			if expand:
@@ -644,7 +640,12 @@ def getconfig(mycfg, tolerant=0, allow_sourcing=False, expand=True):
 	except SystemExit as e:
 		raise
 	except Exception as e:
-		raise portage.exception.ParseError(str(e)+" in "+mycfg)
+		if isinstance(e, ParseError) or lex is None:
+			raise
+		msg = _unicode_decode("%s%s") % (lex.error_leader(), e)
+		writemsg("%s\n" % msg, noiselevel=-1)
+		raise
+
 	return mykeys
 
 _varexpand_word_chars = frozenset(string.ascii_letters + string.digits + "_")



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-05-01 21:21 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-05-01 21:21 UTC (permalink / raw
  To: gentoo-commits

commit:     09bdb69ac31146cbb3f258118a1aea0744b96379
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue May  1 21:21:44 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue May  1 21:21:44 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=09bdb69a

validate_desktop_entry: handle Python 3.1

---
 pym/portage/util/_desktop_entry.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/pym/portage/util/_desktop_entry.py b/pym/portage/util/_desktop_entry.py
index 101965f..7901780 100644
--- a/pym/portage/util/_desktop_entry.py
+++ b/pym/portage/util/_desktop_entry.py
@@ -3,6 +3,7 @@
 
 import io
 import subprocess
+import sys
 
 try:
 	from configparser import Error as ConfigParserError, RawConfigParser
@@ -41,7 +42,11 @@ _ignored_service_errors = (
 )
 
 def validate_desktop_entry(path):
-	proc = subprocess.Popen([b"desktop-file-validate", _unicode_encode(path)],
+	args = ["desktop-file-validate", path]
+	if sys.hexversion < 0x3000000 or sys.hexversion >= 0x3020000:
+		# Python 3.1 does not support bytes in Popen args.
+		args = [_unicode_encode(x, errors='strict') for x in args]
+	proc = subprocess.Popen(args,
 		stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
 	output_lines = _unicode_decode(proc.communicate()[0]).splitlines()
 	proc.wait()



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-03-31 23:19 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-03-31 23:19 UTC (permalink / raw
  To: gentoo-commits

commit:     fba4880f560a03e52857af53c722b6b2138da732
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 31 23:19:04 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Mar 31 23:19:04 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=fba4880f

varexpand: optimize access to current char

---
 pym/portage/util/__init__.py |   47 +++++++++++++++++++++++++-----------------
 1 files changed, 28 insertions(+), 19 deletions(-)

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 3e7187c..d6ac46c 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -660,14 +660,15 @@ def varexpand(mystring, mydict=None, error_leader=None):
 	This would be a good bunch of code to port to C.
 	"""
 	numvars=0
-	mystring=" "+mystring
 	#in single, double quotes
 	insing=0
 	indoub=0
-	pos=1
+	pos = 0
+	length = len(mystring)
 	newstring = []
-	while (pos<len(mystring)):
-		if (mystring[pos]=="'") and (mystring[pos-1]!="\\"):
+	while pos < length:
+		current = mystring[pos]
+		if current == "'":
 			if (indoub):
 				newstring.append("'")
 			else:
@@ -675,7 +676,7 @@ def varexpand(mystring, mydict=None, error_leader=None):
 				insing=not insing
 			pos=pos+1
 			continue
-		elif (mystring[pos]=='"') and (mystring[pos-1]!="\\"):
+		elif current == '"':
 			if (insing):
 				newstring.append('"')
 			else:
@@ -685,11 +686,11 @@ def varexpand(mystring, mydict=None, error_leader=None):
 			continue
 		if (not insing): 
 			#expansion time
-			if (mystring[pos]=="\n"):
+			if current == "\n":
 				#convert newlines to spaces
 				newstring.append(" ")
-				pos=pos+1
-			elif (mystring[pos]=="\\"):
+				pos += 1
+			elif current == "\\":
 				# For backslash expansion, this function used to behave like
 				# echo -e, but that's not needed for our purposes. We want to
 				# behave like bash does when expanding a variable assignment
@@ -699,19 +700,27 @@ def varexpand(mystring, mydict=None, error_leader=None):
 				# escaped quotes here, since getconfig() uses shlex
 				# to handle that earlier.
 				if (pos+1>=len(mystring)):
-					newstring.append(mystring[pos])
+					newstring.append(current)
 					break
 				else:
-					a = mystring[pos + 1]
-					pos = pos + 2
-					if a in ("\\", "$"):
-						newstring.append(a)
-					elif a == "\n":
+					current = mystring[pos + 1]
+					pos += 2
+					if current == "$":
+						newstring.append(current)
+					elif current == "\\":
+						newstring.append(current)
+						# BUG: This spot appears buggy, but it's intended to
+						# be bug-for-bug compatible with existing behavior.
+						if pos < length and \
+							mystring[pos] in ("'", '"', "$"):
+							newstring.append(mystring[pos])
+							pos += 1
+					elif current == "\n":
 						pass
 					else:
 						newstring.append(mystring[pos - 2:pos])
 					continue
-			elif (mystring[pos]=="$") and (mystring[pos-1]!="\\"):
+			elif current == "$":
 				pos=pos+1
 				if mystring[pos]=="{":
 					pos=pos+1
@@ -754,11 +763,11 @@ def varexpand(mystring, mydict=None, error_leader=None):
 				if myvarname in mydict:
 					newstring.append(mydict[myvarname])
 			else:
-				newstring.append(mystring[pos])
-				pos=pos+1
+				newstring.append(current)
+				pos += 1
 		else:
-			newstring.append(mystring[pos])
-			pos=pos+1
+			newstring.append(current)
+			pos += 1
 
 	return "".join(newstring)
 



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-03-31 21:17 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-03-31 21:17 UTC (permalink / raw
  To: gentoo-commits

commit:     7342ef701af9eae725d89b784410884560793519
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 31 21:17:23 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Mar 31 21:17:23 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7342ef70

getconfig: show error message for varexpand fail

---
 pym/portage/util/__init__.py |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index a7bc9bd..3e7187c 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -636,7 +636,8 @@ def getconfig(mycfg, tolerant=0, allow_sourcing=False, expand=True):
 				continue
 
 			if expand:
-				mykeys[key] = varexpand(val, expand_map)
+				mykeys[key] = varexpand(val, mydict=expand_map,
+					error_leader=lex.error_leader)
 				expand_map[key] = mykeys[key]
 			else:
 				mykeys[key] = val
@@ -647,8 +648,9 @@ def getconfig(mycfg, tolerant=0, allow_sourcing=False, expand=True):
 	return mykeys
 
 _varexpand_word_chars = frozenset(string.ascii_letters + string.digits + "_")
+_varexpand_unexpected_eof_msg = "unexpected EOF while looking for matching `}'"
 
-def varexpand(mystring, mydict=None):
+def varexpand(mystring, mydict=None, error_leader=None):
 	if mydict is None:
 		mydict = {}
 
@@ -720,6 +722,10 @@ def varexpand(mystring, mydict=None):
 				while mystring[pos] in _varexpand_word_chars:
 					if (pos+1)>=len(mystring):
 						if braced:
+							msg = _varexpand_unexpected_eof_msg
+							if error_leader is not None:
+								msg = error_leader() + msg
+							writemsg(msg + "\n", noiselevel=-1)
 							return ""
 						else:
 							pos=pos+1
@@ -728,10 +734,21 @@ def varexpand(mystring, mydict=None):
 				myvarname=mystring[myvstart:pos]
 				if braced:
 					if mystring[pos]!="}":
+						msg = _varexpand_unexpected_eof_msg
+						if error_leader is not None:
+							msg = error_leader() + msg
+						writemsg(msg + "\n", noiselevel=-1)
 						return ""
 					else:
 						pos=pos+1
 				if len(myvarname)==0:
+					msg = "$"
+					if braced:
+						msg += "{}"
+					msg += ": bad substitution"
+					if error_leader is not None:
+						msg = error_leader() + msg
+					writemsg(msg + "\n", noiselevel=-1)
 					return ""
 				numvars=numvars+1
 				if myvarname in mydict:



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-03-31 20:27 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-03-31 20:27 UTC (permalink / raw
  To: gentoo-commits

commit:     ebb542165883468ebf31341e150cdbebcd7439a4
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 31 20:27:11 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Mar 31 20:27:11 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ebb54216

varexpand: use frozenset for word characters

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

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index ae560c0..a7bc9bd 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -646,6 +646,8 @@ def getconfig(mycfg, tolerant=0, allow_sourcing=False, expand=True):
 		raise portage.exception.ParseError(str(e)+" in "+mycfg)
 	return mykeys
 
+_varexpand_word_chars = frozenset(string.ascii_letters + string.digits + "_")
+
 def varexpand(mystring, mydict=None):
 	if mydict is None:
 		mydict = {}
@@ -715,8 +717,7 @@ def varexpand(mystring, mydict=None):
 				else:
 					braced=False
 				myvstart=pos
-				validchars=string.ascii_letters+string.digits+"_"
-				while mystring[pos] in validchars:
+				while mystring[pos] in _varexpand_word_chars:
 					if (pos+1)>=len(mystring):
 						if braced:
 							return ""



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-03-31 19:48 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-03-31 19:48 UTC (permalink / raw
  To: gentoo-commits

commit:     7490a70d40ed47e064a08f10b2319a4b8c9180d9
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 31 19:48:44 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Mar 31 19:48:44 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7490a70d

varexpand: use list for efficient append

---
 pym/portage/util/__init__.py |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index fc4b75b..ae560c0 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -661,21 +661,21 @@ def varexpand(mystring, mydict=None):
 	insing=0
 	indoub=0
 	pos=1
-	newstring = ""
+	newstring = []
 	while (pos<len(mystring)):
 		if (mystring[pos]=="'") and (mystring[pos-1]!="\\"):
 			if (indoub):
-				newstring=newstring+"'"
+				newstring.append("'")
 			else:
-				newstring += "'" # Quote removal is handled by shlex.
+				newstring.append("'") # Quote removal is handled by shlex.
 				insing=not insing
 			pos=pos+1
 			continue
 		elif (mystring[pos]=='"') and (mystring[pos-1]!="\\"):
 			if (insing):
-				newstring=newstring+'"'
+				newstring.append('"')
 			else:
-				newstring += '"' # Quote removal is handled by shlex.
+				newstring.append('"') # Quote removal is handled by shlex.
 				indoub=not indoub
 			pos=pos+1
 			continue
@@ -683,7 +683,7 @@ def varexpand(mystring, mydict=None):
 			#expansion time
 			if (mystring[pos]=="\n"):
 				#convert newlines to spaces
-				newstring=newstring+" "
+				newstring.append(" ")
 				pos=pos+1
 			elif (mystring[pos]=="\\"):
 				# For backslash expansion, this function used to behave like
@@ -695,17 +695,17 @@ def varexpand(mystring, mydict=None):
 				# escaped quotes here, since getconfig() uses shlex
 				# to handle that earlier.
 				if (pos+1>=len(mystring)):
-					newstring=newstring+mystring[pos]
+					newstring.append(mystring[pos])
 					break
 				else:
 					a = mystring[pos + 1]
 					pos = pos + 2
 					if a in ("\\", "$"):
-						newstring = newstring + a
+						newstring.append(a)
 					elif a == "\n":
 						pass
 					else:
-						newstring = newstring + mystring[pos-2:pos]
+						newstring.append(mystring[pos - 2:pos])
 					continue
 			elif (mystring[pos]=="$") and (mystring[pos-1]!="\\"):
 				pos=pos+1
@@ -734,15 +734,15 @@ def varexpand(mystring, mydict=None):
 					return ""
 				numvars=numvars+1
 				if myvarname in mydict:
-					newstring=newstring+mydict[myvarname] 
+					newstring.append(mydict[myvarname])
 			else:
-				newstring=newstring+mystring[pos]
+				newstring.append(mystring[pos])
 				pos=pos+1
 		else:
-			newstring=newstring+mystring[pos]
+			newstring.append(mystring[pos])
 			pos=pos+1
 
-	return newstring
+	return "".join(newstring)
 
 # broken and removed, but can still be imported
 pickle_write = None



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-03-28  1:50 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-03-28  1:50 UTC (permalink / raw
  To: gentoo-commits

commit:     1f3d3626d0fb716f1566b0cafab738a8008d3881
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 28 01:49:59 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Mar 28 01:49:59 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1f3d3626

varexpand: don't cache results

Caching wasn't really necessary here, and it didn't properly account
for input differences in the 'mydict' parameter.

---
 pym/portage/util/__init__.py |   17 ++++-------------
 1 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index dd692a1..fc4b75b 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -645,15 +645,10 @@ def getconfig(mycfg, tolerant=0, allow_sourcing=False, expand=True):
 	except Exception as e:
 		raise portage.exception.ParseError(str(e)+" in "+mycfg)
 	return mykeys
-	
-#cache expansions of constant strings
-cexpand={}
+
 def varexpand(mystring, mydict=None):
 	if mydict is None:
 		mydict = {}
-	newstring = cexpand.get(" "+mystring, None)
-	if newstring is not None:
-		return newstring
 
 	"""
 	new variable expansion code.  Preserves quotes, handles \n, etc.
@@ -666,7 +661,7 @@ def varexpand(mystring, mydict=None):
 	insing=0
 	indoub=0
 	pos=1
-	newstring=" "
+	newstring = ""
 	while (pos<len(mystring)):
 		if (mystring[pos]=="'") and (mystring[pos-1]!="\\"):
 			if (indoub):
@@ -724,7 +719,6 @@ def varexpand(mystring, mydict=None):
 				while mystring[pos] in validchars:
 					if (pos+1)>=len(mystring):
 						if braced:
-							cexpand[mystring]=""
 							return ""
 						else:
 							pos=pos+1
@@ -733,12 +727,10 @@ def varexpand(mystring, mydict=None):
 				myvarname=mystring[myvstart:pos]
 				if braced:
 					if mystring[pos]!="}":
-						cexpand[mystring]=""
 						return ""
 					else:
 						pos=pos+1
 				if len(myvarname)==0:
-					cexpand[mystring]=""
 					return ""
 				numvars=numvars+1
 				if myvarname in mydict:
@@ -749,9 +741,8 @@ def varexpand(mystring, mydict=None):
 		else:
 			newstring=newstring+mystring[pos]
 			pos=pos+1
-	if numvars==0:
-		cexpand[mystring]=newstring[1:]
-	return newstring[1:]	
+
+	return newstring
 
 # broken and removed, but can still be imported
 pickle_write = None



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-03-27 16:31 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-03-27 16:31 UTC (permalink / raw
  To: gentoo-commits

commit:     35d5ae5cc3989be7fb9823848cb021974fc7b8d1
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 27 16:28:01 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Mar 27 16:28:01 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=35d5ae5c

movefile: use writemsg for unicode safety

---
 pym/portage/util/movefile.py |   25 +++++++++++++------------
 1 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index 1dd2fc4..5ffd16b 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -1,8 +1,6 @@
 # Copyright 2010-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-from __future__ import print_function
-
 __all__ = ['movefile']
 
 import errno
@@ -82,7 +80,6 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 	"""moves a file from src to dest, preserving all permissions and attributes; mtime will
 	be preserved even when moving across filesystems.  Returns true on success and false on
 	failure.  Move is atomic."""
-	#print "movefile("+str(src)+","+str(dest)+","+str(newmtime)+","+str(sstat)+")"
 
 	if mysettings is None:
 		mysettings = portage.settings
@@ -110,8 +107,9 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 	except SystemExit as e:
 		raise
 	except Exception as e:
-		print(_("!!! Stating source file failed... movefile()"))
-		print("!!!",e)
+		writemsg("!!! %s\n" % _("Stating source file failed... movefile()"),
+			noiselevel=-1)
+		writemsg(_unicode_decode("!!! %s\n") % (e,), noiselevel=-1)
 		return None
 
 	destexists=1
@@ -168,9 +166,10 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 		except SystemExit as e:
 			raise
 		except Exception as e:
-			print(_("!!! failed to properly create symlink:"))
-			print("!!!",dest,"->",target)
-			print("!!!",e)
+			writemsg("!!! %s\n" % _("failed to properly create symlink:"),
+				noiselevel=-1)
+			writemsg("!!! %s -> %s\n" % (dest, target), noiselevel=-1)
+			writemsg(_unicode_decode("!!! %s\n") % (e,), noiselevel=-1)
 			return None
 
 	hardlinked = False
@@ -220,8 +219,9 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 		except OSError as e:
 			if e.errno != errno.EXDEV:
 				# Some random error.
-				print(_("!!! Failed to move %(src)s to %(dest)s") % {"src": src, "dest": dest})
-				print("!!!",e)
+				writemsg("!!! %s\n" % _("Failed to move %(src)s to %(dest)s") %
+					{"src": src, "dest": dest}, noiselevel=-1)
+				writemsg(_unicode_decode("!!! %s\n") % (e,), noiselevel=-1)
 				return None
 			# Invalid cross-device-link 'bind' mounted or actually Cross-Device
 	if renamefailed:
@@ -250,8 +250,9 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 			except SystemExit as e:
 				raise
 			except Exception as e:
-				print(_('!!! copy %(src)s -> %(dest)s failed.') % {"src": src, "dest": dest})
-				print("!!!",e)
+				writemsg("!!! %s\n" % _('copy %(src)s -> %(dest)s failed.') %
+					{"src": src, "dest": dest}, noiselevel=-1)
+				writemsg(_unicode_decode("!!! %s\n") % (e,), noiselevel=-1)
 				return None
 		else:
 			#we don't yet handle special, so we need to fall back to /bin/mv



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-03-27 15:42 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-03-27 15:42 UTC (permalink / raw
  To: gentoo-commits

commit:     ae8070542fcee0516fbfa270f6ef3f3e53a8d220
Author:     Greg Turner <gmturner007 <AT> ameritech <DOT> net>
AuthorDate: Tue Mar 27 15:40:18 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Mar 27 15:40:18 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ae807054

grabdict: remove incorrect docstring, bug #409839

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

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 13aa721..02fb75d 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -351,7 +351,6 @@ def grabdict(myfilename, juststrings=0, empty=0, recursive=0, incremental=1):
 		'sys-apps/portage x86 amd64 ppc'
 		would return
 		{ "sys-apps/portage" : [ 'x86', 'amd64', 'ppc' ]
-		the line syntax is key : [list of values]
 	"""
 	newdict={}
 	for x in grablines(myfilename, recursive):



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-03-23 19:58 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-03-23 19:58 UTC (permalink / raw
  To: gentoo-commits

commit:     31e50edfea40c432fde6957eba4bf3013ef321a0
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 23 19:57:47 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Mar 23 19:57:47 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=31e50edf

movefile: import print_function

This fixes printing of tuples under python-2.x, as shown in
bug #402323.

---
 pym/portage/util/movefile.py |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index 43f1b33..1dd2fc4 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -1,6 +1,8 @@
 # Copyright 2010-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
+from __future__ import print_function
+
 __all__ = ['movefile']
 
 import errno



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-03-23 18:22 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-03-23 18:22 UTC (permalink / raw
  To: gentoo-commits

commit:     c33fe80a46e7ba5046c14c5fae8e6fbb8934cac5
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 23 18:22:23 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Mar 23 18:22:23 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c33fe80a

movefile: clarify message for xattr copy error

This will fix bug #402323.

---
 pym/portage/util/movefile.py |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index 252f4a2..43f1b33 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -8,6 +8,7 @@ import os as _os
 import shutil as _shutil
 import stat
 import subprocess
+import textwrap
 
 import portage
 from portage import bsd_chflags, _encodings, _os_overrides, _selinux, \
@@ -229,7 +230,18 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 			try: # For safety copy then move it over.
 				_copyfile(src_bytes, dest_tmp_bytes)
 				if xattr_enabled:
-					_copyxattr(src_bytes, dest_tmp_bytes)
+					try:
+						_copyxattr(src_bytes, dest_tmp_bytes)
+					except SystemExit:
+						raise
+					except:
+						msg = _("Failed to copy extended attributes. "
+							"In order to avoid this error, set "
+							"FEATURES=\"-xattr\" in make.conf.")
+						msg = textwrap.wrap(msg, 65)
+						for line in msg:
+							writemsg("!!! %s\n" % (line,), noiselevel=-1)
+						raise
 				_apply_stat(sstat, dest_tmp_bytes)
 				_rename(dest_tmp_bytes, dest_bytes)
 				_os.unlink(src_bytes)



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-03-23 18:20 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-03-23 18:20 UTC (permalink / raw
  To: gentoo-commits

commit:     6d2be766e6056e266522c9e39d663d7c0ac42e0d
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 23 18:05:36 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Mar 23 18:20:14 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=6d2be766

movefile: refactor selinux conditional code

---
 pym/portage/util/movefile.py |   28 +++++++++++++---------------
 1 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index 476f8e7..252f4a2 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Gentoo Foundation
+# Copyright 2010-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 __all__ = ['movefile']
@@ -85,15 +85,20 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 		mysettings = portage.settings
 
 	src_bytes = _unicode_encode(src, encoding=encoding, errors='strict')
+	dest_bytes = _unicode_encode(dest, encoding=encoding, errors='strict')
 	xattr_enabled = "xattr" in mysettings.features
 	selinux_enabled = mysettings.selinux_enabled()
 	if selinux_enabled:
 		selinux = _unicode_module_wrapper(_selinux, encoding=encoding)
+		_copyfile = selinux.copyfile
+		_rename = selinux.rename
+	else:
+		_copyfile = _shutil.copyfile
+		_rename = _os.rename
 
 	lchown = _unicode_func_wrapper(portage.data.lchown, encoding=encoding)
 	os = _unicode_module_wrapper(_os,
 		encoding=encoding, overrides=_os_overrides)
-	shutil = _unicode_module_wrapper(_shutil, encoding=encoding)
 
 	try:
 		if not sstat:
@@ -222,19 +227,12 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 			dest_tmp_bytes = _unicode_encode(dest_tmp, encoding=encoding,
 				errors='strict')
 			try: # For safety copy then move it over.
-				if selinux_enabled:
-					selinux.copyfile(src, dest_tmp)
-					if xattr_enabled:
-						_copyxattr(src_bytes, dest_tmp_bytes)
-					_apply_stat(sstat, dest_tmp_bytes)
-					selinux.rename(dest_tmp, dest)
-				else:
-					shutil.copyfile(src, dest_tmp)
-					if xattr_enabled:
-						_copyxattr(src_bytes, dest_tmp_bytes)
-					_apply_stat(sstat, dest_tmp_bytes)
-					os.rename(dest_tmp, dest)
-				os.unlink(src)
+				_copyfile(src_bytes, dest_tmp_bytes)
+				if xattr_enabled:
+					_copyxattr(src_bytes, dest_tmp_bytes)
+				_apply_stat(sstat, dest_tmp_bytes)
+				_rename(dest_tmp_bytes, dest_bytes)
+				_os.unlink(src_bytes)
 			except SystemExit as e:
 				raise
 			except Exception as e:



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-03-23 18:05 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-03-23 18:05 UTC (permalink / raw
  To: gentoo-commits

commit:     ae93d0d8597fb617a231cd8668cc850ebd6947d8
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 23 18:05:36 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Mar 23 18:05:36 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ae93d0d8

movefile: refactor selinux conditional code

---
 pym/portage/util/movefile.py |   27 +++++++++++++--------------
 1 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index 476f8e7..4880a78 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Gentoo Foundation
+# Copyright 2010-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 __all__ = ['movefile']
@@ -85,10 +85,16 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 		mysettings = portage.settings
 
 	src_bytes = _unicode_encode(src, encoding=encoding, errors='strict')
+	dest_bytes = _unicode_encode(dest, encoding=encoding, errors='strict')
 	xattr_enabled = "xattr" in mysettings.features
 	selinux_enabled = mysettings.selinux_enabled()
 	if selinux_enabled:
 		selinux = _unicode_module_wrapper(_selinux, encoding=encoding)
+		_copyfile = selinux.copyfile
+		_rename = selinux.rename
+	else:
+		_copyfile = _shutil.copyfile
+		_rename = _os.rename
 
 	lchown = _unicode_func_wrapper(portage.data.lchown, encoding=encoding)
 	os = _unicode_module_wrapper(_os,
@@ -222,19 +228,12 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 			dest_tmp_bytes = _unicode_encode(dest_tmp, encoding=encoding,
 				errors='strict')
 			try: # For safety copy then move it over.
-				if selinux_enabled:
-					selinux.copyfile(src, dest_tmp)
-					if xattr_enabled:
-						_copyxattr(src_bytes, dest_tmp_bytes)
-					_apply_stat(sstat, dest_tmp_bytes)
-					selinux.rename(dest_tmp, dest)
-				else:
-					shutil.copyfile(src, dest_tmp)
-					if xattr_enabled:
-						_copyxattr(src_bytes, dest_tmp_bytes)
-					_apply_stat(sstat, dest_tmp_bytes)
-					os.rename(dest_tmp, dest)
-				os.unlink(src)
+				_copyfile(src_bytes, dest_tmp_bytes)
+				if xattr_enabled:
+					_copyxattr(src_bytes, dest_tmp_bytes)
+				_apply_stat(sstat, dest_tmp_bytes)
+				_rename(dest_tmp_bytes, dest_bytes)
+				_os.unlink(src_bytes)
 			except SystemExit as e:
 				raise
 			except Exception as e:



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-03-22 21:37 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-03-22 21:37 UTC (permalink / raw
  To: gentoo-commits

commit:     7c4c48d9a4344a6f1c9859ae178ed78408ba2777
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 22 21:36:36 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Mar 22 21:36:36 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7c4c48d9

mtimedb: enable JSON write support

JSON read support has been available since portage-2.1.10.49.

---
 pym/portage/util/mtimedb.py |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/pym/portage/util/mtimedb.py b/pym/portage/util/mtimedb.py
index 4ccea24..736e314 100644
--- a/pym/portage/util/mtimedb.py
+++ b/pym/portage/util/mtimedb.py
@@ -24,8 +24,8 @@ from portage.util import apply_secpass_permissions, atomic_ofstream, writemsg
 
 class MtimeDB(dict):
 
-	# Enable this after JSON read has been supported for some time.
-	_json_write = False
+	# JSON read support has been available since portage-2.1.10.49.
+	_json_write = True
 
 	_json_write_opts = {
 		"ensure_ascii": False,
@@ -60,19 +60,19 @@ class MtimeDB(dict):
 		d = None
 		if content:
 			try:
-				mypickle = pickle.Unpickler(io.BytesIO(content))
-				try:
-					mypickle.find_global = None
-				except AttributeError:
-					# TODO: If py3k, override Unpickler.find_class().
-					pass
-				d = mypickle.load()
+				d = json.loads(_unicode_decode(content,
+					encoding=_encodings['repo.content'], errors='strict'))
 			except SystemExit:
 				raise
 			except Exception as e:
 				try:
-					d = json.loads(_unicode_decode(content,
-						encoding=_encodings['repo.content'], errors='strict'))
+					mypickle = pickle.Unpickler(io.BytesIO(content))
+					try:
+						mypickle.find_global = None
+					except AttributeError:
+						# Python >=3
+						pass
+					d = mypickle.load()
 				except SystemExit:
 					raise
 				except Exception:



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-03-05  9:55 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-03-05  9:55 UTC (permalink / raw
  To: gentoo-commits

commit:     3596fc3822bb82dfe05a58fdb78220e399175a4d
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Mar  5 09:55:39 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Mar  5 09:55:39 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3596fc38

whirlpool.py: fix WhirlpoolAdd for bug #406407

This file is a python port of Whirlpool.c the reference implementation:

  http://www.larc.usp.br/~pbarreto/whirlpool.zip

Comparison of both implementations reveals a difference in loop logic
at the very beginning of the WhirlpoolAdd function, which is fixed now.

---
 pym/portage/util/whirlpool.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/pym/portage/util/whirlpool.py b/pym/portage/util/whirlpool.py
index 8415e87..c696f6f 100644
--- a/pym/portage/util/whirlpool.py
+++ b/pym/portage/util/whirlpool.py
@@ -645,7 +645,7 @@ def WhirlpoolAdd(source, sourceBits, ctx):
     carry = 0
     value = sourceBits
     i = 31
-    while i >= 0 and value != 0:
+    while i >= 0 and (carry != 0 or value != 0):
         carry += ctx.bitLength[i] + ((value % 0x100000000) & 0xff)
         ctx.bitLength[i] = carry % 0x100
         carry >>= 8



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-02-18  3:40 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-02-18  3:40 UTC (permalink / raw
  To: gentoo-commits

commit:     848da97a64b2d3d13c3fbc794c57dae714009854
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 18 03:40:03 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Feb 18 03:40:03 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=848da97a

MtimeDB: add JSON read/write

Support serialization as JSON instead of pickle, so that
/var/cache/edb/mtimedb is human readable/writable, for those rare
cases where it may be useful. Currently, pickle is still used for
writes. The plan is to migrate to JSON after JSON read has been
supported for some time.

---
 pym/portage/util/mtimedb.py |   69 ++++++++++++++++++++++++++++++++++---------
 1 files changed, 55 insertions(+), 14 deletions(-)

diff --git a/pym/portage/util/mtimedb.py b/pym/portage/util/mtimedb.py
index 0a27166..4ccea24 100644
--- a/pym/portage/util/mtimedb.py
+++ b/pym/portage/util/mtimedb.py
@@ -10,13 +10,32 @@ except ImportError:
 	import pickle
 
 import errno
+import io
+import json
+import sys
+
 import portage
+from portage import _encodings
+from portage import _unicode_decode
 from portage import _unicode_encode
 from portage.data import portage_gid, uid
 from portage.localization import _
 from portage.util import apply_secpass_permissions, atomic_ofstream, writemsg
 
 class MtimeDB(dict):
+
+	# Enable this after JSON read has been supported for some time.
+	_json_write = False
+
+	_json_write_opts = {
+		"ensure_ascii": False,
+		"indent": "\t",
+		"sort_keys": True
+	}
+	if sys.hexversion < 0x3020000:
+		# indent only supports int number of spaces
+		_json_write_opts["indent"] = 4
+
 	def __init__(self, filename):
 		dict.__init__(self)
 		self.filename = filename
@@ -24,28 +43,45 @@ class MtimeDB(dict):
 
 	def _load(self, filename):
 		f = None
+		content = None
 		try:
 			f = open(_unicode_encode(filename), 'rb')
-			mypickle = pickle.Unpickler(f)
-			try:
-				mypickle.find_global = None
-			except AttributeError:
-				# TODO: If py3k, override Unpickler.find_class().
-				pass
-			d = mypickle.load()
-		except (AttributeError, EOFError, EnvironmentError, ValueError, pickle.UnpicklingError) as e:
-			if isinstance(e, EnvironmentError) and \
-				getattr(e, 'errno', None) in (errno.ENOENT, errno.EACCES):
+			content = f.read()
+		except EnvironmentError as e:
+			if getattr(e, 'errno', None) in (errno.ENOENT, errno.EACCES):
 				pass
 			else:
 				writemsg(_("!!! Error loading '%s': %s\n") % \
-					(filename, str(e)), noiselevel=-1)
-			del e
-			d = {}
+					(filename, e), noiselevel=-1)
 		finally:
 			if f is not None:
 				f.close()
 
+		d = None
+		if content:
+			try:
+				mypickle = pickle.Unpickler(io.BytesIO(content))
+				try:
+					mypickle.find_global = None
+				except AttributeError:
+					# TODO: If py3k, override Unpickler.find_class().
+					pass
+				d = mypickle.load()
+			except SystemExit:
+				raise
+			except Exception as e:
+				try:
+					d = json.loads(_unicode_decode(content,
+						encoding=_encodings['repo.content'], errors='strict'))
+				except SystemExit:
+					raise
+				except Exception:
+					writemsg(_("!!! Error loading '%s': %s\n") % \
+						(filename, e), noiselevel=-1)
+
+		if d is None:
+			d = {}
+
 		if "old" in d:
 			d["updates"] = d["old"]
 			del d["old"]
@@ -80,7 +116,12 @@ class MtimeDB(dict):
 			except EnvironmentError:
 				pass
 			else:
-				pickle.dump(d, f, protocol=2)
+				if self._json_write:
+					f.write(_unicode_encode(
+						json.dumps(d, **self._json_write_opts),
+						encoding=_encodings['repo.content'], errors='strict'))
+				else:
+					pickle.dump(d, f, protocol=2)
 				f.close()
 				apply_secpass_permissions(self.filename,
 					uid=uid, gid=portage_gid, mode=0o644)



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-02-18  3:11 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-02-18  3:11 UTC (permalink / raw
  To: gentoo-commits

commit:     557134066e5a8e4a1b0522fe94d931a2688f98f7
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 18 02:41:27 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Feb 18 03:11:18 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=55713406

MtimeDB._load: explicitly close file

---
 pym/portage/util/mtimedb.py |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/pym/portage/util/mtimedb.py b/pym/portage/util/mtimedb.py
index 8079aa9..0a27166 100644
--- a/pym/portage/util/mtimedb.py
+++ b/pym/portage/util/mtimedb.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Gentoo Foundation
+# Copyright 2010-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 __all__ = ['MtimeDB']
@@ -23,6 +23,7 @@ class MtimeDB(dict):
 		self._load(filename)
 
 	def _load(self, filename):
+		f = None
 		try:
 			f = open(_unicode_encode(filename), 'rb')
 			mypickle = pickle.Unpickler(f)
@@ -32,8 +33,6 @@ class MtimeDB(dict):
 				# TODO: If py3k, override Unpickler.find_class().
 				pass
 			d = mypickle.load()
-			f.close()
-			del f
 		except (AttributeError, EOFError, EnvironmentError, ValueError, pickle.UnpicklingError) as e:
 			if isinstance(e, EnvironmentError) and \
 				getattr(e, 'errno', None) in (errno.ENOENT, errno.EACCES):
@@ -43,6 +42,9 @@ class MtimeDB(dict):
 					(filename, str(e)), noiselevel=-1)
 			del e
 			d = {}
+		finally:
+			if f is not None:
+				f.close()
 
 		if "old" in d:
 			d["updates"] = d["old"]



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-02-18  2:41 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-02-18  2:41 UTC (permalink / raw
  To: gentoo-commits

commit:     e93e57bb88338315170f9bf3909bbfb56d79c91e
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 18 02:41:27 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Feb 18 02:41:27 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e93e57bb

MtimeDB._load: explicitly close file

---
 pym/portage/util/mtimedb.py |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/pym/portage/util/mtimedb.py b/pym/portage/util/mtimedb.py
index 8079aa9..0a27166 100644
--- a/pym/portage/util/mtimedb.py
+++ b/pym/portage/util/mtimedb.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Gentoo Foundation
+# Copyright 2010-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 __all__ = ['MtimeDB']
@@ -23,6 +23,7 @@ class MtimeDB(dict):
 		self._load(filename)
 
 	def _load(self, filename):
+		f = None
 		try:
 			f = open(_unicode_encode(filename), 'rb')
 			mypickle = pickle.Unpickler(f)
@@ -32,8 +33,6 @@ class MtimeDB(dict):
 				# TODO: If py3k, override Unpickler.find_class().
 				pass
 			d = mypickle.load()
-			f.close()
-			del f
 		except (AttributeError, EOFError, EnvironmentError, ValueError, pickle.UnpicklingError) as e:
 			if isinstance(e, EnvironmentError) and \
 				getattr(e, 'errno', None) in (errno.ENOENT, errno.EACCES):
@@ -43,6 +42,9 @@ class MtimeDB(dict):
 					(filename, str(e)), noiselevel=-1)
 			del e
 			d = {}
+		finally:
+			if f is not None:
+				f.close()
 
 		if "old" in d:
 			d["updates"] = d["old"]



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-01-12  1:35 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-01-12  1:35 UTC (permalink / raw
  To: gentoo-commits

commit:     31b4d0cb3a183e29fe0d745187470ded37ffd433
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 12 01:34:49 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Jan 12 01:34:49 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=31b4d0cb

read_corresponding_eapi_file: unicode, bug 398587

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

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 58501dc..13aa721 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -388,7 +388,9 @@ def read_corresponding_eapi_file(filename):
 	default = "0"
 	eapi_file = os.path.join(os.path.dirname(filename), "eapi")
 	try:
-		f = open(eapi_file, "r")
+		f = io.open(_unicode_encode(eapi_file,
+			encoding=_encodings['fs'], errors='strict'),
+			mode='r', encoding=_encodings['repo.content'], errors='replace')
 		lines = f.readlines()
 		if len(lines) == 1:
 			eapi = lines[0].rstrip("\n")



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-01-10  0:37 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-01-10  0:37 UTC (permalink / raw
  To: gentoo-commits

commit:     b7b0e36986a90311e671e23c8ad16e10bcbb860f
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 10 00:37:28 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Jan 10 00:37:28 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b7b0e369

env_update: ldsoconf_update flag not reliable

The ldsoconf_update flag was not a reliable indicator of whether
or not ldconfig needs to be called, since ld.so.conf can have lines
like "include ld.so.conf.d/*.conf" that pull in outside content which
may have changed without being detected.

---
 pym/portage/util/env_update.py |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/pym/portage/util/env_update.py b/pym/portage/util/env_update.py
index e8507b3..ace4077 100644
--- a/pym/portage/util/env_update.py
+++ b/pym/portage/util/env_update.py
@@ -183,8 +183,6 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env,
 			raise
 		oldld = None
 
-	ldsoconf_update = False
-
 	newld = specials["LDPATH"]
 	if (oldld != newld):
 		#ld.so.conf needs updating and ldconfig needs to be run
@@ -194,7 +192,6 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env,
 		for x in specials["LDPATH"]:
 			myfd.write(x + "\n")
 		myfd.close()
-		ldsoconf_update = True
 
 	# Update prelink.conf if we are prelink-enabled
 	if prelink_capable:
@@ -267,7 +264,6 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env,
 
 	if makelinks and \
 		not mtime_changed and \
-		not ldsoconf_update and \
 		contents is not None:
 		libdir_contents_changed = False
 		for mypath, mydata in contents.items():



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-01-03 21:59 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-01-03 21:59 UTC (permalink / raw
  To: gentoo-commits

commit:     f132600314270f5fbbd168d941566d0fd877eb18
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Jan  3 21:59:25 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Jan  3 21:59:25 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f1326003

getlibpaths: regex for include

---
 pym/portage/util/__init__.py |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index db8eb94..58501dc 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -1596,11 +1596,15 @@ def find_updated_config_files(target_root, config_protect):
 					else:
 						yield (x, None)
 
+_ld_so_include_re = re.compile(r'^include\s+(\S.*)')
+
 def getlibpaths(root, env=None):
 	def read_ld_so_conf(path):
 		for l in grabfile(path):
-			if l.startswith('include '):
-				subpath = os.path.join(os.path.dirname(path), l[8:].strip())
+			include_match = _ld_so_include_re.match(l)
+			if include_match is not None:
+				subpath = os.path.join(os.path.dirname(path),
+					include_match.group(1))
 				for p in glob.glob(subpath):
 					for r in read_ld_so_conf(p):
 						yield r



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2012-01-03 21:36 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2012-01-03 21:36 UTC (permalink / raw
  To: gentoo-commits

commit:     bce4fd1520fed9f35c8004f98ef3ed489efaa5db
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jan  3 21:28:47 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Jan  3 21:34:18 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=bce4fd15

Support include directives in ld.so.conf.

---
 pym/portage/util/__init__.py |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 54e6839..db8eb94 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -25,6 +25,7 @@ import stat
 import string
 import sys
 import traceback
+import glob
 
 import portage
 portage.proxy.lazyimport.lazyimport(globals(),
@@ -1596,12 +1597,22 @@ def find_updated_config_files(target_root, config_protect):
 						yield (x, None)
 
 def getlibpaths(root, env=None):
+	def read_ld_so_conf(path):
+		for l in grabfile(path):
+			if l.startswith('include '):
+				subpath = os.path.join(os.path.dirname(path), l[8:].strip())
+				for p in glob.glob(subpath):
+					for r in read_ld_so_conf(p):
+						yield r
+			else:
+				yield l
+
 	""" Return a list of paths that are used for library lookups """
 	if env is None:
 		env = os.environ
 	# the following is based on the information from ld.so(8)
 	rval = env.get("LD_LIBRARY_PATH", "").split(":")
-	rval.extend(grabfile(os.path.join(root, "etc", "ld.so.conf")))
+	rval.extend(read_ld_so_conf(os.path.join(root, "etc", "ld.so.conf")))
 	rval.append("/usr/lib")
 	rval.append("/lib")
 



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-12-22 21:36 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2011-12-22 21:36 UTC (permalink / raw
  To: gentoo-commits

commit:     28992a12fea60af70285db931f4a41c932f31ae3
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 22 21:36:40 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Dec 22 21:36:40 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=28992a12

_pty.py: remove unused _tested_pty variable

---
 pym/portage/util/_pty.py |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/pym/portage/util/_pty.py b/pym/portage/util/_pty.py
index efabb0a..95082cf 100644
--- a/pym/portage/util/_pty.py
+++ b/pym/portage/util/_pty.py
@@ -16,8 +16,6 @@ from portage.util import writemsg
 # _disable_openpty on Interix must *never* be True
 _disable_openpty = platform.system() in ("SunOS",)
 
-_tested_pty = False
-
 _fbsd_test_pty = platform.system() == 'FreeBSD'
 
 def _create_pty_or_pipe(copy_term_size=None):



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-12-10 19:41 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2011-12-10 19:41 UTC (permalink / raw
  To: gentoo-commits

commit:     8dfb0b16b1fb25012c3ec0189509af3048db562c
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 10 19:41:07 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Dec 10 19:41:07 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=8dfb0b16

movefile.py: open /dev/null in binary mode

---
 pym/portage/util/movefile.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index 89fa69c..476f8e7 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -50,7 +50,7 @@ else:
 				if raise_exception:
 					raise OperationNotSupported("Filesystem containing file '%s' does not support extended attributes" % dest)
 	else:
-		_devnull = open("/dev/null", "w")
+		_devnull = open("/dev/null", "wb")
 		try:
 			subprocess.call(["getfattr", "--version"], stdout=_devnull)
 			subprocess.call(["setfattr", "--version"], stdout=_devnull)



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-12-10  5:28 Arfrever Frehtes Taifersar Arahesis
  0 siblings, 0 replies; 134+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2011-12-10  5:28 UTC (permalink / raw
  To: gentoo-commits

commit:     49689816166eee3d4fd4d2b1b9932398f3835341
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Gentoo <DOT> Org>
AuthorDate: Sat Dec 10 05:27:18 2011 +0000
Commit:     Arfrever Frehtes Taifersar Arahesis <arfrever <AT> gentoo <DOT> org>
CommitDate: Sat Dec 10 05:27:18 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=49689816

portage.util.movefile._copyxattr(): Print more informative exception
when target filesystem does not support extended attributes.

---
 pym/portage/util/movefile.py |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index e1dfa42..89fa69c 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -14,6 +14,7 @@ from portage import bsd_chflags, _encodings, _os_overrides, _selinux, \
 	_unicode_decode, _unicode_encode, _unicode_func_wrapper,\
 	_unicode_module_wrapper
 from portage.const import MOVE_BINARY
+from portage.exception import OperationNotSupported
 from portage.localization import _
 from portage.process import spawn
 from portage.util import writemsg
@@ -26,7 +27,13 @@ if hasattr(_os, "getxattr"):
 	# Python >=3.3 and GNU/Linux
 	def _copyxattr(src, dest):
 		for attr in _os.listxattr(src):
-			_os.setxattr(dest, attr, _os.getxattr(src, attr))
+			try:
+				_os.setxattr(dest, attr, _os.getxattr(src, attr))
+				raise_exception = False
+			except OSError:
+				raise_exception = True
+			if raise_exception:
+				raise OperationNotSupported("Filesystem containing file '%s' does not support extended attributes" % dest)
 else:
 	try:
 		import xattr
@@ -35,7 +42,13 @@ else:
 	if xattr is not None:
 		def _copyxattr(src, dest):
 			for attr in xattr.list(src):
-				xattr.set(dest, attr, xattr.get(src, attr))
+				try:
+					xattr.set(dest, attr, xattr.get(src, attr))
+					raise_exception = False
+				except IOError:
+					raise_exception = True
+				if raise_exception:
+					raise OperationNotSupported("Filesystem containing file '%s' does not support extended attributes" % dest)
 	else:
 		_devnull = open("/dev/null", "w")
 		try:
@@ -53,8 +66,10 @@ else:
 				getfattr_process.stdout.close()
 				if extended_attributes:
 					extended_attributes[0] = b"# file: " + _unicode_encode(dest) + b"\n"
-					setfattr_process = subprocess.Popen(["setfattr", "--restore=-"], stdin=subprocess.PIPE)
+					setfattr_process = subprocess.Popen(["setfattr", "--restore=-"], stdin=subprocess.PIPE, stderr=subprocess.PIPE)
 					setfattr_process.communicate(input=b"".join(extended_attributes))
+					if setfattr_process.returncode != 0:
+						raise OperationNotSupported("Filesystem containing file '%s' does not support extended attributes" % dest)
 		else:
 			def _copyxattr(src, dest):
 				pass



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-12-10  0:03 Arfrever Frehtes Taifersar Arahesis
  0 siblings, 0 replies; 134+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2011-12-10  0:03 UTC (permalink / raw
  To: gentoo-commits

commit:     4df21a13440d36a94e34ba421d1fb8bc77d35be0
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Gentoo <DOT> Org>
AuthorDate: Sat Dec 10 00:01:46 2011 +0000
Commit:     Arfrever Frehtes Taifersar Arahesis <arfrever <AT> gentoo <DOT> org>
CommitDate: Sat Dec 10 00:01:46 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=4df21a13

portage.util.movefile._copyxattr(): Support usage of xattr module from
dev-python/pyxattr.

---
 pym/portage/util/movefile.py |   45 +++++++++++++++++++++++++----------------
 1 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index 9507d83..c777b24 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -28,27 +28,36 @@ if hasattr(_os, "getxattr"):
 		for attr in _os.listxattr(src):
 			_os.setxattr(dest, attr, _os.getxattr(src, attr))
 else:
-	_devnull = open("/dev/null", "w")
 	try:
-		subprocess.call(["getfattr", "--version"], stdout=_devnull)
-		subprocess.call(["setfattr", "--version"], stdout=_devnull)
-		_has_getfattr_and_setfattr = True
-	except OSError:
-		_has_getfattr_and_setfattr = False
-	_devnull.close()
-	if _has_getfattr_and_setfattr:
+		import xattr
+	except ImportError:
+		xattr = None
+	if xattr is not None:
 		def _copyxattr(src, dest):
-			getfattr_process = subprocess.Popen(["getfattr", "-d", "--absolute-names", src], stdout=subprocess.PIPE)
-			getfattr_process.wait()
-			extended_attributes = getfattr_process.stdout.readlines()
-			getfattr_process.stdout.close()
-			if extended_attributes:
-				extended_attributes[0] = b"# file: " + _unicode_encode(dest) + b"\n"
-				setfattr_process = subprocess.Popen(["setfattr", "--restore=-"], stdin=subprocess.PIPE)
-				setfattr_process.communicate(input=b"".join(extended_attributes))
+			for attr in xattr.list(src):
+				xattr.set(dest, attr, xattr.get(src, attr))
 	else:
-		def _copyxattr(src, dest):
-			pass
+		_devnull = open("/dev/null", "w")
+		try:
+			subprocess.call(["getfattr", "--version"], stdout=_devnull)
+			subprocess.call(["setfattr", "--version"], stdout=_devnull)
+			_has_getfattr_and_setfattr = True
+		except OSError:
+			_has_getfattr_and_setfattr = False
+		_devnull.close()
+		if _has_getfattr_and_setfattr:
+			def _copyxattr(src, dest):
+				getfattr_process = subprocess.Popen(["getfattr", "-d", "--absolute-names", src], stdout=subprocess.PIPE)
+				getfattr_process.wait()
+				extended_attributes = getfattr_process.stdout.readlines()
+				getfattr_process.stdout.close()
+				if extended_attributes:
+					extended_attributes[0] = b"# file: " + _unicode_encode(dest) + b"\n"
+					setfattr_process = subprocess.Popen(["setfattr", "--restore=-"], stdin=subprocess.PIPE)
+					setfattr_process.communicate(input=b"".join(extended_attributes))
+		else:
+			def _copyxattr(src, dest):
+				pass
 
 def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 		hardlink_candidates=None, encoding=_encodings['fs']):



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-12-09 23:53 Arfrever Frehtes Taifersar Arahesis
  0 siblings, 0 replies; 134+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2011-12-09 23:53 UTC (permalink / raw
  To: gentoo-commits

commit:     b5b277f1c03ceee6b00577a693e8c3f0b42d32aa
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Gentoo <DOT> Org>
AuthorDate: Fri Dec  9 23:51:31 2011 +0000
Commit:     Arfrever Frehtes Taifersar Arahesis <arfrever <AT> gentoo <DOT> org>
CommitDate: Fri Dec  9 23:51:31 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b5b277f1

portage.util.movefile._copyxattr(): Support usage of getfattr and
setfattr executables.

---
 pym/portage/util/movefile.py |   27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index fe41501..9507d83 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -7,6 +7,7 @@ import errno
 import os as _os
 import shutil as _shutil
 import stat
+import subprocess
 
 import portage
 from portage import bsd_chflags, _encodings, _os_overrides, _selinux, \
@@ -22,14 +23,32 @@ def _apply_stat(src_stat, dest):
 	_os.chmod(dest, stat.S_IMODE(src_stat.st_mode))
 
 if hasattr(_os, "getxattr"):
-	# Python >=3.3
+	# Python >=3.3 and GNU/Linux
 	def _copyxattr(src, dest):
 		for attr in _os.listxattr(src):
 			_os.setxattr(dest, attr, _os.getxattr(src, attr))
 else:
-	def _copyxattr(src, dest):
-		pass
-		# Maybe call getfattr and setfattr executables.
+	_devnull = open("/dev/null", "w")
+	try:
+		subprocess.call(["getfattr", "--version"], stdout=_devnull)
+		subprocess.call(["setfattr", "--version"], stdout=_devnull)
+		_has_getfattr_and_setfattr = True
+	except OSError:
+		_has_getfattr_and_setfattr = False
+	_devnull.close()
+	if _has_getfattr_and_setfattr:
+		def _copyxattr(src, dest):
+			getfattr_process = subprocess.Popen(["getfattr", "-d", "--absolute-names", src], stdout=subprocess.PIPE)
+			getfattr_process.wait()
+			extended_attributes = getfattr_process.stdout.readlines()
+			getfattr_process.stdout.close()
+			if extended_attributes:
+				extended_attributes[0] = b"# file: " + _unicode_encode(dest) + b"\n"
+				setfattr_process = subprocess.Popen(["setfattr", "--restore=-"], stdin=subprocess.PIPE)
+				setfattr_process.communicate(input=b"".join(extended_attributes))
+	else:
+		def _copyxattr(src, dest):
+			pass
 
 def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 		hardlink_candidates=None, encoding=_encodings['fs']):



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-11-29  4:52 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2011-11-29  4:52 UTC (permalink / raw
  To: gentoo-commits

commit:     d5ab84724a9a9a39546bc962cc31e694a8634436
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 29 04:52:41 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Nov 29 04:52:41 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d5ab8472

movefile: tweak unicode handling

---
 pym/portage/util/movefile.py |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index d15291a..fe41501 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -10,15 +10,16 @@ import stat
 
 import portage
 from portage import bsd_chflags, _encodings, _os_overrides, _selinux, \
-	_unicode_decode, _unicode_func_wrapper, _unicode_module_wrapper
+	_unicode_decode, _unicode_encode, _unicode_func_wrapper,\
+	_unicode_module_wrapper
 from portage.const import MOVE_BINARY
 from portage.localization import _
 from portage.process import spawn
 from portage.util import writemsg
 
-def _apply_stat(os, src_stat, dest):
-	os.chown(dest, src_stat.st_uid, src_stat.st_gid)
-	os.chmod(dest, stat.S_IMODE(src_stat.st_mode))
+def _apply_stat(src_stat, dest):
+	_os.chown(dest, src_stat.st_uid, src_stat.st_gid)
+	_os.chmod(dest, stat.S_IMODE(src_stat.st_mode))
 
 if hasattr(_os, "getxattr"):
 	# Python >=3.3
@@ -40,6 +41,7 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 	if mysettings is None:
 		mysettings = portage.settings
 
+	src_bytes = _unicode_encode(src, encoding=encoding, errors='strict')
 	selinux_enabled = mysettings.selinux_enabled()
 	if selinux_enabled:
 		selinux = _unicode_module_wrapper(_selinux, encoding=encoding)
@@ -173,16 +175,18 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 	if renamefailed:
 		if stat.S_ISREG(sstat[stat.ST_MODE]):
 			dest_tmp = dest + "#new"
+			dest_tmp_bytes = _unicode_encode(dest_tmp, encoding=encoding,
+				errors='strict')
 			try: # For safety copy then move it over.
 				if selinux_enabled:
 					selinux.copyfile(src, dest_tmp)
-					_copyxattr(src, dest_tmp)
-					_apply_stat(os, sstat, dest_tmp)
+					_copyxattr(src_bytes, dest_tmp_bytes)
+					_apply_stat(sstat, dest_tmp_bytes)
 					selinux.rename(dest_tmp, dest)
 				else:
 					shutil.copyfile(src, dest_tmp)
-					_copyxattr(src, dest_tmp)
-					_apply_stat(os, sstat, dest_tmp)
+					_copyxattr(src_bytes, dest_tmp_bytes)
+					_apply_stat(sstat, dest_tmp_bytes)
 					os.rename(dest_tmp, dest)
 				os.unlink(src)
 			except SystemExit as e:



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-11-29  4:26 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2011-11-29  4:26 UTC (permalink / raw
  To: gentoo-commits

commit:     ee59f1c63ecc54ad286c82c0adb2ae74011de69e
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 29 04:25:54 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Nov 29 04:25:54 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ee59f1c6

movefile: chown/mod before rename

---
 pym/portage/util/movefile.py |   22 +++++++---------------
 1 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index c205fe9..d15291a 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -16,6 +16,10 @@ from portage.localization import _
 from portage.process import spawn
 from portage.util import writemsg
 
+def _apply_stat(os, src_stat, dest):
+	os.chown(dest, src_stat.st_uid, src_stat.st_gid)
+	os.chmod(dest, stat.S_IMODE(src_stat.st_mode))
+
 if hasattr(_os, "getxattr"):
 	# Python >=3.3
 	def _copyxattr(src, dest):
@@ -167,19 +171,20 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 				return None
 			# Invalid cross-device-link 'bind' mounted or actually Cross-Device
 	if renamefailed:
-		didcopy=0
 		if stat.S_ISREG(sstat[stat.ST_MODE]):
 			dest_tmp = dest + "#new"
 			try: # For safety copy then move it over.
 				if selinux_enabled:
 					selinux.copyfile(src, dest_tmp)
 					_copyxattr(src, dest_tmp)
+					_apply_stat(os, sstat, dest_tmp)
 					selinux.rename(dest_tmp, dest)
 				else:
 					shutil.copyfile(src, dest_tmp)
 					_copyxattr(src, dest_tmp)
+					_apply_stat(os, sstat, dest_tmp)
 					os.rename(dest_tmp, dest)
-				didcopy=1
+				os.unlink(src)
 			except SystemExit as e:
 				raise
 			except Exception as e:
@@ -196,19 +201,6 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 					"dest": _unicode_decode(dest, encoding=encoding)}, noiselevel=-1)
 				writemsg("!!! %s\n" % a, noiselevel=-1)
 				return None # failure
-		try:
-			if didcopy:
-				# didcopy is True only if S_ISREG returned True
-				os.chown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID])
-				os.chmod(dest, stat.S_IMODE(sstat[stat.ST_MODE])) # Sticky is reset on chown
-				os.unlink(src)
-		except SystemExit as e:
-			raise
-		except Exception as e:
-			print(_("!!! Failed to chown/chmod/unlink in movefile()"))
-			print("!!!",dest)
-			print("!!!",e)
-			return None
 
 	# Always use stat_obj[stat.ST_MTIME] for the integral timestamp which
 	# is returned, since the stat_obj.st_mtime float attribute rounds *up*



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-11-29  3:09 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2011-11-29  3:09 UTC (permalink / raw
  To: gentoo-commits

commit:     9a353d3759f70043023eb36491ece0b9a8cdba6b
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 29 03:09:10 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Nov 29 03:09:10 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9a353d37

movefile: avoid redundant string concatenations

---
 pym/portage/util/movefile.py |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index 70ecb60..c205fe9 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -169,15 +169,16 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 	if renamefailed:
 		didcopy=0
 		if stat.S_ISREG(sstat[stat.ST_MODE]):
+			dest_tmp = dest + "#new"
 			try: # For safety copy then move it over.
 				if selinux_enabled:
-					selinux.copyfile(src, dest + "#new")
-					_copyxattr(src, dest + "#new")
-					selinux.rename(dest + "#new", dest)
+					selinux.copyfile(src, dest_tmp)
+					_copyxattr(src, dest_tmp)
+					selinux.rename(dest_tmp, dest)
 				else:
-					shutil.copyfile(src, dest + "#new")
-					_copyxattr(src, dest + "#new")
-					os.rename(dest + "#new", dest)
+					shutil.copyfile(src, dest_tmp)
+					_copyxattr(src, dest_tmp)
+					os.rename(dest_tmp, dest)
 				didcopy=1
 			except SystemExit as e:
 				raise



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-11-29  3:00 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2011-11-29  3:00 UTC (permalink / raw
  To: gentoo-commits

commit:     3c1111c248b11972f5d2316e6d8455b7fa11ccc4
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 29 03:00:15 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Nov 29 03:00:15 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3c1111c2

movefile: remove unused lchown

---
 pym/portage/util/movefile.py |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index 995f6e7..70ecb60 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -197,10 +197,8 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 				return None # failure
 		try:
 			if didcopy:
-				if stat.S_ISLNK(sstat[stat.ST_MODE]):
-					lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID])
-				else:
-					os.chown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID])
+				# didcopy is True only if S_ISREG returned True
+				os.chown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID])
 				os.chmod(dest, stat.S_IMODE(sstat[stat.ST_MODE])) # Sticky is reset on chown
 				os.unlink(src)
 		except SystemExit as e:



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-11-29  1:26 Arfrever Frehtes Taifersar Arahesis
  0 siblings, 0 replies; 134+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2011-11-29  1:26 UTC (permalink / raw
  To: gentoo-commits

commit:     ddc9dbc832b3424da722f7442cf33327423735a6
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Gentoo <DOT> Org>
AuthorDate: Tue Nov 29 01:26:04 2011 +0000
Commit:     Arfrever Frehtes Taifersar Arahesis <arfrever <AT> gentoo <DOT> org>
CommitDate: Tue Nov 29 01:26:04 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ddc9dbc8

Preserve extended attributes on regular files when using Python >=3.3.

---
 pym/portage/util/movefile.py |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index 30cb6f1..995f6e7 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -16,6 +16,16 @@ from portage.localization import _
 from portage.process import spawn
 from portage.util import writemsg
 
+if hasattr(_os, "getxattr"):
+	# Python >=3.3
+	def _copyxattr(src, dest):
+		for attr in _os.listxattr(src):
+			_os.setxattr(dest, attr, _os.getxattr(src, attr))
+else:
+	def _copyxattr(src, dest):
+		pass
+		# Maybe call getfattr and setfattr executables.
+
 def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 		hardlink_candidates=None, encoding=_encodings['fs']):
 	"""moves a file from src to dest, preserving all permissions and attributes; mtime will
@@ -162,10 +172,12 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 			try: # For safety copy then move it over.
 				if selinux_enabled:
 					selinux.copyfile(src, dest + "#new")
+					_copyxattr(src, dest + "#new")
 					selinux.rename(dest + "#new", dest)
 				else:
-					shutil.copyfile(src,dest+"#new")
-					os.rename(dest+"#new",dest)
+					shutil.copyfile(src, dest + "#new")
+					_copyxattr(src, dest + "#new")
+					os.rename(dest + "#new", dest)
 				didcopy=1
 			except SystemExit as e:
 				raise



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-10-30  0:25 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2011-10-30  0:25 UTC (permalink / raw
  To: gentoo-commits

commit:     31afcd8307f623e8a454ae5029b3599420f5440c
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 30 00:25:42 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Oct 30 00:25:42 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=31afcd83

env_update: lstrip os.sep in join with eprefix

---
 pym/portage/util/env_update.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/pym/portage/util/env_update.py b/pym/portage/util/env_update.py
index 1435932..7879ed9 100644
--- a/pym/portage/util/env_update.py
+++ b/pym/portage/util/env_update.py
@@ -51,7 +51,8 @@ def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None,
 				target_eroot = portage.settings['EROOT']
 			else:
 				eprefix = os.environ.get("__PORTAGE_TEST_EPREFIX", "")
-				target_eroot = os.path.join(target_root, eprefix)
+				target_eroot = os.path.join(target_root,
+					eprefix.lstrip(os.sep))
 				target_eroot = target_eroot.rstrip(os.sep) + os.sep
 			if hasattr(portage, "db") and target_eroot in portage.db:
 				vardbapi = portage.db[target_eroot]["vartree"].dbapi



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-10-08 15:15 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2011-10-08 15:15 UTC (permalink / raw
  To: gentoo-commits

commit:     8be5cd692c5a49c3dcdee41a3950bda822fdeaf4
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Oct  8 15:15:27 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Oct  8 15:15:27 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=8be5cd69

whirlpool.py: tabs to spaces

---
 pym/portage/util/whirlpool.py |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/pym/portage/util/whirlpool.py b/pym/portage/util/whirlpool.py
index c5c2b37..8415e87 100644
--- a/pym/portage/util/whirlpool.py
+++ b/pym/portage/util/whirlpool.py
@@ -786,9 +786,9 @@ def processBuffer(ctx):
 #
 
 if __name__ == '__main__':
-	assert Whirlpool(b'The quick brown fox jumps over the lazy dog').hexdigest() == \
-		'b97de512e91e3828b40d2b0fdce9ceb3c4a71f9bea8d88e75c4fa854df36725fd2b52eb6544edcacd6f8beddfea403cb55ae31f03ad62a5ef54e42ee82c3fb35'
-	assert Whirlpool(b'The quick brown fox jumps over the lazy eog').hexdigest() == \
-		'c27ba124205f72e6847f3e19834f925cc666d0974167af915bb462420ed40cc50900d85a1f923219d832357750492d5c143011a76988344c2635e69d06f2d38c'
-	assert Whirlpool(b'').hexdigest() == \
-		'19fa61d75522a4669b44e39c1d2e1726c530232130d407f89afee0964997f7a73e83be698b288febcf88e3e03c4f0757ea8964e59b63d93708b138cc42a66eb3'
+    assert Whirlpool(b'The quick brown fox jumps over the lazy dog').hexdigest() == \
+        'b97de512e91e3828b40d2b0fdce9ceb3c4a71f9bea8d88e75c4fa854df36725fd2b52eb6544edcacd6f8beddfea403cb55ae31f03ad62a5ef54e42ee82c3fb35'
+    assert Whirlpool(b'The quick brown fox jumps over the lazy eog').hexdigest() == \
+        'c27ba124205f72e6847f3e19834f925cc666d0974167af915bb462420ed40cc50900d85a1f923219d832357750492d5c143011a76988344c2635e69d06f2d38c'
+    assert Whirlpool(b'').hexdigest() == \
+        '19fa61d75522a4669b44e39c1d2e1726c530232130d407f89afee0964997f7a73e83be698b288febcf88e3e03c4f0757ea8964e59b63d93708b138cc42a66eb3'



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-10-05  0:59 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2011-10-05  0:59 UTC (permalink / raw
  To: gentoo-commits

commit:     3a37b7c5b5d7b70777c67180279f557fd70b52f4
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Oct  5 00:59:30 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Oct  5 00:59:30 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3a37b7c5

whirlpool.py: fix for python3

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

diff --git a/pym/portage/util/whirlpool.py b/pym/portage/util/whirlpool.py
index 399958a..c5c2b37 100644
--- a/pym/portage/util/whirlpool.py
+++ b/pym/portage/util/whirlpool.py
@@ -639,7 +639,8 @@ def WhirlpoolInit(ctx):
     return
 
 def WhirlpoolAdd(source, sourceBits, ctx):
-    source = [ord(s)&0xff for s in source]
+    if sys.hexversion < 0x3000000:
+        source = [ord(s)&0xff for s in source]
 
     carry = 0
     value = sourceBits
@@ -785,9 +786,9 @@ def processBuffer(ctx):
 #
 
 if __name__ == '__main__':
-	assert Whirlpool('The quick brown fox jumps over the lazy dog').hexdigest() == \
+	assert Whirlpool(b'The quick brown fox jumps over the lazy dog').hexdigest() == \
 		'b97de512e91e3828b40d2b0fdce9ceb3c4a71f9bea8d88e75c4fa854df36725fd2b52eb6544edcacd6f8beddfea403cb55ae31f03ad62a5ef54e42ee82c3fb35'
-	assert Whirlpool('The quick brown fox jumps over the lazy eog').hexdigest() == \
+	assert Whirlpool(b'The quick brown fox jumps over the lazy eog').hexdigest() == \
 		'c27ba124205f72e6847f3e19834f925cc666d0974167af915bb462420ed40cc50900d85a1f923219d832357750492d5c143011a76988344c2635e69d06f2d38c'
-	assert Whirlpool('').hexdigest() == \
+	assert Whirlpool(b'').hexdigest() == \
 		'19fa61d75522a4669b44e39c1d2e1726c530232130d407f89afee0964997f7a73e83be698b288febcf88e3e03c4f0757ea8964e59b63d93708b138cc42a66eb3'



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-10-04 16:40 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2011-10-04 16:40 UTC (permalink / raw
  To: gentoo-commits

commit:     e3df9adb0b53349bc129732cd255de9af142d59a
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Oct  4 16:39:58 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Oct  4 16:39:58 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e3df9adb

whirlpool.py: skip tests during import

---
 pym/portage/util/whirlpool.py |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/pym/portage/util/whirlpool.py b/pym/portage/util/whirlpool.py
index 5f5c76b..399958a 100644
--- a/pym/portage/util/whirlpool.py
+++ b/pym/portage/util/whirlpool.py
@@ -784,9 +784,10 @@ def processBuffer(ctx):
 # Tests.
 #
 
-assert Whirlpool('The quick brown fox jumps over the lazy dog').hexdigest() == \
-       'b97de512e91e3828b40d2b0fdce9ceb3c4a71f9bea8d88e75c4fa854df36725fd2b52eb6544edcacd6f8beddfea403cb55ae31f03ad62a5ef54e42ee82c3fb35'
-assert Whirlpool('The quick brown fox jumps over the lazy eog').hexdigest() == \
-       'c27ba124205f72e6847f3e19834f925cc666d0974167af915bb462420ed40cc50900d85a1f923219d832357750492d5c143011a76988344c2635e69d06f2d38c'
-assert Whirlpool('').hexdigest() == \
-       '19fa61d75522a4669b44e39c1d2e1726c530232130d407f89afee0964997f7a73e83be698b288febcf88e3e03c4f0757ea8964e59b63d93708b138cc42a66eb3'
+if __name__ == '__main__':
+	assert Whirlpool('The quick brown fox jumps over the lazy dog').hexdigest() == \
+		'b97de512e91e3828b40d2b0fdce9ceb3c4a71f9bea8d88e75c4fa854df36725fd2b52eb6544edcacd6f8beddfea403cb55ae31f03ad62a5ef54e42ee82c3fb35'
+	assert Whirlpool('The quick brown fox jumps over the lazy eog').hexdigest() == \
+		'c27ba124205f72e6847f3e19834f925cc666d0974167af915bb462420ed40cc50900d85a1f923219d832357750492d5c143011a76988344c2635e69d06f2d38c'
+	assert Whirlpool('').hexdigest() == \
+		'19fa61d75522a4669b44e39c1d2e1726c530232130d407f89afee0964997f7a73e83be698b288febcf88e3e03c4f0757ea8964e59b63d93708b138cc42a66eb3'



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-10-02  5:42 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2011-10-02  5:42 UTC (permalink / raw
  To: gentoo-commits

commit:     47c5f5c9a9891cc296e989d8f29ffb74ef7738a3
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Oct  2 05:42:22 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Oct  2 05:42:22 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=47c5f5c9

whirlpool.py: handle xrange for python3

---
 pym/portage/util/whirlpool.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/pym/portage/util/whirlpool.py b/pym/portage/util/whirlpool.py
index 3e7cd71..5f5c76b 100644
--- a/pym/portage/util/whirlpool.py
+++ b/pym/portage/util/whirlpool.py
@@ -25,6 +25,10 @@
 ##
 ## This Python implementation is therefore also placed in the public domain.
 
+import sys
+if sys.hexversion >= 0x3000000:
+    xrange = range
+
 #block_size = 64
 digest_size = 64
 digestsize = 64



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-09-18 23:45 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2011-09-18 23:45 UTC (permalink / raw
  To: gentoo-commits

commit:     89664c0c4280372be5b593880c2ac5ccc695f688
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 18 23:45:20 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Sep 18 23:45:20 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=89664c0c

env_update: add more vardbapi fallback code

For API consumers that call this function without the vardbapi
parameter, it whould continue to work correctly in all the cases
that worked before the vardbapi was added.

---
 pym/portage/util/env_update.py |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/pym/portage/util/env_update.py b/pym/portage/util/env_update.py
index 78bef82..65ed2db 100644
--- a/pym/portage/util/env_update.py
+++ b/pym/portage/util/env_update.py
@@ -47,7 +47,15 @@ def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None,
 		else:
 			if target_root is None:
 				target_root = portage.settings["ROOT"]
-			vardbapi = portage.db[target_root]["vartree"].dbapi
+			if hasattr(portage, "db") and target_root in portage.db:
+				vardbapi = portage.db[target_root]["vartree"].dbapi
+			else:
+				settings = config(config_root=target_root,
+					target_root=target_root)
+				target_root = settings["ROOT"]
+				if env is None:
+					env = settings
+				vardbapi = vartree(settings=settings).dbapi
 
 	# Lock the config memory file to prevent symlink creation
 	# in merge_contents from overlapping with env-update.



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-09-18 22:47 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2011-09-18 22:47 UTC (permalink / raw
  To: gentoo-commits

commit:     1a5a662780f7a4401a89f0939a9180872f36f05f
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 18 22:47:45 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Sep 18 22:47:45 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1a5a6627

env_update: use global vardbapi as fallback

---
 pym/portage/util/env_update.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/pym/portage/util/env_update.py b/pym/portage/util/env_update.py
index 71dcf37..78bef82 100644
--- a/pym/portage/util/env_update.py
+++ b/pym/portage/util/env_update.py
@@ -20,6 +20,7 @@ from portage.util import atomic_ofstream, ensure_dirs, getconfig, \
 	normalize_path, writemsg
 from portage.util.listdir import listdir
 from portage.dbapi.vartree import vartree
+from portage.package.ebuild.config import config
 
 if sys.hexversion >= 0x3000000:
 	long = int
@@ -41,7 +42,12 @@ def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None,
 	@type target_root: String (Path)
 	"""
 	if vardbapi is None:
-		vardbapi = vartree(settings=portage.settings).dbapi
+		if isinstance(env, config):
+			vardbapi = vartree(settings=env).dbapi
+		else:
+			if target_root is None:
+				target_root = portage.settings["ROOT"]
+			vardbapi = portage.db[target_root]["vartree"].dbapi
 
 	# Lock the config memory file to prevent symlink creation
 	# in merge_contents from overlapping with env-update.



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-09-14 20:42 Arfrever Frehtes Taifersar Arahesis
  0 siblings, 0 replies; 134+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2011-09-14 20:42 UTC (permalink / raw
  To: gentoo-commits

commit:     3661e42c50840d50fa74e4114aa0eb2035c98e38
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Gentoo <DOT> Org>
AuthorDate: Wed Sep 14 20:39:06 2011 +0000
Commit:     Arfrever Frehtes Taifersar Arahesis <arfrever <AT> gentoo <DOT> org>
CommitDate: Wed Sep 14 20:39:06 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3661e42c

Fix grammar in some messages.

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

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index de3abda..20eecd6 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -318,11 +318,11 @@ def stack_lists(lists, incremental=1, remember_source_file=False,
 		for source_file, tokens in unmatched_removals.items():
 			if len(tokens) > 3:
 				selected = [tokens.pop(), tokens.pop(), tokens.pop()]
-				writemsg(_("--- Unmatch removal atoms in %s: %s and %s more\n") % \
+				writemsg(_("--- Unmatched removal atoms in %s: %s and %s more\n") % \
 					(source_file, ", ".join(selected), len(tokens)),
 					noiselevel=-1)
 			else:
-				writemsg(_("--- Unmatch removal atom(s) in %s: %s\n") % (source_file, ", ".join(tokens)),
+				writemsg(_("--- Unmatched removal atom(s) in %s: %s\n") % (source_file, ", ".join(tokens)),
 					noiselevel=-1)
 
 	if remember_source_file:



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-08-30 19:41 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2011-08-30 19:41 UTC (permalink / raw
  To: gentoo-commits

commit:     273934172ede4ae1e2a9a7b2b8bc03885691f10e
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 30 19:40:53 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Aug 30 19:40:53 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=27393417

Fix typo in previous commit.

---
 pym/portage/util/env_update.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/pym/portage/util/env_update.py b/pym/portage/util/env_update.py
index 0d80fa3..a6c850e 100644
--- a/pym/portage/util/env_update.py
+++ b/pym/portage/util/env_update.py
@@ -231,7 +231,7 @@ def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None,
 
 	if makelinks and \
 		not mtime_changed and \
-		and not ldsoconf_update and \
+		not ldsoconf_update and \
 		contents is not None:
 		libdir_contents_changed = False
 		for mypath, mydata in contents.items():



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-08-30 19:40 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2011-08-30 19:40 UTC (permalink / raw
  To: gentoo-commits

commit:     f87d1ef9b0b79b5a9e8f59291e7173363cd7386e
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 30 19:39:51 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Aug 30 19:39:51 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f87d1ef9

env_update: use ldsoconf_update var

This fixes an unintended change in behavior from commit
a37eb8ebd2fad3f8074490a061f067e2c637f05d, so that the ldconfig call
will not be skipped when ld.so.conf has been updated (though ldconfig
is still never called when makelinks=False).

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

diff --git a/pym/portage/util/env_update.py b/pym/portage/util/env_update.py
index 1731663..0d80fa3 100644
--- a/pym/portage/util/env_update.py
+++ b/pym/portage/util/env_update.py
@@ -231,6 +231,7 @@ def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None,
 
 	if makelinks and \
 		not mtime_changed and \
+		and not ldsoconf_update and \
 		contents is not None:
 		libdir_contents_changed = False
 		for mypath, mydata in contents.items():



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-08-29 15:58 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2011-08-29 15:58 UTC (permalink / raw
  To: gentoo-commits

commit:     ee7ee34f4669cfdef6867952b6830d15e4caae01
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 29 15:57:55 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Aug 29 15:57:55 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ee7ee34f

env_update: fix breakage in last commit

---
 pym/portage/util/env_update.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/pym/portage/util/env_update.py b/pym/portage/util/env_update.py
index d47c69e..c670ded 100644
--- a/pym/portage/util/env_update.py
+++ b/pym/portage/util/env_update.py
@@ -50,7 +50,7 @@ def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None,
 	else:
 		settings = env
 
-	eprefix = env.get("EPREFIX", "")
+	eprefix = settings.get("EPREFIX", "")
 	eprefix_lstrip = eprefix.lstrip(os.sep)
 	envd_dir = os.path.join(target_root, eprefix_lstrip, "etc", "env.d")
 	ensure_dirs(envd_dir, mode=0o755)



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-08-29  7:40 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2011-08-29  7:40 UTC (permalink / raw
  To: gentoo-commits

commit:     35d900fab79b934517a2bf611bd919cb6a99aa7d
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 29 07:40:11 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Aug 29 07:40:11 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=35d900fa

env_update: fix CHOST/CBUILD ldconfig code

This code never worked (since it was added in commit
751893b0272561eb9274110a474d5436a7d2bc76) due to a name collision
between the env argument and another variable with the same name.

---
 pym/portage/util/env_update.py |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/pym/portage/util/env_update.py b/pym/portage/util/env_update.py
index 3dc84d4..d47c69e 100644
--- a/pym/portage/util/env_update.py
+++ b/pym/portage/util/env_update.py
@@ -46,7 +46,9 @@ def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None,
 	if prev_mtimes is None:
 		prev_mtimes = portage.mtimedb["ldpath"]
 	if env is None:
-		env = os.environ
+		settings = os.environ
+	else:
+		settings = env
 
 	eprefix = env.get("EPREFIX", "")
 	eprefix_lstrip = eprefix.lstrip(os.sep)
@@ -245,9 +247,9 @@ def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None,
 			makelinks = False
 
 	ldconfig = "/sbin/ldconfig"
-	if "CHOST" in env and "CBUILD" in env and \
-		env["CHOST"] != env["CBUILD"]:
-		ldconfig = find_binary("%s-ldconfig" % env["CHOST"])
+	if "CHOST" in settings and "CBUILD" in settings and \
+		settings["CHOST"] != settings["CBUILD"]:
+		ldconfig = find_binary("%s-ldconfig" % settings["CHOST"])
 
 	# Only run ldconfig as needed
 	if (ld_cache_update or makelinks) and ldconfig and not eprefix:



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-06-30 12:49 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2011-06-30 12:49 UTC (permalink / raw
  To: gentoo-commits

commit:     687502c050604b26e4c5e85339a2d9294672fe1f
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 30 12:49:18 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Jun 30 12:49:18 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=687502c0

Fix a typo in a comment.

---
 pym/portage/util/__init__.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index f877362..85b2ada 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -688,7 +688,7 @@ def varexpand(mystring, mydict=None):
 				# behave like bash does when expanding a variable assignment
 				# in a sourced file, in which case it performs backslash
 				# removal for \\ and \$ but nothing more. Note that we don't
-				# handle escaped quotes here, since genconfig() uses shlex
+				# handle escaped quotes here, since getconfig() uses shlex
 				# to handle that earlier.
 				if (pos+1>=len(mystring)):
 					newstring=newstring+mystring[pos]



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-06-30  1:52 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2011-06-30  1:52 UTC (permalink / raw
  To: gentoo-commits

commit:     a1d16a01c4ca0b2b196e9256b4f309157c5545fd
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 30 01:50:54 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Jun 30 01:50:54 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a1d16a01

env_update: document ldconfig -X for bug #373341

---
 pym/portage/util/env_update.py |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/pym/portage/util/env_update.py b/pym/portage/util/env_update.py
index a82afdf..3e295f0 100644
--- a/pym/portage/util/env_update.py
+++ b/pym/portage/util/env_update.py
@@ -27,7 +27,14 @@ def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None,
 	env=None, writemsg_level=None):
 	"""
 	Parse /etc/env.d and use it to generate /etc/profile.env, csh.env,
-	ld.so.conf, and prelink.conf. Finally, run ldconfig.
+	ld.so.conf, and prelink.conf. Finally, run ldconfig. When ldconfig is
+	called, its -X option will be used in order to avoid potential
+	interference with installed soname symlinks that are required for
+	correct operation of FEATURES=preserve-libs for downgrade operations.
+	It's not necessary for ldconfig to create soname symlinks, since
+	portage will use NEEDED.ELF.2 data to automatically create them
+	after src_install if they happen to be missing.
+	@param makelinks: True if ldconfig should be called, False otherwise
 	@param target_root: root that is passed to the ldconfig -r option,
 		defaults to portage.settings["ROOT"].
 	@type target_root: String (Path)



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-06-28 14:16 Arfrever Frehtes Taifersar Arahesis
  0 siblings, 0 replies; 134+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2011-06-28 14:16 UTC (permalink / raw
  To: gentoo-commits

commit:     f23816d7e520bf1f27eb2778d0129e9ad9d576e4
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Gentoo <DOT> Org>
AuthorDate: Tue Jun 28 14:15:28 2011 +0000
Commit:     Arfrever Frehtes Taifersar Arahesis <arfrever <AT> gentoo <DOT> org>
CommitDate: Tue Jun 28 14:15:28 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f23816d7

read_corresponding_eapi_file(): Strip final \n from EAPI value.

---
 pym/portage/util/__init__.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index ece0806..31a808b 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -390,7 +390,7 @@ def read_corresponding_eapi_file(filename):
 		f = open(eapi_file, "r")
 		lines = f.readlines()
 		if len(lines) == 1:
-			eapi = lines[0]
+			eapi = lines[0].rstrip("\n")
 		else:
 			writemsg(_("--- Invalid 'eapi' file (doesn't contain exactly one line): %s\n") % (eapi_file),
 				noiselevel=-1)



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-06-09 13:01 Arfrever Frehtes Taifersar Arahesis
  0 siblings, 0 replies; 134+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2011-06-09 13:01 UTC (permalink / raw
  To: gentoo-commits

commit:     a2e391558915c29a5d1771bed2f39173398b289d
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Gentoo <DOT> Org>
AuthorDate: Thu Jun  9 13:00:55 2011 +0000
Commit:     Arfrever Frehtes Taifersar Arahesis <arfrever <AT> gentoo <DOT> org>
CommitDate: Thu Jun  9 13:00:55 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a2e39155

Fix a typo and update a comment.

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

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 28e9428..8c53522 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -535,8 +535,8 @@ def getconfig(mycfg, tolerant=0, allow_sourcing=False, expand=True):
 		expand_map = {}
 	mykeys = {}
 	try:
-		# NOTE: shex doesn't seem to support unicode objects
-		# (produces spurious \0 characters with python-2.6.2)
+		# NOTE: shlex doesn't support unicode objects with Python 2
+		# (produces spurious \0 characters).
 		if sys.hexversion < 0x3000000:
 			content = open(_unicode_encode(mycfg,
 				encoding=_encodings['fs'], errors='strict'), 'rb').read()



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-05-25  4:56 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2011-05-25  4:56 UTC (permalink / raw
  To: gentoo-commits

commit:     5a5a15fe39adab09d9a0e0d2b1d4ee7064278c09
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed May 25 04:55:59 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed May 25 04:55:59 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=5a5a15fe

writedict: raise any exceptions

We don't have any code that checks the writedict return value, so we'd
better raise an exception if it fails.

---
 pym/portage/util/__init__.py |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 3cf6c5b..0dff25f 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -505,8 +505,7 @@ def writedict(mydict,myfilename,writekey=True):
 	except IOError:
 		if myfile is not None:
 			myfile.abort()
-		return 0
-	return 1
+		raise
 
 def shlex_split(s):
 	"""



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-05-25  4:53 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2011-05-25  4:53 UTC (permalink / raw
  To: gentoo-commits

commit:     346c2b767c4e129bc1c114ed6e455c9a0737d39d
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed May 25 04:52:40 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed May 25 04:52:40 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=346c2b76

atomic_ofstream: suppress redundant open error

---
 pym/portage/util/__init__.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index c288434..3cf6c5b 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -1125,9 +1125,9 @@ class atomic_ofstream(ObjectProxy):
 			except IOError as e:
 				if canonical_path == filename:
 					raise
-				writemsg(_("!!! Failed to open file: '%s'\n") % tmp_name,
-					noiselevel=-1)
-				writemsg("!!! %s\n" % str(e), noiselevel=-1)
+				# Ignore this error, since it's irrelevant
+				# and the below open call will produce a
+				# new error if necessary.
 
 		object.__setattr__(self, '_real_name', filename)
 		tmp_name = "%s.%i" % (filename, os.getpid())



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-05-18  1:43 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2011-05-18  1:43 UTC (permalink / raw
  To: gentoo-commits

commit:     6201d99b8be4da50fc203ef5b758044defa80b0b
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed May 18 01:43:32 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed May 18 01:43:32 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=6201d99b

digraph: implement __bool__

---
 pym/portage/util/digraph.py |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/pym/portage/util/digraph.py b/pym/portage/util/digraph.py
index df024fb..1bbe10f 100644
--- a/pym/portage/util/digraph.py
+++ b/pym/portage/util/digraph.py
@@ -1,9 +1,11 @@
-# Copyright 2010 Gentoo Foundation
+# Copyright 2010-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 __all__ = ['digraph']
 
 from collections import deque
+import sys
+
 from portage import _unicode_decode
 from portage.util import writemsg
 
@@ -221,6 +223,9 @@ class digraph(object):
 					root_nodes.append(node)
 		return root_nodes
 
+	def __bool__(self):
+		return bool(self.nodes)
+
 	def is_empty(self):
 		"""Checks if the digraph is empty"""
 		return len(self.nodes) == 0
@@ -332,3 +337,6 @@ class digraph(object):
 	__contains__ = contains
 	empty = is_empty
 	copy = clone
+
+	if sys.hexversion < 0x3000000:
+		__nonzero__ = __bool__



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-05-15  4:40 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2011-05-15  4:40 UTC (permalink / raw
  To: gentoo-commits

commit:     5fc6f2b77d853eec51d6dbdfbfecc5dd7c5b5648
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun May 15 04:39:26 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun May 15 04:39:26 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=5fc6f2b7

movefile: handle EEXIST when os.symlink fails

---
 pym/portage/util/movefile.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index f8cc695..e07e8ca 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -90,7 +90,8 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
 				# to tolerate these links being recreated during the merge
 				# process. In any case, if the link is pointing at the right
 				# place, we're in good shape.
-				if e.errno != errno.ENOENT or target != os.readlink(dest):
+				if e.errno not in (errno.ENOENT, errno.EEXIST) or \
+					target != os.readlink(dest):
 					raise
 			lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID])
 			# utime() only works on the target of a symlink, so it's not



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-03-25 17:11 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2011-03-25 17:11 UTC (permalink / raw
  To: gentoo-commits

commit:     83e1a973f7abc19c099a8459209ca0979246896b
Author:     David James <davidjames <AT> google <DOT> com>
AuthorDate: Fri Mar 25 17:10:54 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Mar 25 17:10:54 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=83e1a973

env_update: remove sleep_for_mtime_granularity

Instead of sleeping, use os.utime to avoid mtime ambiguity.

Change-Id: I359ececca19b6be9f5997ac5c8fe6fea6ea49dd5

Review URL: http://codereview.chromium.org/6676150

---
 pym/portage/util/env_update.py |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/pym/portage/util/env_update.py b/pym/portage/util/env_update.py
index 68531da..e2cb97f 100644
--- a/pym/portage/util/env_update.py
+++ b/pym/portage/util/env_update.py
@@ -181,11 +181,6 @@ def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None,
 			newprelink.write("-b %s\n" % (x,))
 		newprelink.close()
 
-	# Portage stores mtimes with 1 second granularity but in >=python-2.5 finer
-	# granularity is possible.  In order to avoid the potential ambiguity of
-	# mtimes that differ by less than 1 second, sleep here if any of the
-	# directories have been modified during the current second.
-	sleep_for_mtime_granularity = False
 	current_time = long(time.time())
 	mtime_changed = False
 	lib_dirs = set()
@@ -205,8 +200,13 @@ def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None,
 				continue
 			raise
 		if newldpathtime == current_time:
-			sleep_for_mtime_granularity = True
-		if x in prev_mtimes:
+			# Reset mtime to avoid the potential ambiguity of times that
+			# differ by less than 1 second.
+			newldpathtime -= 1
+			os.utime(x, (newldpathtime, newldpathtime))
+			prev_mtimes[x] = newldpathtime
+			mtime_changed = True
+		elif x in prev_mtimes:
 			if prev_mtimes[x] == newldpathtime:
 				pass
 			else:
@@ -287,7 +287,3 @@ def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None,
 	for x in env_keys:
 		outfile.write("setenv %s '%s'\n" % (x, env[x]))
 	outfile.close()
-
-	if sleep_for_mtime_granularity:
-		while current_time == long(time.time()):
-			time.sleep(1)



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-03-02 17:59 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2011-03-02 17:59 UTC (permalink / raw
  To: gentoo-commits

commit:     39a2714f4a745ea3ba8e6c3e3cb0c01847ea413d
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Mar  2 17:59:11 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Mar  2 17:59:11 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=39a2714f

grablines: allow inline comments

---
 pym/portage/util/__init__.py |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 0eaaeb2..0e05a41 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -125,8 +125,18 @@ def grabfile(myfilename, compat_level=0, recursive=0, remember_source_file=False
 	for x, source_file in mylines:
 		#the split/join thing removes leading and trailing whitespace, and converts any whitespace in the line
 		#into single spaces.
-		myline = _unicode_decode(' ').join(x.split())
-		if not len(myline):
+		myline = x.split()
+		if x and x[0] != "#":
+			mylinetemp = []
+			for item in myline:
+				if item[:1] != "#":
+					mylinetemp.append(item)
+				else:
+					break
+			myline = mylinetemp
+
+		myline = " ".join(myline)
+		if not myline:
 			continue
 		if myline[0]=="#":
 			# Check if we have a compat-level string. BC-integration data.
@@ -351,7 +361,7 @@ def grabdict(myfilename, juststrings=0, empty=0, recursive=0, incremental=1):
 		myline=x.split()
 		mylinetemp = []
 		for item in myline:
-			if not item.startswith('#'):
+			if item[:1] != "#":
 				mylinetemp.append(item)
 			else:
 				break



^ permalink raw reply related	[flat|nested] 134+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/
@ 2011-03-02 17:40 Zac Medico
  0 siblings, 0 replies; 134+ messages in thread
From: Zac Medico @ 2011-03-02 17:40 UTC (permalink / raw
  To: gentoo-commits

commit:     3ad5122a80f741119b48cb7f0f5107e64e2e3b11
Author:     Theo Chatzimichos <tampakrap <AT> gentoo <DOT> org>
AuthorDate: Wed Mar  2 17:39:56 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Mar  2 17:39:56 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3ad5122a

grabdict: allow inline comments

---
 pym/portage/util/__init__.py |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index d180f6b..0eaaeb2 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -349,6 +349,13 @@ def grabdict(myfilename, juststrings=0, empty=0, recursive=0, incremental=1):
 		if x[0] == "#":
 			continue
 		myline=x.split()
+		mylinetemp = []
+		for item in myline:
+			if not item.startswith('#'):
+				mylinetemp.append(item)
+			else:
+				break
+		myline = mylinetemp
 		if len(myline) < 2 and empty == 0:
 			continue
 		if len(myline) < 1 and empty == 1:



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

end of thread, other threads:[~2018-04-02 17:11 UTC | newest]

Thread overview: 134+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-04  2:38 [gentoo-commits] proj/portage:master commit in: pym/portage/util/ Zac Medico
  -- strict thread matches above, loose matches on Subject: below --
2018-04-02 17:11 Zac Medico
2018-03-28  6:52 Zac Medico
2017-08-21 16:50 Zac Medico
2017-08-21 15:59 Zac Medico
2017-02-23 16:33 Zac Medico
2017-02-21 17:44 Zac Medico
2017-01-22 18:46 Zac Medico
2017-01-07 23:07 Zac Medico
2016-09-18 22:26 Zac Medico
2016-09-18 22:26 Zac Medico
2016-09-18 22:26 Zac Medico
2016-09-14 23:14 Brian Dolbec
2015-11-22 20:53 Zac Medico
2015-11-21 18:12 Zac Medico
2015-11-16  1:29 Zac Medico
2015-11-15 22:54 Michał Górny
2015-10-06 20:24 Zac Medico
2015-06-05  1:59 Zac Medico
2015-05-04  6:43 Zac Medico
2015-04-11 16:02 Zac Medico
2015-01-22 17:09 Brian Dolbec
2015-01-22 17:09 Brian Dolbec
2015-01-18 18:04 Michał Górny
2014-12-02 19:07 Brian Dolbec
2014-04-04 23:01 Brian Dolbec
2014-02-05 19:42 Sebastian Luther
2013-10-16 23:25 Brian Dolbec
2013-10-16 20:47 Mike Frysinger
2013-10-15 21:56 Mike Frysinger
2013-09-16 16:51 Arfrever Frehtes Taifersar Arahesis
2013-09-15  9:36 Zac Medico
2013-09-15  0:51 Zac Medico
2013-09-11 14:07 Zac Medico
2013-09-03 20:03 Zac Medico
2013-08-27 19:32 Zac Medico
2013-08-13 18:17 Zac Medico
2013-08-13 15:46 Zac Medico
2013-08-12  3:01 Zac Medico
2013-08-03  9:39 Zac Medico
2013-08-02 23:03 Zac Medico
2013-08-02 18:06 Zac Medico
2013-07-02 17:15 Zac Medico
2013-06-28  1:46 Zac Medico
2013-06-27 21:32 Zac Medico
2013-06-24  4:29 Zac Medico
2013-06-24  2:27 Zac Medico
2013-05-14  0:30 Zac Medico
2013-05-13 15:27 Mike Frysinger
2013-04-16 14:01 Zac Medico
2013-03-27 15:02 Zac Medico
2013-03-19  8:00 Zac Medico
2013-03-19  6:38 Zac Medico
2013-03-19  6:22 Zac Medico
2013-03-19  5:56 Zac Medico
2013-01-10 14:47 Zac Medico
2012-12-28 22:31 Zac Medico
2012-11-30  2:10 Arfrever Frehtes Taifersar Arahesis
2012-11-29 20:32 Arfrever Frehtes Taifersar Arahesis
2012-11-15  3:41 Zac Medico
2012-10-28 19:26 Zac Medico
2012-10-25  8:35 Zac Medico
2012-09-24  3:01 Zac Medico
2012-09-24  2:25 Zac Medico
2012-09-13 18:40 Zac Medico
2012-09-03 19:51 Zac Medico
2012-09-02 19:33 Zac Medico
2012-09-02 19:31 Zac Medico
2012-08-26 21:46 Zac Medico
2012-08-04 19:27 Zac Medico
2012-08-02 19:55 Zac Medico
2012-08-02  2:28 Zac Medico
2012-08-02  2:26 Zac Medico
2012-08-02  2:22 Zac Medico
2012-08-02  0:57 Zac Medico
2012-06-17 15:22 Zac Medico
2012-06-01 21:30 Zac Medico
2012-05-17 20:21 Zac Medico
2012-05-16 23:58 Zac Medico
2012-05-16  0:07 Zac Medico
2012-05-01 21:21 Zac Medico
2012-03-31 23:19 Zac Medico
2012-03-31 21:17 Zac Medico
2012-03-31 20:27 Zac Medico
2012-03-31 19:48 Zac Medico
2012-03-28  1:50 Zac Medico
2012-03-27 16:31 Zac Medico
2012-03-27 15:42 Zac Medico
2012-03-23 19:58 Zac Medico
2012-03-23 18:22 Zac Medico
2012-03-23 18:20 Zac Medico
2012-03-23 18:05 Zac Medico
2012-03-22 21:37 Zac Medico
2012-03-05  9:55 Zac Medico
2012-02-18  3:40 Zac Medico
2012-02-18  3:11 Zac Medico
2012-02-18  2:41 Zac Medico
2012-01-12  1:35 Zac Medico
2012-01-10  0:37 Zac Medico
2012-01-03 21:59 Zac Medico
2012-01-03 21:36 Zac Medico
2011-12-22 21:36 Zac Medico
2011-12-10 19:41 Zac Medico
2011-12-10  5:28 Arfrever Frehtes Taifersar Arahesis
2011-12-10  0:03 Arfrever Frehtes Taifersar Arahesis
2011-12-09 23:53 Arfrever Frehtes Taifersar Arahesis
2011-11-29  4:52 Zac Medico
2011-11-29  4:26 Zac Medico
2011-11-29  3:09 Zac Medico
2011-11-29  3:00 Zac Medico
2011-11-29  1:26 Arfrever Frehtes Taifersar Arahesis
2011-10-30  0:25 Zac Medico
2011-10-08 15:15 Zac Medico
2011-10-05  0:59 Zac Medico
2011-10-04 16:40 Zac Medico
2011-10-02  5:42 Zac Medico
2011-09-18 23:45 Zac Medico
2011-09-18 22:47 Zac Medico
2011-09-14 20:42 Arfrever Frehtes Taifersar Arahesis
2011-08-30 19:41 Zac Medico
2011-08-30 19:40 Zac Medico
2011-08-29 15:58 Zac Medico
2011-08-29  7:40 Zac Medico
2011-06-30 12:49 Zac Medico
2011-06-30  1:52 Zac Medico
2011-06-28 14:16 Arfrever Frehtes Taifersar Arahesis
2011-06-09 13:01 Arfrever Frehtes Taifersar Arahesis
2011-05-25  4:56 Zac Medico
2011-05-25  4:53 Zac Medico
2011-05-18  1:43 Zac Medico
2011-05-15  4:40 Zac Medico
2011-03-25 17:11 Zac Medico
2011-03-02 17:59 Zac Medico
2011-03-02 17:40 Zac Medico

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