From: Fabian Groffen Date: Fri, 4 Sep 2009 19:20:24 +0000 (-0000) Subject: Merged from trunk -r14176:14182 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=a7855a29eab576947ac964c4c3574566f5794b99;p=portage.git Merged from trunk -r14176:14182 | 14180 | Use _unicode_decode() on the string retunred from | | zmedico | time.strftime(), in order to avoid a potential | | | UnicodeDecodeError later. Thanks to Markus Duft | | | for reporting. | | 14181 | Bug #283513 - Do not allow --noreplace together with | | zmedico | --emptytree since it results in bogus masking messages. | | 14182 | Fix typo from previous commit. | | zmedico | | svn path=/main/branches/prefix/; revision=14183 --- diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py index 7eb521056..19f076c41 100644 --- a/pym/_emerge/main.py +++ b/pym/_emerge/main.py @@ -1144,6 +1144,12 @@ def emerge_main(): print "emerge: can't specify both of \"--tree\" and \"--columns\"." return 1 + if '--emptytree' in myopts and '--noreplace' in myopts: + writemsg_level("emerge: can't specify both of " + \ + "\"--emptytree\" and \"--noreplace\".\n", + level=logging.ERROR, noiselevel=-1) + return 1 + if ("--quiet" in myopts): spinner.update = spinner.update_quiet portage.util.noiselimit = -1 diff --git a/pym/portage/elog/mod_save_summary.py b/pym/portage/elog/mod_save_summary.py index 755644253..7e8435d12 100644 --- a/pym/portage/elog/mod_save_summary.py +++ b/pym/portage/elog/mod_save_summary.py @@ -7,6 +7,7 @@ import codecs import time from portage import os from portage import _encodings +from portage import _unicode_decode from portage import _unicode_encode from portage.data import portage_uid, portage_gid from portage.localization import _ @@ -26,8 +27,13 @@ def process(mysettings, key, logentries, fulltext): encoding=_encodings['fs'], errors='strict'), mode='a', encoding=_encodings['content'], errors='backslashreplace') apply_permissions(elogfilename, mode=060, mask=0) + time_str = time.strftime("%Y-%m-%d %H:%M:%S %Z", + time.localtime(time.time())) + # Avoid potential UnicodeDecodeError later. + time_str = _unicode_decode(time_str, + encoding=_encodings['content'], errors='replace') elogfile.write(_(">>> Messages generated by process %(pid)d on %(time)s for package %(pkg)s:\n\n") % - {"pid": os.getpid(), "time": time.strftime("%Y-%m-%d %H:%M:%S %Z", time.localtime(time.time())), "pkg": key}) + {"pid": os.getpid(), "time": time_str, "pkg": key}) elogfile.write(fulltext) elogfile.write("\n") elogfile.close()