repoman: handle unicode in echangelog args
authorZac Medico <zmedico@gentoo.org>
Fri, 14 Oct 2011 19:31:19 +0000 (12:31 -0700)
committerZac Medico <zmedico@gentoo.org>
Fri, 14 Oct 2011 19:31:19 +0000 (12:31 -0700)
bin/repoman

index 47ae974d82f653a1892ba6463d3f17851fc140e2..11fb56a56e42ae923712e35dbafa311d36be4153 100755 (executable)
@@ -73,7 +73,7 @@ from portage.process import find_binary, spawn
 from portage.output import bold, create_color_func, \
        green, nocolor, red
 from portage.output import ConsoleStyleFile, StyleWriter
-from portage.util import cmp_sort_key, writemsg_level
+from portage.util import cmp_sort_key, writemsg_level, writemsg_stdout
 from portage.package.ebuild.digestgen import digestgen
 from portage.eapi import eapi_has_slot_deps, \
        eapi_has_use_deps, eapi_has_strong_blocks, eapi_has_iuse_defaults, \
@@ -2444,9 +2444,13 @@ else:
                        logging.info("calling echangelog for package %s" % x)
                        echangelog_args = ["echangelog", "--vcs", vcs, changelog_msg]
                        if options.pretend:
-                               print("(%s)" % (" ".join(echangelog_args),))
+                               writemsg_stdout("(%s)\n" % (" ".join(echangelog_args),),
+                                       noiselevel=-1)
                                continue
-                       retcode = subprocess.call(echangelog_args, cwd=checkdir)
+                       echangelog_args = [_unicode_encode(arg) for arg in echangelog_args]
+                       echangelog_cwd = _unicode_encode(checkdir,
+                               encoding=_encodings['fs'], errors='strict')
+                       retcode = subprocess.call(echangelog_args, cwd=echangelog_cwd)
                        if retcode != os.EX_OK:
                                logging.error("echangelog exited with '%s' status" % retcode)
                                sys.exit(retcode)