From: Fabian Groffen Date: Thu, 14 Jan 2010 18:48:20 +0000 (-0000) Subject: Merged from trunk -r15193:15199 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=90fdb7012369fb7d942e7a4a5669fb94ef80f227;p=portage.git Merged from trunk -r15193:15199 | 15194 | Avoid portage import in order to avoid a potential sandbox | | zmedico | violation if portage's *.pyc files are stale. | | 15195 | Fix unicode quote handling to work with python3. | | zmedico | | | 15196 | Fix output handling to avoid potential UnicodeEncodeError. | | zmedico | | | 15197 | Use encoded byte strings with python-2.x, since the python | | zmedico | ebuilds are known to remove the encodings module when | | | USE=build is enabled (thus disabling unicode | | | decoding/encoding). | | 15198 | Bug #300744 - Inside xpak(), exclude CONTENTS for quickpkg | | zmedico | since contents is generated by the merge process. | | 15199 | Make sure repoman knows about all files in the directory to | | grobian | commit using bzr. Patch by Christian Faulhammer. | svn path=/main/branches/prefix/; revision=15200 --- diff --git a/bin/check-implicit-pointer-usage.py b/bin/check-implicit-pointer-usage.py index 302939a1f..f261e2ef5 100755 --- a/bin/check-implicit-pointer-usage.py +++ b/bin/check-implicit-pointer-usage.py @@ -19,11 +19,9 @@ from __future__ import print_function import re import sys -from portage import _unicode_decode - implicit_pattern = re.compile("([^:]*):(\d+): warning: implicit declaration " + "of function [`']([^']*)'") -pointer_pattern = re.compile( +pointer_pattern = ( "([^:]*):(\d+): warning: " + "(" + "(assignment" @@ -34,19 +32,40 @@ pointer_pattern = re.compile( + ") makes pointer from integer without a cast" + "|" + "cast to pointer from integer of different size)") + +if sys.hexversion < 0x3000000: + # Use encoded byte strings in python-2.x, since the python ebuilds are + # known to remove the encodings module when USE=build is enabled (thus + # disabling unicode decoding/encoding). The portage module has a + # workaround for this, but currently we don't import that here since we + # don't want to trigger potential sandbox violations due to stale pyc + # files for the portage module. + unicode_quote_open = '\xE2\x80\x98' + unicode_quote_close = '\xE2\x80\x99' + def write(msg): + sys.stdout.write(msg) +else: + unicode_quote_open = '\u2018' + unicode_quote_close = '\u2019' + def write(msg): + sys.stdout.buffer.write(msg.encode('utf_8', 'backslashreplace')) + +pointer_pattern = re.compile(pointer_pattern) + last_implicit_filename = "" last_implicit_linenum = -1 last_implicit_func = "" while True: if sys.hexversion >= 0x3000000: - line = _unicode_decode(sys.stdin.buffer.readline()) + line = sys.stdin.buffer.readline().decode('utf_8', 'replace') else: line = sys.stdin.readline() - if line == '': + if not line: break # translate unicode open/close quotes to ascii ones - line = line.replace("\xE2\x80\x98", "`").replace("\xE2\x80\x99", "'") + line = line.replace(unicode_quote_open, "`") + line = line.replace(unicode_quote_close, "'") m = implicit_pattern.match(line) if m: last_implicit_filename = m.group(1) @@ -59,6 +78,7 @@ while True: pointer_linenum = int(m.group(2)) if (last_implicit_filename == pointer_filename and last_implicit_linenum == pointer_linenum): - print(("Function `%s' implicitly converted to pointer at " \ - "%s:%d" % (last_implicit_func, last_implicit_filename, - last_implicit_linenum))) + write("Function `%s' implicitly converted to pointer at " \ + "%s:%d\n" % (last_implicit_func, + last_implicit_filename, + last_implicit_linenum)) diff --git a/bin/repoman b/bin/repoman index c181bf73f..9dc783727 100755 --- a/bin/repoman +++ b/bin/repoman @@ -1109,7 +1109,7 @@ for x in scanlist: if vcs == "svn": myf = os.popen("svn status --depth=files --verbose " + checkdir) if vcs == "bzr": - myf = os.popen("bzr status -S " + checkdir) + myf = os.popen("bzr ls -v --kind=file " + checkdir) myl = myf.readlines() myf.close() for l in myl: diff --git a/pym/portage/xpak.py b/pym/portage/xpak.py index 262f14c85..7d595bdab 100644 --- a/pym/portage/xpak.py +++ b/pym/portage/xpak.py @@ -86,6 +86,9 @@ def xpak(rootdir,outfile=None): mylist.sort() mydata = {} for x in mylist: + if x == 'CONTENTS': + # CONTENTS is generated during the merge process. + continue x = _unicode_encode(x, encoding=_encodings['fs'], errors='strict') mydata[x] = open(os.path.join(rootdir, x), 'rb').read()