When building the apport report in DistUpgradeApport.py, we open the
files before attaching to the report, rather than just passing the
filename (both options are supported by apport). However, we do not
open the file in binary mode which results in UnicodeDecodeError
exceptions:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/problem_report.py", line 477, in add_to_existing
self.write(f)
File "/usr/lib/python3/dist-packages/problem_report.py", line 430, in write
block = f.read(1048576)
File "/usr/lib/python3.8/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte
Simplify this code by passing the path to apport, and let that code open
the file as it needs.
DistUpgrade: cast to int when calling QProgressBar.setValue()
The QProgessBar used in the KDE frontend expects an int argument when
calling setValue(). Currently, there are several locations where a float
is passed which raises a TypeError. Fix this by casting to int when
calling QProgressBar.setValue().
DistUpgrade/DistUpgradeController.py: In one of the finall calls of need_server_mode() do not allow switching from a desktop mode upgrade to a server mode upgrade. (LP: #1969786)