Commit Graph

18 Commits

Author SHA1 Message Date
Maximiliano Sandoval
7052972212 apt: clippy: don't clone types implementing Copy
Fixes the clippy warnings:

warning: `proxmox-apt` (lib) generated 1 warning
warning: using `clone` on type `Option<[u8; 32]>` which implements the `Copy` trait
   --> proxmox-apt/tests/repositories.rs:117:22
    |
117 |     let old_digest = file.digest.clone().unwrap();
    |                      ^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `file.digest`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
    = note: `#[warn(clippy::clone_on_copy)]` on by default

warning: using `clone` on type `[u8; 32]` which implements the `Copy` trait
   --> proxmox-apt/tests/repositories.rs:135:24
    |
135 |     file.digest = Some(old_digest.clone());
    |                        ^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `old_digest`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
2024-08-07 20:58:04 +02:00
Dietmar Maurer
79f2b89d29 apt: updates for changed api (digest as array)
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2024-07-17 09:50:29 +02:00
Dietmar Maurer
75c62574c6 apt: avoid global apt config
Because it was only used for the test setup. Instead, we simply
add an apt_lists_dir parameter where we need it.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2024-07-08 15:17:10 +02:00
Dietmar Maurer
f451a643ae apt: add cache feature
Save/read package state from a file, and add the api functions to manipulate
that state.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2024-07-08 15:17:10 +02:00
Dietmar Maurer
f536a91b2f apt: use api types from apt-api-types crate
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2024-07-08 15:17:10 +02:00
Dietmar Maurer
e56e39185a apt: avoid direct impl on api types (use traits instead)
So that we can use api types from expternal crate proxmox-apt-api-types.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2024-07-08 15:17:10 +02:00
Fabian Grünbichler
4126a83e05 apt: fix test output dir
under autopkgtest, the rundir is not writable, but cargo gives us a tmpdir that
we can use in all cases.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-06-06 11:40:49 +02:00
Fabian Grünbichler
6f532dfb7d various clippy fixes
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-06-06 11:40:49 +02:00
Thomas Lamprecht
4e2cc6fd53 tests: factor out directory cleanup+creation
This moves the clean-up to happen up-front. That way one can still
inspect the test data after, e.g., a failed test.

Originally done almost like this in a patch from Fiona [0] that I just
overlooked, but now also factored out, avoid crowding the test code to
much with duplicate code.

[0]: https://lists.proxmox.com/pipermail/pve-devel/2023-June/057136.html

Suggested-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-09-05 15:15:46 +02:00
Thomas Lamprecht
1e47036528 apt: add Ceph Reef to standard repo list
For now just duplicate the Ceph Quincy entries, as I want to avoid
using macros and we do not yet have support for enums inside enums
with the api macro.

Adapt and expand the tests slightly to have at least some simple
coverage there too.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-09-04 17:58:45 +02:00
Thomas Lamprecht
ae3c04a76b apt: tests: allow re-running digest test without clean-up
Files inside CARGO_TARGET_TMPDIR are only cleaned on `cargo clean`, so
tests that expect files to not exist need to cleanup themselves.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-09-04 17:58:45 +02:00
Fiona Ebner
cc17861f54 apt: tests: add tests for Ceph Quincy repository detection on Bookworm
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-06-03 14:39:05 +02:00
Fiona Ebner
06ad528c94 apt: tests: code cleanup to avoid useless vector
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-06-03 14:39:05 +02:00
Fiona Ebner
9b7c5339d7 apt: tests: create temporary test directories in CARGO_TARGET_TMPDIR
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-06-03 14:39:05 +02:00
Fiona Ebner
bae15e2408 apt: split Ceph main repository into no-subscription and enterprise
The old 'main' component stays valid, pointing to no-subscription,
which means the is_referenced_repository() check needs a special case
for it. It will eventually go away, together with the handles for
Quincy.

Alternatively, the standard repository's info() could've been changed
to return multiple possible components, similar to URLs, but as
opposed to URLs, there could be a standard repository that wants to
have multiple components and it feels a bit unnatural, because
multiple components are usually not aliases of the same. And adapting
is_referenced_repository() would be needed here too. So overall, the
above alternative just felt better.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-06-03 14:39:05 +02:00
Fiona Ebner
21b58c3384 apt: drop older Ceph standard repositories
On Proxmox VE 8, only Quincy and newer will be supported.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-06-03 14:39:05 +02:00
Wolfgang Bumiller
3c85df6830 proxmox-apt: update tests to expect bookworm
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-05-24 09:50:33 +02:00
Wolfgang Bumiller
0ff81719ad move to proxmox-apt/
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-05-24 09:21:55 +02:00