Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: bin/
Date: Sun, 21 Jul 2019 04:13:03
Message-Id: 1563653281.3ebe48e61a02cb00c3bb2366e50b4c83ef390ecb.zmedico@gentoo
1 commit: 3ebe48e61a02cb00c3bb2366e50b4c83ef390ecb
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Sat Jul 20 20:06:50 2019 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Sat Jul 20 20:08:01 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=3ebe48e6
7
8 dispatch-conf: use writemsg for unicode safety (bug 690304)
9
10 Bug: https://bugs.gentoo.org/690304
11 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
12
13 bin/dispatch-conf | 11 ++++++-----
14 1 file changed, 6 insertions(+), 5 deletions(-)
15
16 diff --git a/bin/dispatch-conf b/bin/dispatch-conf
17 index 32a0a731e..62ab3f6cc 100755
18 --- a/bin/dispatch-conf
19 +++ b/bin/dispatch-conf
20 @@ -1,5 +1,5 @@
21 #!/usr/bin/python -b
22 -# Copyright 1999-2017 Gentoo Foundation
23 +# Copyright 1999-2019 Gentoo Authors
24 # Distributed under the terms of the GNU General Public License v2
25
26 #
27 @@ -31,6 +31,7 @@ from portage import os, shutil
28 from portage import _encodings, _unicode_decode
29 from portage.dispatch_conf import diffstatusoutput, diff_mixed_wrapper
30 from portage.process import find_binary, spawn
31 +from portage.util import writemsg, writemsg_stdout
32
33 FIND_EXTANT_CONFIGS = "find '%s' %s -name '._cfg????_%s' ! -name '.*~' ! -iname '.*.bak' -print"
34 DIFF_CONTENTS = "diff -Nu '%s' '%s'"
35 @@ -294,7 +295,7 @@ class dispatch:
36 diff_pager(conf['current'], newconf)
37
38 print()
39 - print('>> (%i of %i) -- %s' % (count, len(confs), conf ['current']))
40 + writemsg_stdout('>> (%i of %i) -- %s\n' % (count, len(confs), conf['current']), noiselevel=-1)
41 print('>> q quit, h help, n next, e edit-new, z zap-new, u use-new\n m merge, t toggle-merge, l look-merge: ', end=' ')
42
43 # In some cases getch() will return some spurious characters
44 @@ -369,7 +370,7 @@ class dispatch:
45 print(" One or more updates are frozen and have been automatically zapped:")
46 print()
47 for frozen in auto_zapped:
48 - print(" * '%s'" % frozen)
49 + writemsg_stdout(" * '%s'\n" % frozen, noiselevel=-1)
50 print()
51
52 def replace (self, newconf, curconf):
53 @@ -384,8 +385,8 @@ class dispatch:
54 try:
55 os.rename(newconf, curconf)
56 except (IOError, os.error) as why:
57 - print('dispatch-conf: Error renaming %s to %s: %s; fatal' % \
58 - (newconf, curconf, str(why)), file=sys.stderr)
59 + writemsg('dispatch-conf: Error renaming %s to %s: %s; fatal\n' % \
60 + (newconf, curconf, str(why)), noiselevel=-1)
61
62
63 def post_process(self, curconf):