Do it at the begin instead of replicating the same code inside the tool itself.
This fixes e.g. this failure:
./ubuntu-build --batch --retry morsmall
Traceback (most recent call last):
File "/tmp/ubuntu-dev-tools/ubuntu-build", line 317, in <module>
main()
File "/tmp/ubuntu-dev-tools/ubuntu-build", line 289, in main
can_retry = args.retry and me.canUploadPackage(
AttributeError: 'NoneType' object has no attribute 'canUploadPackage'
This is a partial revert of 1e20363.
When downloading a .diff.gz source package file, we do expect it to be
written to disk still compressed. If we were to uncompress it, then we
would get a size mismatch and even if we were to ignore that, we'd get a
hash mismatch.
On the other hand when downloading a changes file we need to make sure
that is written to disk uncompressed.
To make this work in both cases we can ask the HTTP server for no
special content encoding using "Accept-Encoding: identity". This is what
wget requests, for example. Then we can write the output to the file
without performing any decoding at our end by using the raw response
object again.
This fixes both cases.
LP: #2025748
Fix incorrectly reporting unknown distribution for Ubuntu after commit
7fc6788b35d32aeb96c7cf81303853d4f31028d1 ("backportpackage: fix
automatic selection of the target release").
LP: #2013237
Signed-off-by: Nathan Rennie-Waldock <nathan.renniewaldock@gmail.com>
lintain says: "Your sources request a specific set of Python versions
via the control field X-Python3-Version but all declared autopkgtests
exercise all supported Python versions by using the command py3versions
--supported."
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
```
ubuntutools/test/test_archive.py::LocalSourcePackageTestCase::test_pull
/usr/lib/python3.11/unittest/case.py:678: DeprecationWarning: It is deprecated to return a value that is not None from a test case (<bound method LocalSourcePackageTestCase.test_pull of <ubuntutools.test.test_archive.LocalSourcePackageTestCase testMethod=test_pull>>)
return self.run(*args, **kwds)
```
`test_pull` does not need to be run directly. Make it private.
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
pylint complains about C0209: Formatting a regular string which could be
a f-string (consider-using-f-string)
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
Commit 90e8fe81e1b2610e352c82c0301076ffc7da5ac0 renamed `print_field` to
`log_field`, but changed the `print_field` call with `Logger.info`.
Therefore the line with `=` was lost.
Restore the previous formatting.
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
Commit 0f3d2fed2a4ed67b90b5d49aab25ca2bda5d9d37 removed the difference
between the two loop iterations in `locate_package`. So drop the useless
second iteration.
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
pylint complains about W1201: Use lazy % formatting in logging functions
(logging-not-lazy) and W1203: Use lazy % formatting in logging functions
(logging-fstring-interpolation).
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>