~bdrung/ddeb-retriever/+git/main:pylint

Last commit made on 2023-02-15
Get this branch:
git clone -b pylint https://git.launchpad.net/~bdrung/ddeb-retriever/+git/main
Only Benjamin Drung can upload to this branch. If you are Benjamin Drung please log in for upload directions.

Branch merges

Branch information

Name:
pylint
Repository:
lp:~bdrung/ddeb-retriever/+git/main

Recent commits

6eb54c2... by Benjamin Drung

refactor: Use datetime.timestamp()

Use `timestamp()` method of datetime instead of calculating it manually.

Signed-off-by: Benjamin Drung <email address hidden>

f47a5a5... by Benjamin Drung

fix: Use lazy % formatting in logging functions

Signed-off-by: Benjamin Drung <email address hidden>

608b211... by Benjamin Drung

refactor: Mark unused variables as such

Name unused variables `_` to indicate to pylint and other linters that
these variables are not used.

Signed-off-by: Benjamin Drung <email address hidden>

8639da0... by Benjamin Drung

refactor: Use functools.cache for _get_lp()

Use `functools.cache` for `_get_lp()` to avoid using a global variable
and make the code more readable.

Signed-off-by: Benjamin Drung <email address hidden>

e207297... by Benjamin Drung

fix: Iterate over apt_pkg.TagFile

pylint complains about E1136: Value 'parser.section' is unsubscriptable
(unsubscriptable-object). `apt_pkg.TagFile` claims to be an iterator
over `apt_pkg.TagSection`.

So iterate over `apt_pkg.TagFile` for the sections instead of calling
`step()` and accessing the `section` property.

This change was tested to also work on Ubuntu 16.04 "xenial" with
Python 3.5.2 and python3-apt 1.1.0~beta1ubuntu0.16.04.12.

Signed-off-by: Benjamin Drung <email address hidden>

612eb65... by Benjamin Drung

feat: Generate InRelease files in addition to Release.gpg

The Apport system tests often fail with:

```
W:GPG error: http://ddebs.ubuntu.com jammy-updates Release: The following signatures were invalid: BADSIG C8CAB6595FDFF622 Ubuntu Debug Symbol Archive Automatic Signing Key (2016) <email address hidden>
E:The repository 'http://ddebs.ubuntu.com jammy-updates Release' is not signed.
```

So generate an `InRelease` file in addition to `Release.gpg`.

Bug: https://launchpad.net/bugs/2002833
Signed-off-by: Benjamin Drung <email address hidden>

e9fee8a... by Benjamin Drung

feat: Generate .Release.gpg.new and use atomic replace

There is an unnecessary window when `Release.gpg` is absent. Generate
`.Release.gpg.new` and use atomic replace to update `Release.gpg`. There
is still a window where `Release` and `Release.gpg` are out of sync.
This should be addressed in the future by atomically replacing the
complete directory.

Signed-off-by: Benjamin Drung <email address hidden>

bfef7ba... by Benjamin Drung

refactor: Replace try/except by contextlib.suppress

Shorten the code by using `contextlib.suppress`.

Signed-off-by: Benjamin Drung <email address hidden>

dd59505... by Benjamin Drung

refactor: Use subprocess.run in _generate_release_signatures

Signed-off-by: Benjamin Drung <email address hidden>

a2333e2... by Benjamin Drung

refactor: Introduce _generate_release_signatures

Split `_generate_release_signatures` from `create_indexes`.

Signed-off-by: Benjamin Drung <email address hidden>