From faf466f8e6df461785409d01e9e77b8d5ed5bc4e Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Tue, 1 Sep 2009 17:23:10 +0000 Subject: [PATCH] Merged from trunk -r14170:14176 | 14171 | Bug #283223 - Don't call str() inside _db_escape_string(), | | zmedico | since it's redundant and it can trigger a | | | UnicodeEncodeError in python-2.x. | | 14172 | Bug #283223 - Don't call str() on unicode strings inside | | zmedico | _db_escape_string(), since it can trigger a | | | UnicodeEncodeError in python-2.x. | | 14173 | Fix broken indentation from previous commits. | | zmedico | | | 14174 | Bug #283292 - Fix FindPortdir() to prevent OSError: [Errno | | zmedico | 2] from stat when $PWD is unset. Thanks to Jonathan Callen | | | for this patch. | | 14175 | Add dev-util/gperf to list of suspected run-time | | arfrever | dependencies (bug #283357). | | 14176 | Remove reference to GRP_STAGE23_USE (bug #283358). | | arfrever | | svn path=/main/branches/prefix/; revision=14178 --- bin/repoman | 1 + man/portage.5 | 3 --- pym/portage/cache/sqlite.py | 6 +++++- pym/repoman/utilities.py | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bin/repoman b/bin/repoman index 91fb16d18..5ca6a9f5a 100755 --- a/bin/repoman +++ b/bin/repoman @@ -406,6 +406,7 @@ suspect_rdepend = frozenset([ "dev-util/byacc", "dev-util/cmake", "dev-util/ftjam", + "dev-util/gperf", "dev-util/gtk-doc", "dev-util/gtk-doc-am", "dev-util/intltool", diff --git a/man/portage.5 b/man/portage.5 index ea592a213..9ce5b5552 100644 --- a/man/portage.5 +++ b/man/portage.5 @@ -204,9 +204,6 @@ machines have ARCH=sparc but set this to either 'sparc32' or 'sparc64'. .TP .BR STAGE1_USE Special USE flags which may be needed when bootstrapping from stage1 to stage2. -.TP -.BR GRP_STAGE23_USE -Special USE flags used by catalyst for building a stage3 and GRP sets. .RE .PD 1 .TP diff --git a/pym/portage/cache/sqlite.py b/pym/portage/cache/sqlite.py index 0a8424880..d5f765459 100644 --- a/pym/portage/cache/sqlite.py +++ b/pym/portage/cache/sqlite.py @@ -47,8 +47,12 @@ class database(fs_template.FsBased): def _db_escape_string(self, s): """meta escaping, returns quoted string for use in sql statements""" + if not isinstance(s, basestring): + # Avoid potential UnicodeEncodeError in python-2.x by + # only calling str() when it's absolutely necessary. + s = str(s) # This is equivalent to the _quote function from pysqlite 1.1. - return "'%s'" % str(s).replace("'","''") + return "'%s'" % s.replace("'", "''") def _db_init_connection(self, config): self._dbpath = self.location + ".sqlite" diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py index cf32399d3..c3665d9d8 100644 --- a/pym/repoman/utilities.py +++ b/pym/repoman/utilities.py @@ -346,7 +346,7 @@ def FindPortdir(settings): portdir_overlay = None location = os.getcwd() pwd = os.environ.get('PWD', '') - if pwd != location and os.path.realpath(pwd) == location: + if pwd and pwd != location and os.path.realpath(pwd) == location: # getcwd() returns the canonical path but that makes it hard for repoman to # orient itself if the user has symlinks in their portage tree structure. # We use os.environ["PWD"], if available, to get the non-canonical path of -- 2.26.2