Skip to content

Commit

Permalink
ostree: Run commands in universal_newlines mode
Browse files Browse the repository at this point in the history
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: release-engineering/kobo#119
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
  • Loading branch information
lubomir committed Oct 3, 2019
1 parent 21d45eb commit f822ee3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pungi/ostree/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,20 @@ def _make_tree(self):
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):
"""
Expand Down
2 changes: 2 additions & 0 deletions tests/test_ostree_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def assertCorrectCall(self, mock_run, extra_calls=[], extra_args=[]):
logfile=self.topdir + "/logs/Atomic/create-ostree-repo.log",
show_cmd=True,
stdout=True,
universal_newlines=True,
)
] + extra_calls
)
Expand Down Expand Up @@ -113,6 +114,7 @@ def test_update_summary(self, run):
logfile=self.topdir + "/logs/Atomic/ostree-summary.log",
show_cmd=True,
stdout=True,
universal_newlines=True,
)
]
)
Expand Down

0 comments on commit f822ee3

Please sign in to comment.