public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH offline-mirror 1/3] mirror: remove redundant ref in if-let pattern
@ 2025-02-24  9:33 Maximiliano Sandoval
  2025-02-24  9:33 ` [pbs-devel] [PATCH offline-mirror 2/3] cargo: update to edition 2024 Maximiliano Sandoval
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Maximiliano Sandoval @ 2025-02-24  9:33 UTC (permalink / raw)
  To: pbs-devel

Discovered by `cargo fix --edition`.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 src/mirror.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mirror.rs b/src/mirror.rs
index 40ee120..b56c33c 100644
--- a/src/mirror.rs
+++ b/src/mirror.rs
@@ -539,7 +539,7 @@ fn fetch_binary_packages(
         let mut skip_bytes = 0usize;
 
         for package in references.files {
-            if let Some(ref sections) = &config.skip.skip_sections {
+            if let Some(sections) = &config.skip.skip_sections {
                 if sections.iter().any(|section| {
                     package.section == *section
                         || package.section == format!("{component}/{section}")
@@ -654,7 +654,7 @@ fn fetch_source_packages(
         let mut skip_count = 0usize;
         let mut skip_bytes = 0usize;
         for package in references.source_packages {
-            if let Some(ref sections) = &config.skip.skip_sections {
+            if let Some(sections) = &config.skip.skip_sections {
                 if sections.iter().any(|section| {
                     package.section.as_ref() == Some(section)
                         || package.section == Some(format!("{component}/{section}"))
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pbs-devel] [PATCH offline-mirror 2/3] cargo: update to edition 2024
  2025-02-24  9:33 [pbs-devel] [PATCH offline-mirror 1/3] mirror: remove redundant ref in if-let pattern Maximiliano Sandoval
@ 2025-02-24  9:33 ` Maximiliano Sandoval
  2025-02-24  9:33 ` [pbs-devel] [PATCH offline-mirror 3/3] cargo: run fmt Maximiliano Sandoval
  2025-03-03 12:30 ` [pbs-devel] applied-series: [PATCH offline-mirror 1/3] mirror: remove redundant ref in if-let pattern Fabian Grünbichler
  2 siblings, 0 replies; 4+ messages in thread
From: Maximiliano Sandoval @ 2025-02-24  9:33 UTC (permalink / raw)
  To: pbs-devel

This requires 1.85.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---

One could drop the rust-version here instead, but this approach reduces the
diffs in the future.

 Cargo.toml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Cargo.toml b/Cargo.toml
index 6699502..bc92b19 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -2,10 +2,10 @@
 name = "proxmox-offline-mirror"
 version = "0.6.7"
 authors = ["Proxmox Support Team <support@proxmox.com>"]
-edition = "2021"
+edition = "2024"
 license = "AGPL-3"
 description = "Proxmox offline repository mirror and subscription key manager"
-rust-version = "1.80"
+rust-version = "1.85"
 
 exclude = ["debian"]
 
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pbs-devel] [PATCH offline-mirror 3/3] cargo: run fmt
  2025-02-24  9:33 [pbs-devel] [PATCH offline-mirror 1/3] mirror: remove redundant ref in if-let pattern Maximiliano Sandoval
  2025-02-24  9:33 ` [pbs-devel] [PATCH offline-mirror 2/3] cargo: update to edition 2024 Maximiliano Sandoval
@ 2025-02-24  9:33 ` Maximiliano Sandoval
  2025-03-03 12:30 ` [pbs-devel] applied-series: [PATCH offline-mirror 1/3] mirror: remove redundant ref in if-let pattern Fabian Grünbichler
  2 siblings, 0 replies; 4+ messages in thread
From: Maximiliano Sandoval @ 2025-02-24  9:33 UTC (permalink / raw)
  To: pbs-devel

See the following links for the 2024 edition formatting changes:
- https://doc.rust-lang.org/edition-guide/rust-2024/rustfmt-formatting-fixes.html
- https://doc.rust-lang.org/edition-guide/rust-2024/rustfmt-version-sorting.html

These format changes come exclusively from the edition and not from
upgrading rustfmt to 1.85.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 src/bin/docgen.rs                             |  2 +-
 src/bin/proxmox-offline-mirror-helper.rs      | 14 ++--
 src/bin/proxmox-offline-mirror.rs             | 68 ++++++++++++++-----
 src/bin/proxmox_offline_mirror_cmds/config.rs |  8 +--
 src/bin/proxmox_offline_mirror_cmds/medium.rs |  2 +-
 src/bin/proxmox_offline_mirror_cmds/mirror.rs |  8 +--
 .../subscription.rs                           | 10 +--
 src/config.rs                                 |  8 +--
 src/helpers/tty.rs                            |  2 +-
 src/helpers/verifier.rs                       |  6 +-
 src/lib.rs                                    |  2 +-
 src/medium.rs                                 | 16 +++--
 src/mirror.rs                                 |  8 +--
 src/pool.rs                                   | 16 +++--
 src/subscription.rs                           |  4 +-
 src/types.rs                                  |  2 +-
 16 files changed, 109 insertions(+), 67 deletions(-)

diff --git a/src/bin/docgen.rs b/src/bin/docgen.rs
index c8812a6..6de17a1 100644
--- a/src/bin/docgen.rs
+++ b/src/bin/docgen.rs
@@ -1,4 +1,4 @@
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
 use proxmox_offline_mirror::config;
 
 use proxmox_section_config::dump_section_config;
diff --git a/src/bin/proxmox-offline-mirror-helper.rs b/src/bin/proxmox-offline-mirror-helper.rs
index cb6bb7b..7911d52 100644
--- a/src/bin/proxmox-offline-mirror-helper.rs
+++ b/src/bin/proxmox-offline-mirror-helper.rs
@@ -3,26 +3,26 @@ use std::path::PathBuf;
 use std::process::Command;
 use std::{collections::HashMap, path::Path};
 
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
 
 use proxmox_offline_mirror::types::Snapshot;
 use proxmox_subscription::{ProductType, SubscriptionInfo};
 use proxmox_sys::command::run_command;
 use proxmox_sys::fs::file_get_contents;
-use proxmox_sys::fs::{replace_file, CreateOptions};
+use proxmox_sys::fs::{CreateOptions, replace_file};
 use proxmox_time::epoch_to_rfc3339_utc;
 use serde_json::Value;
 
 use proxmox_router::cli::{
-    format_and_print_result, get_output_format, run_cli_command, CliCommand, CliCommandMap,
-    CliEnvironment, OUTPUT_FORMAT,
+    CliCommand, CliCommandMap, CliEnvironment, OUTPUT_FORMAT, format_and_print_result,
+    get_output_format, run_cli_command,
 };
 use proxmox_schema::{api, param_bail};
 
 use proxmox_offline_mirror::helpers::tty::{
     read_bool_from_tty, read_selection_from_tty, read_string_from_tty,
 };
-use proxmox_offline_mirror::medium::{self, generate_repo_snippet, MediumState};
+use proxmox_offline_mirror::medium::{self, MediumState, generate_repo_snippet};
 
 fn set_subscription_key(
     product: &ProductType,
@@ -211,7 +211,9 @@ async fn setup(_param: Value) -> Result<(), Error> {
                     file.push(snippet_file_name);
                     replace_file(file, data.as_bytes(), CreateOptions::default(), true)?;
                 } else {
-                    println!("Add above snippet to system's repository entries (/etc/apt/sources.list.d/) manually to configure.");
+                    println!(
+                        "Add above snippet to system's repository entries (/etc/apt/sources.list.d/) manually to configure."
+                    );
                 }
 
                 println!("Now run 'apt update && apt full-upgrade' to upgrade system.");
diff --git a/src/bin/proxmox-offline-mirror.rs b/src/bin/proxmox-offline-mirror.rs
index c3eb902..2da13f5 100644
--- a/src/bin/proxmox-offline-mirror.rs
+++ b/src/bin/proxmox-offline-mirror.rs
@@ -3,12 +3,12 @@ use std::io::IsTerminal;
 use std::matches;
 use std::path::Path;
 
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
 use proxmox_offline_mirror::config::SubscriptionKey;
 use proxmox_offline_mirror::subscription::{extract_mirror_key, refresh_mirror_key};
 use serde_json::Value;
 
-use proxmox_router::cli::{run_cli_command, CliCommand, CliCommandMap, CliEnvironment};
+use proxmox_router::cli::{CliCommand, CliCommandMap, CliEnvironment, run_cli_command};
 use proxmox_schema::api;
 use proxmox_section_config::SectionConfigData;
 use proxmox_subscription::ProductType;
@@ -17,7 +17,7 @@ use proxmox_offline_mirror::helpers::tty::{
     read_bool_from_tty, read_selection_from_tty, read_string_from_tty,
 };
 use proxmox_offline_mirror::{
-    config::{save_config, MediaConfig, MirrorConfig, SkipConfig},
+    config::{MediaConfig, MirrorConfig, SkipConfig, save_config},
     mirror,
     types::{MEDIA_ID_SCHEMA, MIRROR_ID_SCHEMA},
 };
@@ -350,15 +350,33 @@ fn action_add_mirror(config: &SectionConfigData) -> Result<Vec<MirrorConfig>, Er
 
                 // TODO enterprise query for key!
                 let url = match (release, variant) {
-                    (Release::Bookworm, ProxmoxVariant::Enterprise) => format!("https://enterprise.proxmox.com/debian/{product} bookworm {product}-enterprise"),
-                    (Release::Bookworm, ProxmoxVariant::NoSubscription) => format!("http://download.proxmox.com/debian/{product} bookworm {product}-no-subscription"),
-                    (Release::Bookworm, ProxmoxVariant::Test) => format!("http://download.proxmox.com/debian/{product} bookworm {product}test"),
-                    (Release::Bullseye, ProxmoxVariant::Enterprise) => format!("https://enterprise.proxmox.com/debian/{product} bullseye {product}-enterprise"),
-                    (Release::Bullseye, ProxmoxVariant::NoSubscription) => format!("http://download.proxmox.com/debian/{product} bullseye {product}-no-subscription"),
-                    (Release::Bullseye, ProxmoxVariant::Test) => format!("http://download.proxmox.com/debian/{product} bullseye {product}test"),
-                    (Release::Buster, ProxmoxVariant::Enterprise) => format!("https://enterprise.proxmox.com/debian/{product} buster {product}-enterprise"),
-                    (Release::Buster, ProxmoxVariant::NoSubscription) => format!("http://download.proxmox.com/debian/{product} buster {product}-no-subscription"),
-                    (Release::Buster, ProxmoxVariant::Test) => format!("http://download.proxmox.com/debian/{product} buster {product}test"),
+                    (Release::Bookworm, ProxmoxVariant::Enterprise) => format!(
+                        "https://enterprise.proxmox.com/debian/{product} bookworm {product}-enterprise"
+                    ),
+                    (Release::Bookworm, ProxmoxVariant::NoSubscription) => format!(
+                        "http://download.proxmox.com/debian/{product} bookworm {product}-no-subscription"
+                    ),
+                    (Release::Bookworm, ProxmoxVariant::Test) => format!(
+                        "http://download.proxmox.com/debian/{product} bookworm {product}test"
+                    ),
+                    (Release::Bullseye, ProxmoxVariant::Enterprise) => format!(
+                        "https://enterprise.proxmox.com/debian/{product} bullseye {product}-enterprise"
+                    ),
+                    (Release::Bullseye, ProxmoxVariant::NoSubscription) => format!(
+                        "http://download.proxmox.com/debian/{product} bullseye {product}-no-subscription"
+                    ),
+                    (Release::Bullseye, ProxmoxVariant::Test) => format!(
+                        "http://download.proxmox.com/debian/{product} bullseye {product}test"
+                    ),
+                    (Release::Buster, ProxmoxVariant::Enterprise) => format!(
+                        "https://enterprise.proxmox.com/debian/{product} buster {product}-enterprise"
+                    ),
+                    (Release::Buster, ProxmoxVariant::NoSubscription) => format!(
+                        "http://download.proxmox.com/debian/{product} buster {product}-no-subscription"
+                    ),
+                    (Release::Buster, ProxmoxVariant::Test) => {
+                        format!("http://download.proxmox.com/debian/{product} buster {product}test")
+                    }
                 };
 
                 use_subscription = match (product, variant) {
@@ -442,7 +460,9 @@ fn action_add_mirror(config: &SectionConfigData) -> Result<Vec<MirrorConfig>, Er
     };
 
     if !Path::new(&key_path).exists() {
-        eprintln!("Keyfile '{key_path}' doesn't exist - make sure to install relevant keyring packages or update config to provide correct path!");
+        eprintln!(
+            "Keyfile '{key_path}' doesn't exist - make sure to install relevant keyring packages or update config to provide correct path!"
+        );
     }
 
     let id = loop {
@@ -476,7 +496,10 @@ fn action_add_mirror(config: &SectionConfigData) -> Result<Vec<MirrorConfig>, Er
         "Should already mirrored files be re-verified when updating the mirror? (io-intensive!)",
         Some(true),
     )?;
-    let sync = read_bool_from_tty("Should newly written files be written using FSYNC to ensure crash-consistency? (io-intensive!)", Some(true))?;
+    let sync = read_bool_from_tty(
+        "Should newly written files be written using FSYNC to ensure crash-consistency? (io-intensive!)",
+        Some(true),
+    )?;
 
     let mut configs = Vec::with_capacity(extra_repos.len() + 1);
 
@@ -672,7 +695,10 @@ fn action_add_medium(config: &SectionConfigData) -> Result<MediaConfig, Error> {
         "Should mirrored files be re-verified when updating the medium? (io-intensive!)",
         Some(true),
     )?;
-    let sync = read_bool_from_tty("Should newly written files be written using FSYNC to ensure crash-consistency? (io-intensive!)", Some(true))?;
+    let sync = read_bool_from_tty(
+        "Should newly written files be written using FSYNC to ensure crash-consistency? (io-intensive!)",
+        Some(true),
+    )?;
 
     Ok(MediaConfig {
         id,
@@ -845,7 +871,9 @@ async fn setup(config: Option<String>, _param: Value) -> Result<(), Error> {
                     config.set_data(&id, "mirror", mirror_config)?;
                     save_config(&config_file, &config)?;
                     println!("Config entry '{id}' added");
-                    println!("Run \"proxmox-offline-mirror mirror snapshot create --config '{config_file}' '{id}'\" to create a new mirror snapshot.");
+                    println!(
+                        "Run \"proxmox-offline-mirror mirror snapshot create --config '{config_file}' '{id}'\" to create a new mirror snapshot."
+                    );
                 }
             }
             Action::AddMedium => {
@@ -854,7 +882,9 @@ async fn setup(config: Option<String>, _param: Value) -> Result<(), Error> {
                 config.set_data(&id, "medium", media_config)?;
                 save_config(&config_file, &config)?;
                 println!("Config entry '{id}' added");
-                println!("Run \"proxmox-offline-mirror medium sync --config '{config_file}' '{id}'\" to sync mirror snapshots to medium.");
+                println!(
+                    "Run \"proxmox-offline-mirror medium sync --config '{config_file}' '{id}'\" to sync mirror snapshots to medium."
+                );
             }
             Action::AddKey => {
                 let key = action_add_key(&config)?;
@@ -862,7 +892,9 @@ async fn setup(config: Option<String>, _param: Value) -> Result<(), Error> {
                 config.set_data(&id, "subscription", &key)?;
                 save_config(&config_file, &config)?;
                 println!("Config entry '{id}' added");
-                println!("Run \"proxmox-offline-mirror key refresh\" to refresh subscription information");
+                println!(
+                    "Run \"proxmox-offline-mirror key refresh\" to refresh subscription information"
+                );
             }
         }
     }
diff --git a/src/bin/proxmox_offline_mirror_cmds/config.rs b/src/bin/proxmox_offline_mirror_cmds/config.rs
index d0d9756..57388c7 100644
--- a/src/bin/proxmox_offline_mirror_cmds/config.rs
+++ b/src/bin/proxmox_offline_mirror_cmds/config.rs
@@ -1,13 +1,13 @@
 use std::{env, fs::remove_dir_all, path::Path};
 
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
 use serde_json::Value;
 
 use proxmox_router::cli::{
-    default_table_format_options, format_and_print_result_full, get_output_format, CliCommand,
-    CliCommandMap, ColumnConfig, CommandLineInterface, OUTPUT_FORMAT,
+    CliCommand, CliCommandMap, ColumnConfig, CommandLineInterface, OUTPUT_FORMAT,
+    default_table_format_options, format_and_print_result_full, get_output_format,
 };
-use proxmox_schema::{api, param_bail, ApiType, ArraySchema, ReturnType};
+use proxmox_schema::{ApiType, ArraySchema, ReturnType, api, param_bail};
 
 use proxmox_offline_mirror::{
     config::{MediaConfig, MediaConfigUpdater, MirrorConfig, MirrorConfigUpdater},
diff --git a/src/bin/proxmox_offline_mirror_cmds/medium.rs b/src/bin/proxmox_offline_mirror_cmds/medium.rs
index 3f05d43..9988156 100644
--- a/src/bin/proxmox_offline_mirror_cmds/medium.rs
+++ b/src/bin/proxmox_offline_mirror_cmds/medium.rs
@@ -14,7 +14,7 @@ use proxmox_offline_mirror::{
     generate_repo_file_line,
     medium::{self},
     mirror,
-    types::{Snapshot, MEDIA_ID_SCHEMA},
+    types::{MEDIA_ID_SCHEMA, Snapshot},
 };
 
 use super::get_config_path;
diff --git a/src/bin/proxmox_offline_mirror_cmds/mirror.rs b/src/bin/proxmox_offline_mirror_cmds/mirror.rs
index 07db92f..31a565e 100644
--- a/src/bin/proxmox_offline_mirror_cmds/mirror.rs
+++ b/src/bin/proxmox_offline_mirror_cmds/mirror.rs
@@ -1,4 +1,4 @@
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
 
 use proxmox_section_config::SectionConfigData;
 use proxmox_subscription::SubscriptionStatus;
@@ -9,15 +9,15 @@ use std::{
 };
 
 use proxmox_router::cli::{
-    format_and_print_result, get_output_format, CliCommand, CliCommandMap, CommandLineInterface,
-    OUTPUT_FORMAT,
+    CliCommand, CliCommandMap, CommandLineInterface, OUTPUT_FORMAT, format_and_print_result,
+    get_output_format,
 };
 use proxmox_schema::api;
 
 use proxmox_offline_mirror::{
     config::{MirrorConfig, SubscriptionKey},
     mirror,
-    types::{Snapshot, MIRROR_ID_SCHEMA},
+    types::{MIRROR_ID_SCHEMA, Snapshot},
 };
 
 use super::get_config_path;
diff --git a/src/bin/proxmox_offline_mirror_cmds/subscription.rs b/src/bin/proxmox_offline_mirror_cmds/subscription.rs
index 72275e6..8fec4b4 100644
--- a/src/bin/proxmox_offline_mirror_cmds/subscription.rs
+++ b/src/bin/proxmox_offline_mirror_cmds/subscription.rs
@@ -1,4 +1,4 @@
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
 
 use serde::Serialize;
 use serde_json::Value;
@@ -9,15 +9,15 @@ use proxmox_offline_mirror::{
     subscription::{extract_mirror_key, refresh_mirror_key, refresh_offline_keys},
     types::PROXMOX_SUBSCRIPTION_KEY_SCHEMA,
 };
-use proxmox_subscription::{files::DEFAULT_SIGNING_KEY, ProductType, SubscriptionStatus};
+use proxmox_subscription::{ProductType, SubscriptionStatus, files::DEFAULT_SIGNING_KEY};
 use proxmox_sys::fs::file_get_contents;
 use proxmox_time::epoch_to_rfc3339_utc;
 
 use proxmox_router::cli::{
-    default_table_format_options, format_and_print_result_full, get_output_format, CliCommand,
-    CliCommandMap, ColumnConfig, CommandLineInterface, OUTPUT_FORMAT,
+    CliCommand, CliCommandMap, ColumnConfig, CommandLineInterface, OUTPUT_FORMAT,
+    default_table_format_options, format_and_print_result_full, get_output_format,
 };
-use proxmox_schema::{api, param_bail, ApiType, ArraySchema, ReturnType};
+use proxmox_schema::{ApiType, ArraySchema, ReturnType, api, param_bail};
 
 use super::get_config_path;
 
diff --git a/src/config.rs b/src/config.rs
index 2995402..c1b0330 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -1,14 +1,14 @@
 use std::path::Path;
 use std::sync::LazyLock;
 
-use anyhow::{bail, Error};
-use proxmox_subscription::{sign::ServerBlob, SubscriptionInfo};
+use anyhow::{Error, bail};
+use proxmox_subscription::{SubscriptionInfo, sign::ServerBlob};
 use serde::{Deserialize, Serialize};
 
-use proxmox_schema::{api, ApiStringFormat, ApiType, Updater};
+use proxmox_schema::{ApiStringFormat, ApiType, Updater, api};
 use proxmox_section_config::{SectionConfig, SectionConfigData, SectionConfigPlugin};
 use proxmox_subscription::ProductType;
-use proxmox_sys::fs::{replace_file, CreateOptions};
+use proxmox_sys::fs::{CreateOptions, replace_file};
 
 use crate::types::{
     MEDIA_ID_SCHEMA, MIRROR_ID_SCHEMA, PROXMOX_SERVER_ID_SCHEMA, PROXMOX_SUBSCRIPTION_KEY_SCHEMA,
diff --git a/src/helpers/tty.rs b/src/helpers/tty.rs
index 7ef5469..00f9a6b 100644
--- a/src/helpers/tty.rs
+++ b/src/helpers/tty.rs
@@ -1,6 +1,6 @@
 use std::io::Write;
 
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
 use proxmox_schema::parse_boolean;
 
 /// Prints `query`, reads string from terminal, defaulting to `default`.
diff --git a/src/helpers/verifier.rs b/src/helpers/verifier.rs
index 5a0aa37..85ca195 100644
--- a/src/helpers/verifier.rs
+++ b/src/helpers/verifier.rs
@@ -1,17 +1,17 @@
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
 
 use sequoia_openpgp::{
+    Cert, KeyHandle,
     cert::CertParser,
     parse::{
+        PacketParser, PacketParserResult, Parse,
         stream::{
             DetachedVerifierBuilder, MessageLayer, MessageStructure, VerificationError,
             VerificationHelper, VerifierBuilder,
         },
-        PacketParser, PacketParserResult, Parse,
     },
     policy::StandardPolicy,
     types::HashAlgorithm,
-    Cert, KeyHandle,
 };
 use std::io;
 
diff --git a/src/lib.rs b/src/lib.rs
index 8d5ca3f..cd444d4 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -14,7 +14,7 @@ use std::{
     path::Path,
 };
 
-use anyhow::{format_err, Error};
+use anyhow::{Error, format_err};
 use medium::MirrorInfo;
 use proxmox_apt::repositories::{APTRepositoryFileImpl, APTRepositoryImpl};
 use proxmox_apt_api_types::{APTRepository, APTRepositoryFile, APTRepositoryFileType};
diff --git a/src/medium.rs b/src/medium.rs
index 53df50d..bef6cc7 100644
--- a/src/medium.rs
+++ b/src/medium.rs
@@ -5,11 +5,11 @@ use std::{
     path::{Path, PathBuf},
 };
 
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
 use nix::libc;
 use openssl::sha::sha256;
 use proxmox_subscription::SubscriptionInfo;
-use proxmox_sys::fs::{file_get_contents, replace_file, CreateOptions};
+use proxmox_sys::fs::{CreateOptions, file_get_contents, replace_file};
 use proxmox_time::{epoch_i64, epoch_to_rfc3339_utc};
 use serde::{Deserialize, Serialize};
 
@@ -18,7 +18,7 @@ use crate::{
     generate_repo_file_line,
     mirror::pool,
     pool::Pool,
-    types::{Diff, Snapshot, SNAPSHOT_REGEX},
+    types::{Diff, SNAPSHOT_REGEX, Snapshot},
 };
 #[derive(Clone, Debug, Serialize, Deserialize)]
 #[serde(rename_all = "kebab-case")]
@@ -420,13 +420,17 @@ pub fn sync(
         if mirror_base.exists() {
             match pools.get(&dropped) {
                 Some(pool) => {
-                    println!("Removing previously synced, but no longer configured mirror '{dropped}'..");
+                    println!(
+                        "Removing previously synced, but no longer configured mirror '{dropped}'.."
+                    );
                     let mut pool_dir = medium_base.to_path_buf();
                     pool_dir.push(pool);
                     let pool = Pool::open(&mirror_base, &pool_dir)?;
                     pool.lock()?.destroy()?;
-                },
-                None => bail!("No pool information for previously synced, but no longer configured mirror '{dropped}'"),
+                }
+                None => bail!(
+                    "No pool information for previously synced, but no longer configured mirror '{dropped}'"
+                ),
             }
         }
     }
diff --git a/src/mirror.rs b/src/mirror.rs
index b56c33c..c88f81d 100644
--- a/src/mirror.rs
+++ b/src/mirror.rs
@@ -5,20 +5,20 @@ use std::{
     path::{Path, PathBuf},
 };
 
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
 use flate2::bufread::GzDecoder;
 use globset::{Glob, GlobSet, GlobSetBuilder};
 use nix::libc;
-use proxmox_http::{client::sync::Client, HttpClient, HttpOptions, ProxyConfig};
+use proxmox_http::{HttpClient, HttpOptions, ProxyConfig, client::sync::Client};
 use proxmox_schema::{ApiType, Schema};
 use proxmox_sys::fs::file_get_contents;
 
 use crate::{
+    FetchResult, Progress,
     config::{MirrorConfig, SkipConfig, SubscriptionKey, WeakCryptoConfig},
     convert_repo_line,
     pool::Pool,
-    types::{Diff, Snapshot, SNAPSHOT_REGEX},
-    FetchResult, Progress,
+    types::{Diff, SNAPSHOT_REGEX, Snapshot},
 };
 
 use proxmox_apt::deb822::{
diff --git a/src/pool.rs b/src/pool.rs
index 7db976e..62dbbee 100644
--- a/src/pool.rs
+++ b/src/pool.rs
@@ -1,17 +1,17 @@
 use std::{
     cmp::max,
-    collections::{hash_map::Entry, HashMap},
-    fs::{hard_link, File, Metadata},
+    collections::{HashMap, hash_map::Entry},
+    fs::{File, Metadata, hard_link},
     ops::Deref,
     os::linux::fs::MetadataExt,
     path::{Path, PathBuf},
 };
 
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
 use nix::unistd;
 
 use proxmox_apt::deb822::CheckSums;
-use proxmox_sys::fs::{create_path, file_get_contents, replace_file, CreateOptions};
+use proxmox_sys::fs::{CreateOptions, create_path, file_get_contents, replace_file};
 use proxmox_time::epoch_i64;
 use walkdir::WalkDir;
 
@@ -298,7 +298,9 @@ impl PoolLockGuard<'_> {
 
             if checked_link_count % progress_modulo == 0 || last_progress + 30 < epoch_i64() {
                 last_progress = epoch_i64();
-                println!("Progress: checked {checked_link_count} links; added {added_count} files ({added_size}b) / {link_count} links to target pool");
+                println!(
+                    "Progress: checked {checked_link_count} links; added {added_count} files ({added_size}b) / {link_count} links to target pool"
+                );
             }
         }
         println!(
@@ -350,7 +352,9 @@ impl PoolLockGuard<'_> {
             println!("None found.")
         }
 
-        println!("Syncing done: added {added_count} files ({added_size}b) / {link_count} links to target pool");
+        println!(
+            "Syncing done: added {added_count} files ({added_size}b) / {link_count} links to target pool"
+        );
 
         Ok(())
     }
diff --git a/src/subscription.rs b/src/subscription.rs
index 3f0c776..fc80a6f 100644
--- a/src/subscription.rs
+++ b/src/subscription.rs
@@ -1,11 +1,11 @@
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
 
 use proxmox_http::client::sync::Client;
 use proxmox_http::{HttpClient, HttpOptions, ProxyConfig};
 use proxmox_subscription::SubscriptionStatus;
 use proxmox_subscription::{
-    sign::{SignRequest, SignedResponse},
     ProductType, SubscriptionInfo,
+    sign::{SignRequest, SignedResponse},
 };
 
 use crate::config::SubscriptionKey;
diff --git a/src/types.rs b/src/types.rs
index 7544d5e..10dde65 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -1,7 +1,7 @@
 use std::{fmt::Display, path::PathBuf, str::FromStr};
 
 use anyhow::Error;
-use proxmox_schema::{api, const_regex, ApiStringFormat, Schema, StringSchema};
+use proxmox_schema::{ApiStringFormat, Schema, StringSchema, api, const_regex};
 use proxmox_serde::{forward_deserialize_to_from_str, forward_serialize_to_display};
 use proxmox_time::{epoch_i64, epoch_to_rfc3339_utc, parse_rfc3339};
 
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pbs-devel] applied-series: [PATCH offline-mirror 1/3] mirror: remove redundant ref in if-let pattern
  2025-02-24  9:33 [pbs-devel] [PATCH offline-mirror 1/3] mirror: remove redundant ref in if-let pattern Maximiliano Sandoval
  2025-02-24  9:33 ` [pbs-devel] [PATCH offline-mirror 2/3] cargo: update to edition 2024 Maximiliano Sandoval
  2025-02-24  9:33 ` [pbs-devel] [PATCH offline-mirror 3/3] cargo: run fmt Maximiliano Sandoval
@ 2025-03-03 12:30 ` Fabian Grünbichler
  2 siblings, 0 replies; 4+ messages in thread
From: Fabian Grünbichler @ 2025-03-03 12:30 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion

On February 24, 2025 10:33 am, Maximiliano Sandoval wrote:
> Discovered by `cargo fix --edition`.
> 
> Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
> ---
>  src/mirror.rs | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mirror.rs b/src/mirror.rs
> index 40ee120..b56c33c 100644
> --- a/src/mirror.rs
> +++ b/src/mirror.rs
> @@ -539,7 +539,7 @@ fn fetch_binary_packages(
>          let mut skip_bytes = 0usize;
>  
>          for package in references.files {
> -            if let Some(ref sections) = &config.skip.skip_sections {
> +            if let Some(sections) = &config.skip.skip_sections {
>                  if sections.iter().any(|section| {
>                      package.section == *section
>                          || package.section == format!("{component}/{section}")
> @@ -654,7 +654,7 @@ fn fetch_source_packages(
>          let mut skip_count = 0usize;
>          let mut skip_bytes = 0usize;
>          for package in references.source_packages {
> -            if let Some(ref sections) = &config.skip.skip_sections {
> +            if let Some(sections) = &config.skip.skip_sections {
>                  if sections.iter().any(|section| {
>                      package.section.as_ref() == Some(section)
>                          || package.section == Some(format!("{component}/{section}"))
> -- 
> 2.39.5
> 
> 
> 
> _______________________________________________
> pbs-devel mailing list
> pbs-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
> 
> 
> 


_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-03-03 12:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-24  9:33 [pbs-devel] [PATCH offline-mirror 1/3] mirror: remove redundant ref in if-let pattern Maximiliano Sandoval
2025-02-24  9:33 ` [pbs-devel] [PATCH offline-mirror 2/3] cargo: update to edition 2024 Maximiliano Sandoval
2025-02-24  9:33 ` [pbs-devel] [PATCH offline-mirror 3/3] cargo: run fmt Maximiliano Sandoval
2025-03-03 12:30 ` [pbs-devel] applied-series: [PATCH offline-mirror 1/3] mirror: remove redundant ref in if-let pattern Fabian Grünbichler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal