[pve-devel] [PATCH proxmox-offline-mirror 5/8] wizard: simplify Proxmox repository url generation
Fabian Grünbichler
f.gruenbichler at proxmox.com
Tue Sep 9 10:35:09 CEST 2025
On September 8, 2025 5:20 pm, Shannon Sterz wrote:
> On Mon Sep 8, 2025 at 3:16 PM CEST, Fabian Grünbichler wrote:
>> except for test since Trixie, all repositories follow the same scheme..
>>
>> Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
>> ---
>> src/bin/proxmox-offline-mirror.rs | 51 +++++++++----------------------
>> 1 file changed, 15 insertions(+), 36 deletions(-)
>>
>> diff --git a/src/bin/proxmox-offline-mirror.rs b/src/bin/proxmox-offline-mirror.rs
>> index 8198cff..c444e6d 100644
>> --- a/src/bin/proxmox-offline-mirror.rs
>> +++ b/src/bin/proxmox-offline-mirror.rs
>> @@ -356,44 +356,23 @@ fn action_add_mirror(config: &SectionConfigData) -> Result<Vec<MirrorConfig>, Er
>> read_selection_from_tty("Select repository variant", variants, Some(0))?;
>>
>> // TODO enterprise query for key!
>> - let url = match (release, variant) {
>> - (Release::Trixie, ProxmoxVariant::Enterprise) => format!(
>> - "https://enterprise.proxmox.com/debian/{product} trixie {product}-enterprise"
>> + let url = match variant {
>> + ProxmoxVariant::Enterprise => format!(
>> + "https://enterprise.proxmox.com/debian/{product} {release} {product}-enterprise"
>> ),
>> - (Release::Trixie, ProxmoxVariant::NoSubscription) => format!(
>> - "http://download.proxmox.com/debian/{product} trixie {product}-no-subscription"
>> + ProxmoxVariant::NoSubscription => format!(
>> + "http://download.proxmox.com/debian/{product} {release} {product}-no-subscription"
>> ),
>> - (Release::Trixie, ProxmoxVariant::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"
>> - ),
>> - (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")
>> + ProxmoxVariant::Test => {
>> + if release >= &Release::Trixie {
>> + format!(
>> + "http://download.proxmox.com/debian/{product} {release} {product}-test"
>> + )
>> + } else {
>> + format!(
>> + "http://download.proxmox.com/debian/{product} {release} {product}test"
>> + )
>> + }
>> }
>> };
>>
>
> is there a reason why the `Display` implementation for
> `ProxmoxVariant::NoSubscription` uses an underscore? from what i can
> tell we mostly seem to use it to derive a suggested mirro id. if we used
> a hyphen there instead this could become
>
> if release < &Release::Trixie && variant == ProxmoxVariant::Test {
> format!(
> "http://download.proxmox.com/debian/{product} {release} {product}test"
> )
> } else {
> format!(
> "http://download.proxmox.com/debian/{product} {release} {product}-{variant}"
> )
> }
I guess this would work - but it still needs to account for enterprise
having a different base url ;) I'll send a follow-up patch for this if
it looks sane
More information about the pve-devel
mailing list