Merged from trunk -r14176:14182
authorFabian Groffen <grobian@gentoo.org>
Fri, 4 Sep 2009 19:20:24 +0000 (19:20 -0000)
committerFabian Groffen <grobian@gentoo.org>
Fri, 4 Sep 2009 19:20:24 +0000 (19:20 -0000)
   | 14180   | Use _unicode_decode() on the string retunred from            |
   | zmedico | time.strftime(), in order to avoid a potential               |
   |         | UnicodeDecodeError later. Thanks to Markus Duft              |
   |         | <mduft@gentoo.org> 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

pym/_emerge/main.py
pym/portage/elog/mod_save_summary.py

index 7eb52105645dd76277767c7bb396fd5880fa3b05..19f076c41f5d330a60660b67a6ee41692754be78 100644 (file)
@@ -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
index 755644253cb68f9d720ae399dcac992063e5f603..7e8435d1293a439f557b8dfb1f575ea405dcee5c 100644 (file)
@@ -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()