Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/
Date: Tue, 27 Sep 2011 16:46:33
Message-Id: 60c7ca4030839a728a5975ee01e28c0330cf33ae.zmedico@gentoo
1 commit: 60c7ca4030839a728a5975ee01e28c0330cf33ae
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Tue Sep 27 16:46:02 2011 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Tue Sep 27 16:46:02 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=60c7ca40
7
8 merge: handle \r in file names for bug #384597
9
10 ---
11 pym/portage/dbapi/vartree.py | 7 ++++---
12 1 files changed, 4 insertions(+), 3 deletions(-)
13
14 diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
15 index f146ade..a4c54bd 100644
16 --- a/pym/portage/dbapi/vartree.py
17 +++ b/pym/portage/dbapi/vartree.py
18 @@ -3279,6 +3279,7 @@ class dblink(object):
19 # the check must be repeated here for binary packages (it's
20 # inexpensive since we call os.walk() here anyway).
21 unicode_errors = []
22 + line_ending_re = re.compile('[\n\r]')
23
24 while True:
25
26 @@ -3330,7 +3331,7 @@ class dblink(object):
27
28 relative_path = fpath[srcroot_len:]
29
30 - if "\n" in relative_path:
31 + if line_ending_re.search(relative_path) is not None:
32 paths_with_newlines.append(relative_path)
33
34 file_mode = os.lstat(fpath).st_mode
35 @@ -3353,11 +3354,11 @@ class dblink(object):
36
37 if paths_with_newlines:
38 msg = []
39 - msg.append(_("This package installs one or more files containing a newline (\\n) character:"))
40 + msg.append(_("This package installs one or more files containing line ending characters:"))
41 msg.append("")
42 paths_with_newlines.sort()
43 for f in paths_with_newlines:
44 - msg.append("\t/%s" % (f.replace("\n", "\\n")))
45 + msg.append("\t/%s" % (f.replace("\n", "\\n").replace("\r", "\\r")))
46 msg.append("")
47 msg.append(_("package %s NOT merged") % self.mycpv)
48 msg.append("")