← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:py3-extract-dpkg-source-output into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3-extract-dpkg-source-output into launchpad:master.

Commit message:
Convert dpkg-source output to text in extract_dpkg_source

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/398983

We want the exception message to be text for Python 3, but we should be a little careful in case the output contains non-UTF-8 characters (perhaps dpkg-source mentioning an error related to a non-UTF-8 file name in the source package), so use `errors="replace"`.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-extract-dpkg-source-output into launchpad:master.
diff --git a/lib/lp/archiveuploader/utils.py b/lib/lp/archiveuploader/utils.py
index bc5cf80..721b068 100644
--- a/lib/lp/archiveuploader/utils.py
+++ b/lib/lp/archiveuploader/utils.py
@@ -262,7 +262,8 @@ def extract_dpkg_source(dsc_filepath, target, vendor=None):
     output, unused = dpkg_source.communicate()
     result = dpkg_source.wait()
     if result != 0:
-        dpkg_output = prefix_multi_line_string(output, "  ")
+        dpkg_output = prefix_multi_line_string(
+            output.decode("UTF-8", errors="replace"), "  ")
         raise DpkgSourceError(result=result, output=dpkg_output, command=args)