2914 Commits

Author SHA1 Message Date
Benjamin Drung
34578e6a1e Enable more pylint checks
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-02-01 12:07:19 +01:00
Benjamin Drung
21784052ba test: Fix deprecated return value for test case
```
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>
2023-01-31 17:39:12 +01:00
Benjamin Drung
aa556af89d Use f-strings
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>
2023-01-31 19:32:58 +01:00
Benjamin Drung
069a6926c0 Implement conventions found by pylint
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-31 17:28:33 +01:00
Benjamin Drung
444b319c12 Implement refactorings found by pylint
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-31 16:58:24 +01:00
Benjamin Drung
4449cf2437 Fix warnings found by pylint
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-31 15:51:29 +01:00
Benjamin Drung
9fa29f6ad5 fix(reverse-depends): Restore field titles format
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>
2023-01-31 14:42:22 +01:00
Benjamin Drung
a160def2ab fix(requestbackport): Remove useless loop from locate_package
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>
2023-01-31 14:35:12 +01:00
Benjamin Drung
909d945af4 Replace deprecated optparse with argparse
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-31 13:33:18 +01:00
Benjamin Drung
f6fde2e217 fix: Use lazy % formatting in logging functions
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>
2023-01-31 11:13:07 +01:00
Benjamin Drung
17bed46ffb feat: Add some type hints
Add some type hints to satisfy mypy.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-31 10:35:22 +01:00
Benjamin Drung
72add78e9d Fix errors found by pylint
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-31 10:19:24 +01:00
Benjamin Drung
ab64467f33 Run pylint during package build again
Commit ae74f71a1e9d4be043162b19d23f2d44c964c771 removed the pylint unit
test saying that unit tests are not needed to just run flake8 or pylint.

Since pylint is useful, add it back, but this time call it directly and
not embed it into a unit test.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-31 00:05:15 +01:00
Benjamin Drung
b1bc7e1cdc Address pylint complaints
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-30 23:10:31 +01:00
Benjamin Drung
8692bc2b1c refactor(setup.py): Introduce get_debian_version
Move getting the Debian package version into a separate function and
fail in case it cannot find it or fails parsing it.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-30 21:56:37 +01:00
Benjamin Drung
a685368ae9 Run isort import sorter during package build
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-30 21:34:24 +01:00
Benjamin Drung
4e27045f49 style: Sort Python imports with isort
```
isort -l 99 --profile=black .
```

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-30 21:28:47 +01:00
Benjamin Drung
db0e091e44 Run black code formatter during package build
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-30 19:48:49 +01:00
Benjamin Drung
3354b526b5 style: Format Python code with black
```
PYTHON_SCRIPTS=$(grep -l -r '^#! */usr/bin/python3$' .)
black -C -l 99 . $PYTHON_SCRIPTS
```

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-30 19:45:36 +01:00
Benjamin Drung
79d24c9df1 fix: Check Python scripts with flake8 again
Commit ae74f71a1e9d4be043162b19d23f2d44c964c771 removed the flake8
unittest and commit 3428a65b1cd644445f55ad8ae65ece5f73d7acb5 added
running flake8 again, but only for files named `*.py`.

Check also all Python scripts with a Python shebang.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-30 19:29:51 +01:00
Benjamin Drung
932166484b Fix issues found by flake8 on the Python scripts
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-30 19:29:30 +01:00
Benjamin Drung
bd770fa6b1 test: Do not run flake8 in verbose mode
The verbose output of flake8 is not interesting and just clutters the
output.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-30 14:11:09 +01:00
Benjamin Drung
3d54a17403 refactor: Move linter checks into run-linters script
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-30 14:10:02 +01:00
Benjamin Drung
3bdb827516 fix: Use PEP440 compliant version in setup.py
Versions like `0.176ubuntu20.04.1` in Ubuntu are clearly not compliant
with https://peps.python.org/pep-0440/. With setuptools 66, the versions
of all packages visible in the Python environment *must* obey PEP440.

Bug: https://launchpad.net/bugs/1991606
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-30 14:07:23 +01:00
Mattia Rizzolo
0d94b5e747
document the last commit
Signed-off-by: Mattia Rizzolo <mattia@debian.org>
2023-01-15 18:16:07 +01:00
Krytarik Raido
0f3d2fed2a
requestbackport: Adapt to new backports policy (LP: #1959115)
As documented on <https://wiki.ubuntu.com/UbuntuBackports>

Template update done by Unit 193.

Signed-off-by: Mattia Rizzolo <mattia@debian.org>
2023-01-15 18:14:48 +01:00
Mattia Rizzolo
844d6d942c
Merge branch 'mk-sbuild' of git+ssh://git.launchpad.net/~myamada/ubuntu-dev-tools
Closes: #1001832
LP: #1955116
MR: https://code.launchpad.net/~myamada/ubuntu-dev-tools/+git/ubuntu-dev-tools/+merge/435734
Signed-off-by: Mattia Rizzolo <mattia@debian.org>
2023-01-14 18:49:29 +01:00
Mattia Rizzolo
ae43fd1929
document the previous changes
Signed-off-by: Mattia Rizzolo <mattia@debian.org>
2023-01-14 18:46:50 +01:00
Masahiro Yamada
69ac109cdb mk-sbuild: fix security update repository for Debian bullseye and later
If I run "apt-get update" in the bullseye chroot, I get the following error:

  Err:4 http://security.debian.org bullseye-updates Release
    404  Not Found [IP: 2a04:4e42:600::644 80]

It looks like the directory path was changed since bullseye.

buster:

    deb https://security.debian.org/debian-security buster/updates main

bullseye:

    deb https://security.debian.org/debian-security bullseye-security main

Signed-off-by: Masahiro Yamada <masahiro.yamada@canonical.com>
2023-01-13 18:53:17 +09:00
Masahiro Yamada
9f2a53c166 mk-sbuild: add debian_dist_ge()
Add debian_dist_ge(), which will be used by the next commit.

To avoid code duplication, move the common part to dist_ge().

Signed-off-by: Masahiro Yamada <masahiro.yamada@canonical.com>
2023-01-13 18:34:01 +09:00
Benjamin Drung
c1e4b14a98 Demote bzr/brz from Recommends to Suggests
Nowadays git is used nearly everywhere. Therefore demoting bzr/brz to
Suggest is the right thing to do.

Bug-Debian: https://bugs.debian.org/940531
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2022-11-16 18:49:42 +01:00
Benjamin Drung
096d5612e7 sponsor-patch: Use --skip-patches when extract source package
Use `--skip-patches` when extract source packages with `dpkg-source`.
`--no-preparation` is a source package build option and `--skip-patches`
is the correct extract option.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2022-11-16 18:37:56 +01:00
Benjamin Drung
b510dbd91e sponsor-patch: Ignore exit code 1 of debdiff call
sponsor-patch calls `debdiff` which exits with 1 if there are
differences. So accept exit codes 0 and 1 as expected.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2022-11-15 16:43:27 +01:00
Mattia Rizzolo
803949ed8b
also include a lp bug number there
Signed-off-by: Mattia Rizzolo <mattia@debian.org>
2022-10-11 14:42:08 +02:00
Mattia Rizzolo
e219eaa5fc
Open changelog for the next release.
Signed-off-by: Mattia Rizzolo <mattia@debian.org>
2022-10-11 13:58:00 +02:00
Mattia Rizzolo
60ee986014
Release 0.191
Signed-off-by: Mattia Rizzolo <mattia@debian.org>
0.191
2022-10-11 13:56:13 +02:00
Mattia Rizzolo
dabe475067
ubuntutools/archive.py: fix crash in SourcePackage()._source_urls()
Fix operation of SourcePackage._source_urls() (as used, for example, in
SourcePackage.pull() called by backportpackage) to also work when the
class is instantiated with a URL as .dsc.

This is a regression caused by 1b12d8b4e3315de3bf417b40a3c66279f309d72c
(first in v0.184) that moved from os.path.join() to Pathlib, but
os.path.join() was also used to join URLs.

Thanks: Unit 193 for the initial patch.
Signed-off-by: Mattia Rizzolo <mattia@debian.org>
2022-09-29 10:34:51 +02:00
Mattia Rizzolo
0a9e18ed91
document the previous change
Signed-off-by: Mattia Rizzolo <mattia@debian.org>
2022-09-29 10:32:07 +02:00
Stefano Rivera
7859889438 backportpackage: Add support for lsb-release-minimal, which doesn't have a Python module, thanks Gioele Barabucci. (Closes: 1020901) 2022-09-28 11:40:33 +02:00
Gioele Barabucci
a3c87e78aa backportpackage: Run lsb_release as command if the Python module is not available 2022-09-28 11:36:22 +02:00
Mattia Rizzolo
05af489f64
Merge branch 'lp1984113' of git+ssh://git.launchpad.net/~ddstreet/ubuntu-dev-tools
MR: https://code.launchpad.net/~ddstreet/ubuntu-dev-tools/+git/ubuntu-dev-tools/+merge/428101
Signed-off-by: Mattia Rizzolo <mattia@debian.org>
2022-08-22 17:57:07 +02:00
Mattia Rizzolo
d5fdc00396
open changelog for the next release
Signed-off-by: Mattia Rizzolo <mattia@debian.org>
2022-08-22 17:56:02 +02:00
Dan Streetman
7d278cde21 ubuntu-build: use correct exception from LP login failure 2022-08-09 12:15:09 -04:00
Dan Streetman
ad402231db ubuntu-build: explicitly login to LP
LP: #1984113
2022-08-09 12:14:56 -04:00
Dan Streetman
562e6b13cd lpapicache: force lp access on login to workaround possibly invalid cached creds 2022-08-09 12:08:50 -04:00
Dan Streetman
9c1561ff26 lpapicache: remove try-except around login that only logs the error and then re-raises 2022-08-09 12:07:31 -04:00
Benjamin Drung
06a04f642f Release ubuntu-dev-tools 0.190
Signed-off-by: Benjamin Drung <bdrung@ubuntu.com>
0.190
2022-06-16 10:55:29 +02:00
Benjamin Drung
8f0005ce1d Bump Standards-Version to 4.6.1
Signed-off-by: Benjamin Drung <bdrung@ubuntu.com>
2022-06-16 10:54:41 +02:00
Benjamin Drung
51ebfb21d3 Add missing files to debian/copyright
Signed-off-by: Benjamin Drung <bdrung@ubuntu.com>
2022-06-16 10:52:51 +02:00
Benjamin Drung
f83161dcc2 Wrap long line in setup-packaging-environment.1
Signed-off-by: Benjamin Drung <bdrung@ubuntu.com>
2022-06-16 10:24:32 +02:00