Update spec deps (ps, diff) and fix python api date bug

Resolves: RHEL-29708
Resolves: RHEL-17081
This commit is contained in:
Nathan Scott 2024-08-08 10:00:06 +10:00
parent 158fee1733
commit 65463ae846
2 changed files with 47 additions and 4 deletions

View File

@ -1,6 +1,6 @@
Name: pcp
Version: 5.3.7
Release: 20%{?dist}
Release: 21%{?dist}
Summary: System-level performance monitoring and performance management
License: GPLv2+ and LGPLv2+ and CC-BY
URL: https://pcp.io
@ -28,6 +28,7 @@ Patch17: redhat-build-jsonsl.patch
Patch18: redhat-issues-RHEL-7507-pmdaopenmetrics-quoting.patch
Patch19: redhat-issues-RHEL-7501-pmlogger_farm-selinux-policy.patch
Patch20: redhat-issues-RHEL-30715-pmproxy-resp-proxy-disabled.patch
Patch21: redhat-issues-RHEL-29708-python-day-of-year-range.patch
# The additional linker flags break out-of-tree PMDAs.
# https://bugzilla.redhat.com/show_bug.cgi?id=2043092
@ -39,11 +40,13 @@ Patch20: redhat-issues-RHEL-30715-pmproxy-resp-proxy-disabled.patch
%global __python2 python
%endif
# UsrMerge was completed in EL 7, however the latest 'hostname' package in EL 7 contains "Provides: /bin/hostname"
# UsrMerge was completed in EL 7, however the latest 'hostname' package in EL 7 contains "Provides: /bin/hostname". Likewise for /bin/ps from procps[-ng] packages.
%if 0%{?rhel} >= 8 || 0%{?fedora} >= 17
%global _hostname_executable /usr/bin/hostname
%global _ps_executable /usr/bin/ps
%else
%global _hostname_executable /bin/hostname
%global _ps_executable /bin/ps
%endif
%global disable_perl 0
@ -294,7 +297,8 @@ BuildRequires: perl-devel perl(strict)
BuildRequires: perl(ExtUtils::MakeMaker) perl(LWP::UserAgent) perl(JSON)
BuildRequires: perl(Time::HiRes) perl(Digest::MD5)
BuildRequires: perl(XML::LibXML) perl(File::Slurp)
BuildRequires: man %{_hostname_executable}
BuildRequires: %{_hostname_executable}
BuildRequires: %{_ps_executable}
%if !%{disable_systemd}
BuildRequires: systemd-devel systemd-rpm-macros
%endif
@ -308,7 +312,8 @@ BuildRequires: qt5-qtsvg-devel
%endif
%endif
Requires: bash xz gawk sed grep findutils which %{_hostname_executable}
Requires: bash xz gawk sed grep coreutils diffutils findutils
Requires: which %{_hostname_executable} %{_ps_executable}
Requires: pcp-libs = %{version}-%{release}
%if !%{disable_selinux}
@ -3366,6 +3371,10 @@ fi
%files zeroconf -f pcp-zeroconf-files.rpm
%changelog
* Thu Aug 08 2024 Nathan Scott <nathans@redhat.com> - 5.3.7-21
- Fix python API day-of-year out of range bug (RHEL-29708)
- Added spec deps on ps and diffutils for diff (RHEL-17081)
* Wed Apr 17 2024 Nathan Scott <nathans@redhat.com> - 5.3.7-20
- Disable RESP proxying by default in pmproxy (RHEL-30715)

View File

@ -0,0 +1,34 @@
commit ce6112399ebf0ff39069a34bc9286242c875555e
Author: adam kaminski <adam@adamkaminski.com>
Date: Fri Feb 9 12:49:34 2024 -0500
pmapi.py : fix for struct_time() and day of year out of range on yyyy-01-01
Fix for `day of year out of range` on 2024-01-01, due to self.tm_yday - 1, which returns `[2024, 1, 1, 2, 3, 0, 0, -1, 0]`. The range for tm_yday should be [1, 366].
# timedatectl set-ntp false
# timedatectl set-time "2024-01-01 00:00:00"
# /usr/libexec/pcp/bin/pcp-mpstat -P ALL -t 1 -s 2
Traceback (most recent call last):
File "/usr/libexec/pcp/bin/pcp-mpstat", line 653, in <module>
sts = manager.run()
File "/usr/lib64/python3.6/site-packages/pcp/pmcc.py", line 687, in run
self._printer.report(self)
File "/usr/libexec/pcp/bin/pcp-mpstat", line 606, in report
self.print_machine_info(group, manager)
File "/usr/libexec/pcp/bin/pcp-mpstat", line 585, in print_machine_info
time_string = time.strftime("%x", timestamp.struct_time())
ValueError: day of year out of range
diff -Naurp pcp-5.3.7.orig/src/python/pcp/pmapi.py pcp-5.3.7/src/python/pcp/pmapi.py
--- pcp-5.3.7.orig/src/python/pcp/pmapi.py 2022-04-05 09:05:43.000000000 +1000
+++ pcp-5.3.7/src/python/pcp/pmapi.py 2024-08-08 09:56:16.298625548 +1000
@@ -299,7 +299,7 @@ class tm(Structure):
pywday = 6
stlist = [self.tm_year + 1900, self.tm_mon + 1, self.tm_mday,
self.tm_hour, self.tm_min, self.tm_sec,
- pywday, self.tm_yday - 1, self.tm_isdst]
+ pywday, self.tm_yday + 1, self.tm_isdst]
return time.struct_time(stlist)
def __str__(self):