AptRepository¶
- class rmote.tools.apt_repository.AptRepository[source]¶
Bases:
ToolManage APT repository sources and GPG keys on Debian/Ubuntu.
Repository sources are written as DEB822
.sourcesfiles under/etc/apt/sources.list.d/. GPG keyrings are stored in/etc/apt/keyrings/. All operations are idempotent and require root.- static absent(name)[source]¶
Remove the DEB822
.sourcesfile for name, if it exists.- Parameters:
name (
Text) – Repository label (the{name}.sourcesfilename stem).- Return type:
Result- Returns:
Resultindicating whether the file was removed.
- static key(name, data)[source]¶
Install a GPG signing key to
/etc/apt/keyrings/{name}.The operation is idempotent — if the file already contains identical bytes it is left untouched.
- static present(name, *, types=('deb',), uris, suites, components, signed_by='')[source]¶
Ensure a DEB822
.sourcesfile is configured for name.Writes
/etc/apt/sources.list.d/{name}.sources. The operation is idempotent — if the file already contains the expected content it is left untouched.- Parameters:
name (
Text) – Repository label used as the filename stem.types (
Iterable[Text]) – Package types — typically("deb",)for binary packages or("deb-src",)for source packages.uris (
Iterable[Text]) – Repository base URIs (e.g.("https://download.docker.com/linux/ubuntu",)).suites (
Iterable[Text]) – Distribution suites (e.g.("noble",)).components (
Iterable[Text]) – Repository components (e.g.("stable",)).signed_by (
Text) – Absolute path to the GPG keyring that signs this repository.
- Return type:
Result- Returns:
Resultindicating whether the file was created or updated.