From 248bbed2408161ad112aa5e9081bd8ffc709d717 Mon Sep 17 00:00:00 2001 From: Brian Read Date: Fri, 12 Sep 2025 18:20:15 +0100 Subject: [PATCH] * Fri Sep 12 2025 Brian Read 11.1-9.sme - Fix version and build date from spec file [SME: 13121] --- root/usr/bin/mailstats.py | 4 +++- smeserver-mailstats.spec | 20 +++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/root/usr/bin/mailstats.py b/root/usr/bin/mailstats.py index 50ba8ee..0eeee5d 100644 --- a/root/usr/bin/mailstats.py +++ b/root/usr/bin/mailstats.py @@ -113,7 +113,9 @@ except ImportError: Mailstats_version = '1.3' build_date_time = "2024-06-18 12:03:40OURCE" -build_date_time = build_date_time[:19] #Take out crap that sneaks in. +#Take out the crap that sneaks in... +build_date_time = build_date_time[:19] +Mailstats_version = Mailstats_version[:6] #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 657c333..6afea81 100644 --- a/smeserver-mailstats.spec +++ b/smeserver-mailstats.spec @@ -6,7 +6,8 @@ Summary: Daily mail statistics for SME Server %define name smeserver-mailstats Name: %{name} %define version 11.1 -%define release 8 +%define release 9 +%define full_version %{version}.%{release}) Version: %{version} Release: %{release}%{?dist} License: GPL @@ -49,21 +50,15 @@ perl createlinks (cd root ; /usr/bin/find . -depth -print | /bin/cpio -dump $RPM_BUILD_ROOT) chmod +x $RPM_BUILD_ROOT/usr/bin/runmailstats.sh -#chmod 0640 $RPM_BUILD_ROOT/etc/mailstats/db.php -#ls -l /builddir/build/BUILDROOT/smeserver-mailstats-11.1-5.el8.sme.x86_64/etc/mailstats/ -#chown root:102 $RPM_BUILD_ROOT/etc/mailstats/db.php - -# Define the placeholder and generate the current date and time now=$(date +"%Y-%m-%d %H:%M:%S") - -# Replace the placeholder in the Python program located at %{BUILDROOT}/usr/bin -sed -i "s|__BUILD_DATE_TIME__|$now|" $RPM_BUILD_ROOT/usr/bin/mailstats.py +# Replace placeholders in the Python program using sed +perl -pi -e 'if (!$done && s/^Mailstats_version *=.*/Mailstats_version = '\''%{full_version}'\'/') { $done = 1 }' $RPM_BUILD_ROOT/usr/bin/mailstats.py +perl -pi -e 'if (!$done && s/^build_date_time *=.*/build_date_time = "'"$now"'"/) { $done = 1 }' $RPM_BUILD_ROOT/usr/bin/mailstats.py /bin/rm -f %{name}-%{version}-filelist /sbin/e-smith/genfilelist --file '/etc/mailstats/db.php' 'attr(0640, root, apache)' $RPM_BUILD_ROOT | grep -v "\.pyc" | grep -v "\.pyo" > %{name}-%{version}-filelist install -Dpm 0755 journalwrap %{buildroot}%{_bindir}/journalwrap -#install -Dpm 0644 libjournalwrap.so %{buildroot}%{_libdir}/libjournalwrap.so %pre @@ -93,6 +88,9 @@ chmod u+s /usr/bin/journalwrap /sbin/ldconfig %changelog +* Fri Sep 12 2025 Brian Read 11.1-9.sme +- Fix version and build date from spec file [SME: 13121] + * Fri Sep 12 2025 Brian Read 11.1-8.sme - Remove www from systemd-journal group and setuid bit in journal wrapper [SME: 13121] @@ -197,4 +195,4 @@ chmod u+s /usr/bin/journalwrap - Add Update event to createlinks Unexpected failure string in log file: auth::auth_cvm_unix_local see [SME 7089] * Sat May 26 2012 Brian J read 1.0-1.sme -- Initial version +- Initial version \ No newline at end of file