public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 1/2] pbs3to4: add check for spelling of pbs-test repo
Date: Wed,  6 Aug 2025 12:07:02 +0200	[thread overview]
Message-ID: <20250806100941.59272-2-f.ebner@proxmox.com> (raw)
In-Reply-To: <20250806100941.59272-1-f.ebner@proxmox.com>

Logic copied and messages adapted from the pve8to9 checker script in
Proxmox VE.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 src/bin/pbs3to4.rs | 45 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/src/bin/pbs3to4.rs b/src/bin/pbs3to4.rs
index 67640b48..46aa0a63 100644
--- a/src/bin/pbs3to4.rs
+++ b/src/bin/pbs3to4.rs
@@ -252,6 +252,7 @@ impl Checker {
         let mut strange_suite = false;
         let mut mismatches = Vec::new();
         let mut found_suite: Option<(String, String)> = None;
+        let mut test_repos = Vec::new();
 
         let (repo_files, _repo_errors, _digest) = repositories::repositories()?;
         for repo_file in repo_files {
@@ -259,6 +260,7 @@ impl Checker {
                 &mut found_suite,
                 &mut mismatches,
                 &mut strange_suite,
+                &mut test_repos,
                 repo_file,
             )?;
         }
@@ -283,6 +285,41 @@ impl Checker {
             }
         }
 
+        // TODO remove the check in PBS 5, one cannot really update to latest 4.4 with an old test
+        // repo anyway
+        for (component, suite, location) in &test_repos {
+            self.output.log_info(format!(
+                "Found test repo for Proxmox Backup Server at {location}, checking compatibility \
+                    with updated 'pve-test' spelling.",
+            ))?;
+            match component.as_str() {
+                "pbstest" => {
+                    let message = format!(
+                        "Found legacy spelling 'pbstest' of the pbs-test repo. Change the repo to \
+                            use 'pbs-test' when updating the repos to the '{NEW_SUITE}' suite for \
+                            Proxmox Backup Server 4!"
+                    );
+                    match suite.as_str() {
+                        NEW_SUITE => self.output.log_fail(message)?,
+                        OLD_SUITE => self.output.log_warn(message)?,
+                        _ => {} // unreachable, other suites return early in check_repo_file()
+                    }
+                }
+                "pbs-test" => match suite.as_str() {
+                    NEW_SUITE => self.output.log_pass(format!(
+                        "Found modern spelling 'pbs-test' of the pbs-test repo for new suite \
+                            '{NEW_SUITE}'.",
+                    ))?,
+                    OLD_SUITE => self.output.log_fail(format!(
+                        "Found modern spelling 'pbs-test' but old suite '{OLD_SUITE}', did you \
+                            forget to update the suite?",
+                    ))?,
+                    _ => {} // unreachable, other suites return early in check_repo_file()
+                },
+                _ => {} // unreachable, only test repositories are added
+            }
+        }
+
         Ok(())
     }
 
@@ -331,6 +368,7 @@ impl Checker {
         found_suite: &mut Option<(String, String)>,
         mismatches: &mut Vec<(String, String)>,
         strange_suite: &mut bool,
+        test_repos: &mut Vec<(String, String, String)>,
         repo_file: APTRepositoryFile,
     ) -> Result<(), Error> {
         for repo in repo_file.repositories {
@@ -368,6 +406,13 @@ impl Checker {
                     let location = repo_file.path.clone().unwrap_or_default();
                     *found_suite = Some((suite.to_string(), location));
                 }
+
+                for component in &repo.components {
+                    if component == "pbstest" || component == "pbs-test" {
+                        let location = repo_file.path.clone().unwrap_or_default();
+                        test_repos.push((component.to_string(), suite.to_string(), location));
+                    }
+                }
             }
         }
         Ok(())
-- 
2.47.2



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


  reply	other threads:[~2025-08-06 10:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-06 10:07 [pbs-devel] [PATCH-SERIES proxmox-backup 0/2] " Fiona Ebner
2025-08-06 10:07 ` Fiona Ebner [this message]
2025-08-06 10:07 ` [pbs-devel] [PATCH proxmox-backup 2/2] pbs3to4: clippy: allow always true comparision against minimal value Fiona Ebner
2025-08-06 11:22 ` [pbs-devel] applied-series: [PATCH-SERIES proxmox-backup 0/2] pbs3to4: add check for spelling of pbs-test repo Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250806100941.59272-2-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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