public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH proxmox-offline-mirror 1/8] wizard: simplify repository url generation
Date: Mon,  8 Sep 2025 15:16:42 +0200	[thread overview]
Message-ID: <20250908131658.650928-2-f.gruenbichler@proxmox.com> (raw)
In-Reply-To: <20250908131658.650928-1-f.gruenbichler@proxmox.com>

everything but Buster follows the same scheme

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
 src/bin/proxmox-offline-mirror.rs | 74 +++++++++++--------------------
 1 file changed, 25 insertions(+), 49 deletions(-)

diff --git a/src/bin/proxmox-offline-mirror.rs b/src/bin/proxmox-offline-mirror.rs
index cb786cd..c67ff82 100644
--- a/src/bin/proxmox-offline-mirror.rs
+++ b/src/bin/proxmox-offline-mirror.rs
@@ -45,6 +45,7 @@ impl Display for Distro {
     }
 }
 
+#[derive(PartialEq, Eq)]
 enum Release {
     Trixie,
     Bookworm,
@@ -63,6 +64,7 @@ impl Display for Release {
     }
 }
 
+#[derive(PartialEq, Eq)]
 enum DebianVariant {
     Main,
     Security,
@@ -136,54 +138,26 @@ fn derive_debian_repo(
         skip_packages,
         skip_sections,
     };
-    let url = match (release, variant) {
-        (Release::Trixie, DebianVariant::Main) => "http://deb.debian.org/debian trixie",
-        (Release::Trixie, DebianVariant::Security) => {
-            "http://deb.debian.org/debian-security trixie-security"
-        }
-        (Release::Trixie, DebianVariant::Updates) => "http://deb.debian.org/debian trixie-updates",
-        (Release::Trixie, DebianVariant::Backports) => {
-            "http://deb.debian.org/debian trixie-backports"
-        }
-        (Release::Trixie, DebianVariant::Debug) => {
-            "http://deb.debian.org/debian-debug trixie-debug"
-        }
-        (Release::Bookworm, DebianVariant::Main) => "http://deb.debian.org/debian bookworm",
-        (Release::Bookworm, DebianVariant::Security) => {
-            "http://deb.debian.org/debian-security bookworm-security"
-        }
-        (Release::Bookworm, DebianVariant::Updates) => {
-            "http://deb.debian.org/debian bookworm-updates"
-        }
-        (Release::Bookworm, DebianVariant::Backports) => {
-            "http://deb.debian.org/debian bookworm-backports"
-        }
-        (Release::Bookworm, DebianVariant::Debug) => {
-            "http://deb.debian.org/debian-debug bookworm-debug"
-        }
-        (Release::Bullseye, DebianVariant::Main) => "http://deb.debian.org/debian bullseye",
-        (Release::Bullseye, DebianVariant::Security) => {
-            "http://deb.debian.org/debian-security bullseye-security"
-        }
-        (Release::Bullseye, DebianVariant::Updates) => {
-            "http://deb.debian.org/debian bullseye-updates"
-        }
-        (Release::Bullseye, DebianVariant::Backports) => {
-            "http://deb.debian.org/debian bullseye-backports"
-        }
-        (Release::Bullseye, DebianVariant::Debug) => {
-            "http://deb.debian.org/debian-debug bullseye-debug"
-        }
-        (Release::Buster, DebianVariant::Main) => "http://deb.debian.org/debian buster",
-        (Release::Buster, DebianVariant::Security) => {
-            "http://deb.debian.org/debian-security buster/updates"
-        }
-        (Release::Buster, DebianVariant::Updates) => "http://deb.debian.org/debian buster-updates",
-        (Release::Buster, DebianVariant::Backports) => {
-            "http://deb.debian.org/debian buster-backports"
-        }
-        (Release::Buster, DebianVariant::Debug) => {
-            "http://deb.debian.org/debian-debug buster-debug"
+    let url = if *release == Release::Buster && *variant == DebianVariant::Security {
+        // non-standard security repo
+        "http://deb.debian.org/debian-security buster/updates".to_string()
+    } else {
+        match variant {
+            DebianVariant::Main => {
+                format!("http://deb.debian.org/debian {release}")
+            }
+            DebianVariant::Security => {
+                format!("http://deb.debian.org/debian-security {release}-security")
+            }
+            DebianVariant::Updates => {
+                format!("http://deb.debian.org/debian {release}-updates")
+            }
+            DebianVariant::Backports => {
+                format!("http://deb.debian.org/debian {release}-backports")
+            }
+            DebianVariant::Debug => {
+                format!("http://deb.debian.org/debian-debug {release}-debug")
+            }
         }
     };
 
@@ -389,7 +363,9 @@ fn action_add_mirror(config: &SectionConfigData) -> Result<Vec<MirrorConfig>, Er
                         "http://download.proxmox.com/debian/{product} trixie {product}-no-subscription"
                     ),
                     (Release::Trixie, ProxmoxVariant::Test) => {
-                        format!("http://download.proxmox.com/debian/{product} trixie {product}-test")
+                        format!(
+                            "http://download.proxmox.com/debian/{product} trixie {product}-test"
+                        )
                     }
                     (Release::Bookworm, ProxmoxVariant::Enterprise) => format!(
                         "https://enterprise.proxmox.com/debian/{product} bookworm {product}-enterprise"
-- 
2.47.3



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

  reply	other threads:[~2025-09-08 13:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-08 13:16 [pve-devel] [PATCH proxmox-offline-mirror 0/8] misc. wizard cleanup Fabian Grünbichler
2025-09-08 13:16 ` Fabian Grünbichler [this message]
2025-09-08 13:16 ` [pve-devel] [PATCH proxmox-offline-mirror 2/8] wizard: implement PartialOrd/Ord on Release Fabian Grünbichler
2025-09-08 13:16 ` [pve-devel] [PATCH proxmox-offline-mirror 3/8] wizard: switch to .pgp for Debian keyring files Fabian Grünbichler
2025-09-08 13:53   ` Shannon Sterz
2025-09-09  8:24     ` Fabian Grünbichler
2025-09-08 13:16 ` [pve-devel] [PATCH proxmox-offline-mirror 4/8] wizard: use /usr/share/keyring/proxmox-release-bookworm.gpg Fabian Grünbichler
2025-09-08 13:16 ` [pve-devel] [PATCH proxmox-offline-mirror 5/8] wizard: simplify Proxmox repository url generation Fabian Grünbichler
2025-09-08 15:20   ` Shannon Sterz
2025-09-09  8:35     ` Fabian Grünbichler
2025-09-08 13:16 ` [pve-devel] [PATCH proxmox-offline-mirror 6/8] wizard: drop Release::Buster and Ceph::Luminous/Nautilus Fabian Grünbichler
2025-09-08 13:16 ` [pve-devel] [PATCH proxmox-offline-mirror 7/8] wizard: simplify default Debian components Fabian Grünbichler
2025-09-08 13:16 ` [pve-devel] [PATCH proxmox-offline-mirror 8/8] wizard: deduplicate Proxmox key path mapping Fabian Grünbichler
2025-09-08 15:27 ` [pve-devel] [PATCH proxmox-offline-mirror 0/8] misc. wizard cleanup Shannon Sterz
2025-09-09  9:02 ` [pve-devel] applied-series: " Fabian Grünbichler

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=20250908131658.650928-2-f.gruenbichler@proxmox.com \
    --to=f.gruenbichler@proxmox.com \
    --cc=pve-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