-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: load deb822 sources; use add-apt-repository to add (#137)
Ubuntu 24.04 uses [deb288 format](https://manpages.ubuntu.com/manpages/noble/en/man5/sources.list.5.html) sources, which python-libjuju does not currently support (as pointed out by @yanksyoon and @NucciTheBoss in #135). This merge commit adds support for reading `*sources` files. `RepositoryMapping` now automatically findes them in `/etc/apt/sources.list.d` when initialised. Additionally, to avoid an `InvalidSourceError` if `/etc/apt/sources.list` exists but only includes a comment about the new sources location (as it does on noble), we ignore this error if `/etc/apt/sources.list.d/ubuntu.sources` exists. This merge commit also cleans up the `add` method by calling `add-apt-repository` internally instead of writing directly to a file. Note that this means that adding a disabled repository no longer has any effect (previously it would write a a file containing a single, commented-out one-line repository definition). Original commit messages below. --- * feat: support deb822 style source specification Ubuntu 24.04 adopts the deb822 style source specification. Such files are listed in /etc/apt/sources.list.d/*sources, and allow the specification of sources in a multi-line format * refactor: separate file reading and object updating from parsing lines * refactor: preserve line nos when parsing deb822 lines into paragraphs * refactor: move turning numbered lines into options dict to helper * feat: support inline comments in deb822 source files * tests: add some unit tests for _iter_deb822_paragraphs * fix: raise an InvalidSourceError on missing required deb822 keys * tests: add some unit tests for _get_deb822_options * fix: correctly handle newline terminated lines in paragraph iteration * tests: add some unit tests for _iter_deb822_paragraphs * tests: add some tests for _parse_deb822_lines * feat: add the number of errors to the debug output in load_deb822 * tests: add some unit tests for load_deb822 * tests: add a unit test for initialiasing RepositoryMapping with deb822 * style: tox -e fmt tests/unit/test_apt.py * fix: correct docstring * fix: python3.8 context managers and clean up linter directives * feat: make DebianRepository aware of deb822 format for some operations add: add ability to write a deb822 format file disable: raise NotImplementedError for deb822 format files gpg_key: use existing import_key functionality to provide keys specified in the stanza itself as a file for compatibility Also refactor Deb822 functionality to a separate class. Also move deb822 unit tests to the more appropriate test_repo.py * fix: remove extraneous information from docstring * feat: use apt-add-repository for RepositoryMapping.add * refactor: logic and testing cleanup * style: type annotate integration test helper function * feat: support apt autoremove in remove_package * feat: debug useful information on error in apt.update * feat: log when writing to a sources file in from_repo_line * feat: make the apt directories (private) attributes (for testing) * style: correct RepositoryMapping.__iter__ annotation and add FIXME * feat: log the filename as well as the number of repos when parsing * feat: refactor RepositoryMapping.add to possible support remove as well * feat: allow _Deb822Stanza from an empty set of lines * tests: add unit tests that use files on disk * tests: update integration tests * feat: use sourceslist (one-per-line) format for add-apt-repository * feat: call _add_apt_repository in from_repo_line (don't reimplement logic) * tests: re-enable package cleanup in integration tests * tests: add test case from hardware-observer charm and cleanup keys * tests: refactor deb822 unit tests * tests: iterate on deb822 tests * tests: fully refactor and expand deb822 unit tests * style: make linting happy * test: fix an erroneous assert in integration tests * refactor: clean up diff, signatures, etc * refactor: move keys to files * fix: don't warn about key file on remove * style: use tuple for endswith * style: paragraph -> stanza, repositories -> repos * test: switch from inkscape to terminator ppa for ci * test: switch from terminator to fish ppa for ci * chore: remove ValueError from RepositoryMapping.add * test: remove old tests from test_repo.py
- Loading branch information
1 parent
8e034ef
commit f1952df
Showing
34 changed files
with
1,368 additions
and
197 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
-----BEGIN PGP PUBLIC KEY BLOCK----- | ||
|
||
mQINBGY0i8EBEAC787CEn0bb9R6lgxSjwEzrfUGK2HVfUoSfKiKILlU/p+nwdBdx | ||
zKOGEtl2O8W4Q+KZkwEbD4llJKPFhzjF2CeP2qRKd/PLpiZoKhAr/NR7klQveqGx | ||
Hop3uXsdGFxsNv2z0VEyJ7vhO+X0AuAW9BcXpXBexlt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oEvoiVf8M0poKrmPN+ft8EaOMpgORS8ut | ||
RZzVndHx4jFyZ+pVDt00J16Bblq6MSaGZalPneIfycx4tuwPPTX7CALUeMQ0V/Gy | ||
p053yvotLwsBC6KGjKugxUzgbSlp7WWiPEbYXZfjb7IZpNmKXtuvfyBo8rs3icez | ||
ZkUmljl2J27bhSIUZQ124ham6yQ3B8MfXUdctiWUCkOdunqUuBeHa5yeKJHTcFUH | ||
Y5nyyn79L5VLZ6YlwYn9qW0V/LvfnW2JmrXTVFjEhfUoEm0Zck8UBqWn2wfSagTI | ||
2KWU87IgN3MF7QG5EiLEAUA/DfagBwgjCpRFH8VUeWqMjTkQs9kjB/kvCcvHGp8g | ||
WVimNlxjmpCZsvk= | ||
=5r0P | ||
-----END PGP PUBLIC KEY BLOCK----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
-----BEGIN PGP PUBLIC KEY BLOCK----- | ||
Version: GnuPG v1.4.12 (GNU/Linux) | ||
|
||
mQENBFZp0LkBCACXajRw3b4x7G7dulNYj0hUID4BtVFq/MjEb6PHckTxGxZDoQRX | ||
RK54tiTFA9wq3b4P3yEFnOjbjRoI0d7Ls67FADugFO+cDCtsV9yuDlaYP/U/h2nX | ||
N0R4AdYbsVd5yr6xr+GAy66Hmx5jFH3kbC+zJpOcI0tU9hcyU7gjbxu6KQ1ypI2Q | ||
VRKf8sRBJXgmkOlbYx35ZUMFcmVxrLJXvUuxmAVXgT9f5M3Z3rsGt/ab+/+1TFSb | ||
RsaqHsIPE0QH8ikqW4IeDQAo1T99pCdf7FWr45KFFTo7O4AZdLMWVgqeFHaSoZxJ | ||
307VIINsWiwQoPp0tfU5NOOOwB1Sv3x9QgFtABEBAAG0P0hld2xldHQgUGFja2Fy | ||
ZCBFbnRlcnByaXNlIENvbXBhbnkgUlNBLTIwNDgtMjUgPHNpZ25ocEBocGUuY29t | ||
PokBPQQTAQIAJwUCVmnQuQIbLwUJEswDAAYLCQgHAwIGFQgCCQoLAxYCAQIeAQIX | ||
gAAKCRDCCK3eJsK3l9G+B/0ekblsBeN+xHIJ28pvo2aGb2KtWBwbT1ugI+aIS17K | ||
UQyHZJUQH+ZeRLvosuoiQEdcGIqmOxi2hVhSCQAOV1LAonY16ACveA5DFAEBz1+a | ||
WQyx6sOLLEAVX1VqGlBXxh3XLEUWOhlAf1gZPNtHsmURTUy2h1Lv/Yoj8KLyuK2n | ||
DmrLOS3Ro+RqWocaJfvAgXKgt6Fq/ChDUHOnar7lGswzMsbE/yzLJ7He4y89ImK+ | ||
2ktR5HhDuxqgCe9CWH6Q/1WGhUa0hZ3nbluq7maa+kPe2g7JcRzPH/nJuDCAOZ7U | ||
6mHE8j0kMQMYjgaYEx2wc02aQRmPyxhbDLjSbtjomXRr | ||
=voON | ||
-----END PGP PUBLIC KEY BLOCK----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
-----BEGIN PGP PUBLIC KEY BLOCK----- | ||
Version: GnuPG v1.4.0 (MingW32) | ||
|
||
mQGiBEIxWpoRBADb06sJgnD7MJnm2Ny1nmTFLDSZ8vkubP+pmfn9N9TE26oit+KI | ||
OnVTRVbSPl3F15wTjSBGR453MEfnzp1NrMk1GIa/m1nKAmgQ4t1714C4jQab0to+ | ||
gP51XhPhtAGt7BggorQw2RXa4KdTCh8ByOIaDKRYcESmMazSZ+Pscy2XRwCgm771 | ||
21RCM0RcG2dmHZZgKH8fTscD/RiY3CHI2jJl9WosIYXbZpOySzrLn0lRCRdNdpew | ||
Y5m1f3lhqoSvJk7pXjs4U+3XlOlUhgWl5HiXuWSVyPu2ilfGdfgpJslawI85fBQg | ||
Ul5kcrjLHHsApe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46B | ||
yt1l8ZNinIeE7CFL7H+LlMl2Ml6wsOkrxsSauBis6nER4sYVqrMdzpUU2Sr2hj6Q | ||
sJ+9TS+IURcnxL/M851KCwLhwZKdphQjT3mXXsoCx/l3rI6cxpwYgjiKiZhOiE8E | ||
GBECAA8FAkIxWqUCGwwFCRLMAwAACgkQUnvFOiaJuIenewCdHcEvMxBYprqRjKUw | ||
04EypyFtZTgAn0wds0nbpd2+VZ5WHbVRfU4y5Y5Y | ||
=+cX+ | ||
-----END PGP PUBLIC KEY BLOCK----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
-----BEGIN PGP PUBLIC KEY BLOCK----- | ||
Version: GnuPG v1.4.10 (MingW32) | ||
|
||
mQENBFC+QboBCAC1bodHD7AmR00SkDMB4u9MXy+Z5vv8wbmGRaKDBYScpAknOljX | ||
d5tBADffAetd1hgLnrLKN8vHdIsYkmUyeEeEsnIUKtwvbx/f6PoZZPOIIIRh1d2W | ||
Mjw9qXIE+tgr2gWlq0Gi5BZzaKse1+khRQ2rewJBppblSGWgcmCMIq8OwAsrdbtr | ||
z7+37c/g/Y2VfAahc23YZW9LQ5MiaI4nS4JMZbWPYtBdF78B/D2t5FvmvDG0Cgjk | ||
Qi1U9IVjiFKixuoi6nRsvBLFYL/cI+vo4iyUC5x7qmKd8gN7A030gS67VrleNRki | ||
q0vaF6J46XpIl4o58t23FSAKKRbTwavYzdMpABEBAAG0NEhld2xldHQtUGFja2Fy | ||
ZCBDb21wYW55IFJTQSAoSFAgQ29kZXNpZ25pbmcgU2VydmljZSmJAT4EEwECACgF | ||
AlC+QboCGwMFCRLMAwAGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJELBwaApc | ||
4tR2x7sH/A3D4XxEEyrX6Z3HeWSSA80+n+r5QwfXm5unxsWEL3JyNg6sojlrJY4K | ||
8k4ih4nkY4iblChTCSQwnqKXqkL5U+RIr+AJoPx+55M98u4eRTVYMHZD7/jFq85z | ||
ZFGUkFkars9E2aRzWhqbz0LINb9OUeX0tT5qQseHflO2PaJykxNPC14WhsBKC2lg | ||
dZWnGhO5QJFp69AnSp4k+Uo/1LMk87YEJIL1NDR0lrlKgRvFfFyTpRBt+Qb1Bb7g | ||
rjN0171g8t5GaPWamN3Oua/v4aZg15f3xydRF8y9TsYjiNz+2TzRjKv7AkpZaJST | ||
06CqMjCgiZ6UFFGN0/oqLnwxdP3Mmh4= | ||
=aphN | ||
-----END PGP PUBLIC KEY BLOCK----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
-----BEGIN PGP PUBLIC KEY BLOCK----- | ||
Version: GnuPG v1.4.12 (MingW32) | ||
|
||
mQENBFRtGAgBCADlSku65P14hVdx9E/W0n6MwuB3WGqmsyKNoa3HezFdMjWERldI | ||
NNUdi8O28cZ6j2+Hi9L1HeQIQ9+7FHpR3JyQePBJtRX8WSEusfRtML98opDhJxKm | ||
8Jyxb7aTvCwdNHz3yxADINkMtOj5oRm7VCr8XHkG7YU27ELs8B+BXWvjO21oSosi | ||
FurnhT+H3hQsYXfYA55aa21q0qX+L5dFJSNdzZVo7m9ybioVv2R5+PfBvdaSxCnm | ||
OpcGXFaKAsqVHeTW0pd3sdkin1rkbhOBaU5lFBt2ZiMtKpKHpT8TZnqHpFHFbgi8 | ||
j2ARJj4IDct2OGILddUIZSFyue6WE2hpV5c/ABEBAAG0OEhld2xldHQtUGFja2Fy | ||
ZCBDb21wYW55IFJTQSAoSFAgQ29kZXNpZ25pbmcgU2VydmljZSkgLSAxiQE+BBMB | ||
AgAoBQJUbRgIAhsDBQkSzAMABgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRD6 | ||
3Y1ksSdeo6BJCADOfIPPLPpIOnFK9jH4t8lLUd+RyMc+alA3uTDPUJa/ZHa6DHfh | ||
42iaPYVEV8OG0tnbMlHmwvsZ5c1/MRMw1UbxCvD88P2qM4SUrUjQUlSCms2GLGvF | ||
ftFXBiOJQ7/yBc9o+yoSvwPrrTxSCk4+Sqm0IfVXVzChDM9dM9YPY2Vzjd+LUaYC | ||
3X+eSuggUDO0TmJLJd7tZdF9fVXq3lr63BZ5PY98MTCuOoeSMDa9FIUQf6vn6UUJ | ||
MDSRZ9OzhpNJOKR+ShVRwDK6My8gtVIW1EAW2w3VQWI2UNF07aLeO8UG6nTNWA23 | ||
+OuZkUdgQovjcq01caSefgOkmiQOx6d74CAk | ||
=X+eo | ||
-----END PGP PUBLIC KEY BLOCK----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.