public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Christian Ebner <c.ebner@proxmox.com>
Subject: Re: [pve-devel] [PATCH proxmox master stable-2 1/2] apt: repos: extend `Codename` by `Unknown` variant
Date: Tue, 6 Feb 2024 09:29:33 +0100	[thread overview]
Message-ID: <362b0156-16d4-40d6-9eb0-6bea947e7092@proxmox.com> (raw)
In-Reply-To: <20240205170827.340962-1-c.ebner@proxmox.com>

Am 05.02.24 um 18:08 schrieb Christian Ebner:
> Instead of returning an Option for the Codename variant, with None for
> unknowns, extend the enum by an Unknown variant with additional internal
> type to avoid misuse of this variant.
> 
> Co-authored-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
> Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
> ---
>  proxmox-apt/src/repositories/file.rs    | 12 +++--
>  proxmox-apt/src/repositories/release.rs | 61 +++++++++++++++----------
>  2 files changed, 46 insertions(+), 27 deletions(-)
> 
> diff --git a/proxmox-apt/src/repositories/file.rs b/proxmox-apt/src/repositories/file.rs
> index b4c6b08..b8a2c7f 100644
> --- a/proxmox-apt/src/repositories/file.rs
> +++ b/proxmox-apt/src/repositories/file.rs
> @@ -405,10 +405,14 @@ impl APTRepositoryFile {
>                      add_info("warning", message_old(base_suite));
>                  }
>  
> -                if Some(codename) == current_codename.next() {
> -                    add_info("ignore-pre-upgrade-warning", message_new(base_suite));
> -                } else if codename > current_codename {
> -                    add_info("warning", message_new(base_suite));
> +                match current_codename.next() {
> +                    name if name == codename => {
> +                        add_info("ignore-pre-upgrade-warning", message_new(base_suite));
> +                    }
> +                    DebianCodename::Unknown(_, _) if codename > current_codename => {
> +                        add_info("warning", message_new(base_suite));
> +                    }
> +                    _ => {}

Like this, the warning is lost when we match a known codename that is
newer than the current one. What is the issue with the current code you
are trying to address?

As for the match, you could pull in the case where the suite is older
(the if block just above this code) and rather do an exhaustive match.




  parent reply	other threads:[~2024-02-06  8:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-05 17:08 Christian Ebner
2024-02-05 17:08 ` [pve-devel] [PATCH proxmox stable-2 2/2] apt: repos: Remove unneeded unwrap for codename variant Christian Ebner
2024-02-06  8:29 ` Fiona Ebner [this message]
2024-02-06  8:48   ` [pve-devel] [PATCH proxmox master stable-2 1/2] apt: repos: extend `Codename` by `Unknown` variant Christian Ebner
2024-02-06  8:59     ` Fiona Ebner
2024-02-06  9:26       ` Christian Ebner

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=362b0156-16d4-40d6-9eb0-6bea947e7092@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=c.ebner@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