while this is a reasonable convention to follow, in this case the new
function is part of a public trait and changing the signature would
force all users to adapt. so ignore the lint for now [1].
[1]:
https://rust-lang.github.io/rust-clippy/master/index.html#new_ret_no_self
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
while the function would be more useful as pointed out by the clippy
lint, it i currently `pub` and users of the function would need to
adapt to the change here. so ignore the lint for now.
[1]: https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
For consistency with it's other repositories, we might migrate other
products also to this schema with a future major release (and nginx
rewrite config for backward compatibility)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Fixes the manual_flatten clippy lint:
```
warning: unnecessary `if let` since only the `Some` variant of the iterator element is used
--> proxmox-apt/src/repositories/mod.rs:40:5
|
40 | for digest in digests.values() {
| ^ ---------------- help: try: `digests.values().copied().flatten()`
| _____|
| |
41 | | if let Some(digest) = digest {
42 | | common_raw.extend_from_slice(&digest[..]);
43 | | }
44 | | }
| |_____^
|
help: ...and remove the `if let` statement in the for loop
--> proxmox-apt/src/repositories/mod.rs:41:9
|
41 | / if let Some(digest) = digest {
42 | | common_raw.extend_from_slice(&digest[..]);
43 | | }
| |_________^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_flatten
= note: `#[warn(clippy::manual_flatten)]` on by default
```
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
FG: use `into_values().flatten()` instead of `values().copied().flatten()
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Fixes the single_match clippy lint:
```
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> proxmox-apt/src/repositories/mod.rs:41:9
|
41 | / match digest {
42 | | Some(digest) => common_raw.extend_from_slice(&digest[..]),
43 | | None => (),
44 | | }
| |_________^ help: try: `if let Some(digest) = digest { common_raw.extend_from_slice(&digest[..]) }`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
= note: `#[warn(clippy::single_match)]` on by default
```
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
Fixes the manual_unwrap_or_default clippy lint:
```
warning: match can be simplified with `.unwrap_or_default()`
--> proxmox-apt/src/repositories/file.rs:369:30
|
369 | let mut origin = match repo.get_cached_origin(apt_lists_dir) {
| ______________________________^
370 | | Ok(option) => option,
371 | | Err(_) => None,
372 | | };
| |_____________^ help: replace it with: `repo.get_cached_origin(apt_lists_dir).unwrap_or_default()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or_default
= note: `#[warn(clippy::manual_unwrap_or_default)]` on by default
```
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
Fixes:
warning: match can be simplified with `.unwrap_or_default()`
--> proxmox-apt/src/cache_api.rs:77:28
|
77 | let mut notified = match cache.notified {
| ____________________________^
78 | | Some(notified) => notified,
79 | | None => std::collections::HashMap::new(),
80 | | };
| |_________^ help: replace it with: `cache.notified.unwrap_or_default()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or_default
= note: `#[warn(clippy::manual_unwrap_or_default)]` on by default
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
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>
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>
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>
Some users might want to switch to using only the newer .sources files
already, which Debian is going to switch to in the long run.
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
it seems there are repositories out there that don't (always) include
it, and while it is required for the .deb packages themselves in Debian,
the repository "spec" doesn't make it mandatory.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
it seems there are repositories out there that don't (always) include
it, and while it is required for the .deb packages themselves in Debian,
the repository "spec" doesn't make it mandatory.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
note: not complete, there's other code to check and rework, but I had
this already done so commit it, better than nothing.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
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>
the "main" repo only exists for Quincy to allow an easier transition
from Proxmox VE 7 to Proxmox VE 8, for when the enterprise repo got
added for ceph too.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
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>
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>