From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: Fabian Ebner <f.ebner@proxmox.com>
Cc: pbs-devel@lists.proxmox.com
Subject: Re: [pbs-devel] [PATCH v2 proxmox-apt 04/10] add check_repositories function
Date: Wed, 10 Mar 2021 16:17:43 +0100 [thread overview]
Message-ID: <20210310151743.uyqeb7yp5ataz7hj@wobu-vie.proxmox.com> (raw)
In-Reply-To: <20210226150959.9518-5-f.ebner@proxmox.com>
On Fri, Feb 26, 2021 at 04:09:53PM +0100, Fabian Ebner wrote:
> which, for now, checks the suites.
>
> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
> ---
>
> Changes from v1:
> * split this and information about Proxmox repositories in two
> * add tests
>
> src/repositories/check.rs | 78 ++++++++++++++++++++++-
> src/repositories/mod.rs | 16 ++++-
> src/types.rs | 30 +++++++++
> tests/repositories.rs | 60 ++++++++++++++++-
> tests/sources.list.d.expected/bad.sources | 20 ++++++
> tests/sources.list.d/bad.sources | 19 ++++++
> 6 files changed, 219 insertions(+), 4 deletions(-)
> create mode 100644 tests/sources.list.d.expected/bad.sources
> create mode 100644 tests/sources.list.d/bad.sources
>
> diff --git a/src/repositories/check.rs b/src/repositories/check.rs
> index d0656cd..7726ff3 100644
> --- a/src/repositories/check.rs
> +++ b/src/repositories/check.rs
> @@ -1,6 +1,23 @@
> use anyhow::{bail, Error};
>
> -use crate::types::{APTRepository, APTRepositoryFileType};
> +use crate::types::{
> + APTRepository, APTRepositoryFileType, APTRepositoryPackageType, APTRepositoryWarning,
> +};
> +
> +/// Checks if `suite` is some variant of `base_suite`, e.g. `buster-backports`
> +/// is a variant of `buster`.
> +#[allow(clippy::useless_format)]
> +fn suite_is_variant(suite: &str, base_suite: &str) -> bool {
> + let variants = vec![
> + format!("{}", base_suite),
> + format!("{}-backports", base_suite),
> + format!("{}-backports-sloppy", base_suite),
> + format!("{}-updates", base_suite),
> + format!("{}/updates", base_suite),
> + ];
> +
> + variants.iter().any(|variant| *variant == suite)
Shouldn't `.strip_prefix()` get this job done as well? ;-)
matches!(
suite.strip_prefix(base_suite),
Some("")
| Some("-backports")
| Some("-backports-sloppy")
| Some("-updates")
| Some("/updates")
)
> +}
>
> impl APTRepository {
> /// Makes sure that all basic properties of a repository are present and
next prev parent reply other threads:[~2021-03-10 15:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-26 15:09 [pbs-devel] [PATCH/RFC-SERIES v2] APT repositories API/UI Fabian Ebner
2021-02-26 15:09 ` [pbs-devel] [PATCH v2 proxmox-apt 01/10] initial commit Fabian Ebner
2021-03-10 15:14 ` Wolfgang Bumiller
2021-02-26 15:09 ` [pbs-devel] [PATCH v2 proxmox-apt 02/10] add files for Debian packaging Fabian Ebner
2021-02-26 15:09 ` [pbs-devel] [PATCH v2 proxmox-apt 03/10] add functions to check for Proxmox repositories Fabian Ebner
2021-02-26 15:09 ` [pbs-devel] [PATCH v2 proxmox-apt 04/10] add check_repositories function Fabian Ebner
2021-03-10 15:17 ` Wolfgang Bumiller [this message]
2021-02-26 15:09 ` [pbs-devel] [PATCH v2 proxmox-backup 05/10] cargo: depend on new proxmox-apt crate Fabian Ebner
2021-02-26 15:09 ` [pbs-devel] [PATCH v2 proxmox-backup 06/10] api: apt: add repositories call Fabian Ebner
2021-02-26 15:09 ` [pbs-devel] [PATCH v2 widget-toolkit 07/10] add UI for APT repositories Fabian Ebner
2021-02-26 15:09 ` [pbs-devel] [PATCH v2 proxmox-backup 08/10] ui: add grid " Fabian Ebner
2021-02-26 15:09 ` [pbs-devel] [RFC v2 proxmox-backup 09/10] api: apt: add check_repositories_call Fabian Ebner
2021-02-26 15:09 ` [pbs-devel] [RFC v2 widget-toolkit 10/10] APT: show warnings for repositories Fabian 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=20210310151743.uyqeb7yp5ataz7hj@wobu-vie.proxmox.com \
--to=w.bumiller@proxmox.com \
--cc=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