From f822ee324adc1e8c48f528954eca038fe708f1b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Wed, 2 Oct 2019 14:44:26 +0200 Subject: [PATCH] ostree: Run commands in universal_newlines mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will mean the output is returned as unicode (decoded as UTF-8). Thus Kobo will not have to do any decoding. This should work around possible errors with breaking multibyte unicode character sequences into different chunks. Relates: https://pagure.io/releng/failed-composes/issue/237 Relates: https://github.com/release-engineering/kobo/issues/119 Signed-off-by: Lubomír Sedlář --- pungi/ostree/tree.py | 13 ++++++++++--- tests/test_ostree_script.py | 2 ++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/pungi/ostree/tree.py b/pungi/ostree/tree.py index f2d2942d..6a9e5e10 100644 --- a/pungi/ostree/tree.py +++ b/pungi/ostree/tree.py @@ -48,13 +48,20 @@ class Tree(OSTree): cmd.append('--force-nocache') cmd.append(self.treefile) - shortcuts.run(cmd, show_cmd=True, stdout=True, logfile=log_file) + shortcuts.run( + cmd, show_cmd=True, stdout=True, logfile=log_file, universal_newlines=True + ) def _update_summary(self): """Update summary metadata""" log_file = make_log_file(self.logdir, 'ostree-summary') - shortcuts.run(['ostree', 'summary', '-u', '--repo=%s' % self.repo], - show_cmd=True, stdout=True, logfile=log_file) + shortcuts.run( + ['ostree', 'summary', '-u', '--repo=%s' % self.repo], + show_cmd=True, + stdout=True, + logfile=log_file, + universal_newlines=True, + ) def _update_ref(self): """ diff --git a/tests/test_ostree_script.py b/tests/test_ostree_script.py index 9aa569a3..9490d935 100644 --- a/tests/test_ostree_script.py +++ b/tests/test_ostree_script.py @@ -54,6 +54,7 @@ class OstreeTreeScriptTest(helpers.PungiTestCase): logfile=self.topdir + "/logs/Atomic/create-ostree-repo.log", show_cmd=True, stdout=True, + universal_newlines=True, ) ] + extra_calls ) @@ -113,6 +114,7 @@ class OstreeTreeScriptTest(helpers.PungiTestCase): logfile=self.topdir + "/logs/Atomic/ostree-summary.log", show_cmd=True, stdout=True, + universal_newlines=True, ) ] )