From e54680870573d0e179c829588470580ec7efc368 Mon Sep 17 00:00:00 2001 From: Brian Read Date: Fri, 26 Sep 2025 06:59:57 +0100 Subject: [PATCH] * Fri Sep 26 2025 Brian Read 11.1-11.sme - Fix version number extraction fro supplied string [SME: 13121] --- root/usr/bin/mailstats.py | 14 +++++++++++--- smeserver-mailstats.spec | 5 ++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/root/usr/bin/mailstats.py b/root/usr/bin/mailstats.py index 0eeee5d..01add67 100644 --- a/root/usr/bin/mailstats.py +++ b/root/usr/bin/mailstats.py @@ -93,6 +93,14 @@ import json from systemd import journal import logging +def extract_version(text): + # Regular expression to match version numbers with the format X.Y.Z (e.g., 11.1.10) + match = re.search(r'\b\d+\.\d+\.\d+\b', text) + if match: + return match.group(0) + return None + + # Configure logging log_dir_path = "/var/log/mailstats" # Check if the directory exists, and create it if it doesn't @@ -111,11 +119,11 @@ except ImportError: logging.warning("Matplotlib is not installed - no graphs") enable_graphs = False; -Mailstats_version = '1.3' -build_date_time = "2024-06-18 12:03:40OURCE" +Mailstats_version = '11.1.10.el8.sme)' +build_date_time = "2025-09-13 10:10:12OURCE" #Take out the crap that sneaks in... build_date_time = build_date_time[:19] -Mailstats_version = Mailstats_version[:6] +Mailstats_version = extract_version(Mailstats_version) #if build_date_time == "2024-06-18 12:03:40OURCE": # build_date_time = "Unknown" diff --git a/smeserver-mailstats.spec b/smeserver-mailstats.spec index 6852970..7de9064 100644 --- a/smeserver-mailstats.spec +++ b/smeserver-mailstats.spec @@ -6,7 +6,7 @@ Summary: Daily mail statistics for SME Server %define name smeserver-mailstats Name: %{name} %define version 11.1 -%define release 10 +%define release 11 %define full_version %{version}.%{release}) Version: %{version} Release: %{release}%{?dist} @@ -88,6 +88,9 @@ chmod u+s /usr/bin/journalwrap /sbin/ldconfig %changelog +* Fri Sep 26 2025 Brian Read 11.1-11.sme +- Fix version number extraction fro supplied string [SME: 13121] + * Fri Sep 12 2025 Brian Read 11.1-10.sme - Fix version and build date from spec file [SME: 13121]