From: Lukas Wagner <l.wagner@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
Max Carrara <m.carrara@proxmox.com>
Subject: Re: [pve-devel] [PATCH v1 pve-manager 2/8] ceph: tools: update Ceph version regex
Date: Wed, 5 Jun 2024 16:48:36 +0200 [thread overview]
Message-ID: <affd9ca1-68af-4e73-a4d6-4fc62353793c@proxmox.com> (raw)
In-Reply-To: <20240430152857.659326-3-m.carrara@proxmox.com>
On 2024-04-30 17:28, Max Carrara wrote:
> Make the regex more maintainable declaring it as a variable, breaking it
> up and commenting it by using the x flag.
>
> Also remove the part that parses our Debian revision (e.g. -pve1) from
> the version, as we do not actually include that in our Ceph builds.
>
> The part of the regex that parses the build commit hash is made
> mandatory (remove '?' after its group).
>
> Signed-off-by: Max Carrara <m.carrara@proxmox.com>
> ---
> PVE/Ceph/Tools.pm | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/PVE/Ceph/Tools.pm b/PVE/Ceph/Tools.pm
> index 087c4ef3..a00d23e1 100644
> --- a/PVE/Ceph/Tools.pm
> +++ b/PVE/Ceph/Tools.pm
> @@ -68,7 +68,18 @@ sub get_local_version {
>
> return undef if !defined $ceph_version;
>
> - if ($ceph_version =~ /^ceph.*\sv?(\d+(?:\.\d+)+(?:-pve\d+)?)\s+(?:\(([a-zA-Z0-9]+)\))?/) {
> + my $re_ceph_version = qr/
> + # Skip ahead to the version, which may optionally start with 'v'
> + ^ceph.*\sv?
> +
> + # Parse the version X.Y, X.Y.Z, etc.
> + ( \d+ (?:\.\d+)+ ) \s+
> +
> + # Parse the git commit hash between parentheses
> + (?: \( ([a-zA-Z0-9]+) \) )
> + /x;
TIL about the x modifier! Neat!
--
- Lukas
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2024-06-05 14:48 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-30 15:28 [pve-devel] [PATCH v1 pve-manager 0/8] Ceph Build Commit in UI Max Carrara
2024-04-30 15:28 ` [pve-devel] [PATCH v1 pve-manager 1/8] ceph: tools: refactor installation check as guard clause Max Carrara
2024-04-30 15:28 ` [pve-devel] [PATCH v1 pve-manager 2/8] ceph: tools: update Ceph version regex Max Carrara
2024-06-05 14:48 ` Lukas Wagner [this message]
2024-04-30 15:28 ` [pve-devel] [PATCH v1 pve-manager 3/8] ceph: services: remove old cluster broadcast Max Carrara
2024-04-30 15:28 ` [pve-devel] [PATCH v1 pve-manager 4/8] ceph: services: refactor version existence check as guard clause Max Carrara
2024-04-30 15:28 ` [pve-devel] [PATCH v1 pve-manager 5/8] utils: align regex of parse_ceph_version with Perl equivalent Max Carrara
2024-04-30 15:28 ` [pve-devel] [PATCH v1 pve-manager 6/8] ui: ceph: services: parse and display build commit Max Carrara
2024-06-05 14:48 ` Lukas Wagner
2024-06-06 8:04 ` Max Carrara
2024-04-30 15:28 ` [pve-devel] [PATCH v1 pve-manager 7/8] api: ceph: add build commit of host to Ceph osd index endpoint data Max Carrara
2024-04-30 15:28 ` [pve-devel] [PATCH v1 pve-manager 8/8] ui: ceph: osd: rework rendering of version field & show build commit Max Carrara
2024-06-05 14:48 ` Lukas Wagner
2024-06-06 8:04 ` Max Carrara
2024-06-05 9:16 ` [pve-devel] [PATCH v1 pve-manager 0/8] Ceph Build Commit in UI Max Carrara
2024-06-05 14:48 ` Lukas Wagner
2024-06-06 8:06 ` Max Carrara
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=affd9ca1-68af-4e73-a4d6-4fc62353793c@proxmox.com \
--to=l.wagner@proxmox.com \
--cc=m.carrara@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