From e6c3f703299f2ff0cd14ad1d214c3037721dcbd2437a9a014f67aedc4fff16a9 Mon Sep 17 00:00:00 2001
From: Martin Schreiner <martin.schreiner@suse.com>
Date: Wed, 17 Apr 2024 09:31:12 +0000
Subject: [PATCH] Accepting request 1167788 from home:dirkmueller:Factory

- move pmlogger_daily into main package (bsc#1222815)
- fix compile flags conflusion

- Replace references to /var/adm/fillup-templates with new
- filter out -fomit-frame-pointer to fix build
- fix build with GCC44, #ident is a deprecated GCC extension
- fix build failure in obs
  (package could possibly be updated anyway)
- don't build as root
  (deprecated calling syntax for head,tail,sort)
- make it compile with latest glibc (pcp-2.2.2-st_mtime.patch)
- use yacc instead of bison for now (make it compile)
- fix bug #13321: made init script pmie LSB compliant
- move rcscript to etc/init.d

OBS-URL: https://build.opensuse.org/request/show/1167788
OBS-URL: https://build.opensuse.org/package/show/Base:System/pcp?expand=0&rev=135
---
 pcp.changes | 30 +++++++++-------
 pcp.spec    | 98 ++++++++++++++++++++++++++++++++++++++---------------
 2 files changed, 88 insertions(+), 40 deletions(-)

diff --git a/pcp.changes b/pcp.changes
index b226eba..0397907 100644
--- a/pcp.changes
+++ b/pcp.changes
@@ -1,3 +1,9 @@
+-------------------------------------------------------------------
+Mon Apr 15 10:51:06 UTC 2024 - Dirk Müller <dmueller@suse.com>
+
+- move pmlogger_daily into main package (bsc#1222815)
+- fix compile flags conflusion
+
 -------------------------------------------------------------------
 Wed Apr  3 14:49:06 UTC 2024 - Martin Schreiner <martin.schreiner@suse.com>
 
@@ -973,7 +979,7 @@ Fri Sep  7 10:39:49 UTC 2018 - kkaempf@suse.com
   sysmacros.patch
   0003-pcp-legacy-init-lsb.patch
   0007-Honor-CFLAGS-in-qmake.patch
-  
+
 - new
   0002-Remove-CPAN-rpaths.patch
   0003-pcp-legacy-init-lsb.patch
@@ -989,7 +995,7 @@ Mon Aug  6 09:30:46 UTC 2018 - schwab@suse.de
 -------------------------------------------------------------------
 Thu Nov 23 13:41:01 UTC 2017 - rbrown@suse.com
 
-- Replace references to /var/adm/fillup-templates with new 
+- Replace references to /var/adm/fillup-templates with new
   %_fillupdir macro (boo#1069468)
 
 -------------------------------------------------------------------
@@ -2022,7 +2028,7 @@ Thu Feb 11 00:44:51 UTC 2010 - jengelh@medozas.de
 -------------------------------------------------------------------
 Wed Jun 10 10:55:48 CEST 2009 - coolo@novell.com
 
-- filter out -fomit-frame-pointer to fix build 
+- filter out -fomit-frame-pointer to fix build
 
 -------------------------------------------------------------------
 Tue Jun  9 17:10:20 CEST 2009 - coolo@novell.com
@@ -2032,12 +2038,12 @@ Tue Jun  9 17:10:20 CEST 2009 - coolo@novell.com
 -------------------------------------------------------------------
 Wed Feb 25 20:21:59 CET 2009 - crrodriguez@suse.de
 
-- fix build with GCC44, #ident is a deprecated GCC extension 
+- fix build with GCC44, #ident is a deprecated GCC extension
 
 -------------------------------------------------------------------
 Thu Nov  6 17:23:58 CET 2008 - ro@suse.de
 
-- fix build failure in obs 
+- fix build failure in obs
 
 -------------------------------------------------------------------
 Tue Oct  7 16:42:23 CEST 2008 - kukuk@suse.de
@@ -2053,7 +2059,7 @@ Thu Aug 28 23:28:57 CEST 2008 - cthiel@suse.de
 Wed Dec  5 02:33:52 CET 2007 - ro@suse.de
 
 - fix build with gcc-4.3
-  (package could possibly be updated anyway) 
+  (package could possibly be updated anyway)
 
 -------------------------------------------------------------------
 Thu Jul 12 16:28:26 CEST 2007 - rw@suse.de
@@ -2120,7 +2126,7 @@ Tue Mar 16 07:19:24 CET 2004 - nashif@suse.de
 Wed Nov  5 17:08:13 CET 2003 - ro@suse.de
 
 - package according to permissions.secure and add run_permissions
-- don't build as root 
+- don't build as root
 
 -------------------------------------------------------------------
 Mon Jul 21 15:43:49 CEST 2003 - nashif@suse.de
@@ -2137,18 +2143,18 @@ Thu Jun 19 07:10:26 CEST 2003 - nashif@suse.de
 Fri Apr 11 00:52:01 CEST 2003 - ro@suse.de
 
 - fix build with coreutils
-  (deprecated calling syntax for head,tail,sort) 
+  (deprecated calling syntax for head,tail,sort)
 
 -------------------------------------------------------------------
 Mon Jan 20 15:16:34 CET 2003 - ro@suse.de
 
-- make it compile with latest glibc (pcp-2.2.2-st_mtime.patch) 
+- make it compile with latest glibc (pcp-2.2.2-st_mtime.patch)
 
 -------------------------------------------------------------------
 Mon Dec  2 18:15:37 CET 2002 - ro@suse.de
 
 - include errno.h where needed
-- use yacc instead of bison for now (make it compile) 
+- use yacc instead of bison for now (make it compile)
 
 -------------------------------------------------------------------
 Fri Aug 16 18:18:55 CEST 2002 - nashif@suse.de
@@ -2163,7 +2169,7 @@ Thu Apr 25 11:40:56 CEST 2002 - coolo@suse.de
 -------------------------------------------------------------------
 Fri Feb 15 18:31:58 CET 2002 - nashif@suse.de
 
-- fix bug #13321: made init script pmie LSB compliant 
+- fix bug #13321: made init script pmie LSB compliant
 	- Added header note
 	- Status returns correct value
 - Fixed pcp init script: status did not work
@@ -2221,7 +2227,7 @@ Thu Nov 30 15:29:22 MET 2000 - nashif@suse.de
 -------------------------------------------------------------------
 Wed Nov 29 18:15:47 CET 2000 - ro@suse.de
 
-- move rcscript to etc/init.d 
+- move rcscript to etc/init.d
 
 -------------------------------------------------------------------
 Sun Nov 26 18:29:28 MET 2000 - nashif@suse.de
diff --git a/pcp.spec b/pcp.spec
index cba9210..c2bbf9e 100644
--- a/pcp.spec
+++ b/pcp.spec
@@ -559,6 +559,7 @@ applications to easily retrieve and process any subset of that data.
 
 
 
+
 #
 # pcp-conf
 #
@@ -581,6 +582,7 @@ Performance Co-Pilot (PCP) run-time configuration
 
 
 
+
 #
 # pcp-libs
 #
@@ -671,6 +673,7 @@ Performance Co-Pilot (PCP) headers for development.
 
 
 
+
 #
 # pcp-devel
 #
@@ -694,6 +697,7 @@ Performance Co-Pilot (PCP) documentation and tools for development.
 
 
 
+
 #
 # pcp-testsuite
 #
@@ -722,6 +726,7 @@ Quality assurance test suite for Performance Co-Pilot (PCP).
 
 
 
+
 #
 # perl-PCP-PMDA. This is the PCP agent perl binding.
 #
@@ -747,6 +752,7 @@ an application, etc.
 
 
 
+
 #
 # perl-PCP-MMV
 #
@@ -774,6 +780,7 @@ and analysis with pmchart, pmie, pmlogger and other PCP tools.
 
 
 
+
 #
 # perl-PCP-LogImport
 #
@@ -798,6 +805,7 @@ they can be replayed with standard PCP monitoring tools.
 
 
 
+
 #
 # perl-PCP-LogSummary
 #
@@ -825,6 +833,7 @@ exporting this data into third-party tools (e.g. spreadsheets).
 
 
 
+
 #
 # pcp-import-sar2pcp
 #
@@ -852,6 +861,7 @@ into standard PCP archive logs for replay with any PCP monitoring tool.
 
 
 
+
 #
 # pcp-import-iostat2pcp
 #
@@ -920,6 +930,7 @@ into standard PCP archive logs for replay with any PCP monitoring tool.
 
 
 
+
 #
 # pcp-import-ganglia2pcp
 #
@@ -946,6 +957,7 @@ into standard PCP archive logs for replay with any PCP monitoring tool.
 
 
 
+
 #
 # pcp-import-collectl2pcp
 #
@@ -1011,6 +1023,7 @@ See https://www.elastic.co/community for further details.
 
 
 
+
 #
 # pcp-export-pcp2graphite
 #
@@ -1037,6 +1050,7 @@ to graphite (http://graphite.readthedocs.org).
 
 
 
+
 # pcp-export-pcp2influxdb
 #
 %package export-pcp2influxdb
@@ -1064,6 +1078,7 @@ to InfluxDB (https://influxdata.com/time-series-platform/influxdb).
 
 
 
+
 #
 # pcp-export-pcp2json
 #
@@ -1088,6 +1103,7 @@ in JSON format.
 
 
 
+
 #
 # pcp-export-pcp2spark
 #
@@ -1150,6 +1166,7 @@ in XML format.
 
 
 
+
 #
 # pcp-export-pcp2zabbix
 #
@@ -1260,6 +1277,7 @@ collecting metrics about the ActiveMQ message broker.
 
 
 
+
 #end pcp-pmda-activemq
 #
 # pcp-pmda-bind2
@@ -1284,6 +1302,7 @@ collecting metrics from BIND (Berkeley Internet Name Domain).
 
 
 
+
 #end pcp-pmda-bind2
 #
 # pcp-pmda-redis
@@ -1348,6 +1367,7 @@ collecting metrics about bonded network interfaces.
 
 
 
+
 #end pcp-pmda-bonding
 #
 # pcp-pmda-dbping
@@ -1373,6 +1393,7 @@ collecting metrics about the Database response times and Availablility.
 
 
 
+
 #end pcp-pmda-dbping
 #
 # pcp-pmda-ds389
@@ -1401,6 +1422,7 @@ collecting metrics about a 389 Directory Server.
 
 
 
+
 #end pcp-pmda-ds389
 #
 # pcp-pmda-ds389log
@@ -1425,6 +1447,7 @@ collecting metrics from a 389 Directory Server log.
 
 
 
+
 #end pcp-pmda-ds389log
 #
 # pcp-pmda-gpfs
@@ -1448,6 +1471,7 @@ collecting metrics about the GPFS filesystem.
 
 
 
+
 #end pcp-pmda-gpfs
 #
 # pcp-pmda-gpsd
@@ -1472,6 +1496,7 @@ collecting metrics about a GPS Daemon.
 
 
 
+
 #end pcp-pmda-gpsd
 #
 # pcp-pmda-docker
@@ -1491,6 +1516,7 @@ collecting metrics using the Docker daemon REST API.
 
 
 
+
 #end pcp-pmda-docker
 #
 # pcp-pmda-lustre
@@ -1515,6 +1541,7 @@ collecting metrics about the Lustre Filesystem.
 
 
 
+
 #end pcp-pmda-lustre
 #
 # pcp-pmda-lustrecomm
@@ -1540,6 +1567,7 @@ collecting metrics about the Lustre Filesystem Comms.
 
 
 
+
 #end pcp-pmda-lustrecomm
 #
 # pcp-pmda-memcache
@@ -1565,6 +1593,7 @@ collecting metrics about Memcached.
 
 
 
+
 #end pcp-pmda-memcache
 #
 # pcp-pmda-mysql
@@ -1594,6 +1623,7 @@ collecting metrics about the MySQL database.
 
 
 
+
 #end pcp-pmda-mysql
 #
 # pcp-pmda-named
@@ -1619,6 +1649,7 @@ collecting metrics about the Named nameserver.
 
 
 
+
 #end pcp-pmda-named
 # pcp-pmda-netfilter
 #
@@ -1643,6 +1674,7 @@ collecting metrics about the Netfilter packet filtering framework.
 
 
 
+
 #end pcp-pmda-netfilter
 #
 # pcp-pmda-news
@@ -1668,6 +1700,7 @@ collecting metrics about Usenet News.
 
 
 
+
 #end pcp-pmda-news
 #
 # pcp-pmda-nginx
@@ -1694,6 +1727,7 @@ collecting metrics about the Nginx Webserver.
 
 
 
+
 #end pcp-pmda-nginx
 #
 # pcp-pmda-oracle
@@ -1720,6 +1754,7 @@ collecting metrics about the Oracle database.
 
 
 
+
 #end pcp-pmda-oracle
 #
 # pcp-pmda-pdns
@@ -1745,6 +1780,7 @@ collecting metrics about the PowerDNS.
 
 
 
+
 #end pcp-pmda-pdns
 #
 # pcp-pmda-postfix
@@ -1787,6 +1823,7 @@ collecting metrics about the Postfix (MTA).
 
 
 
+
 #end pcp-pmda-postfix
 #
 # pcp-pmda-rsyslog
@@ -1817,6 +1854,7 @@ collecting metrics about Rsyslog.
 
 
 
+
 #end pcp-pmda-rsyslog
 #
 # pcp-pmda-samba
@@ -1842,6 +1880,7 @@ collecting metrics about Samba.
 
 
 
+
 #end pcp-pmda-samba
 #
 # pcp-pmda-slurm
@@ -1907,6 +1946,7 @@ collecting metrics for VMware.
 
 
 
+
 #end pcp-pmda-vmware
 #
 # pcp-pmda-zimbra
@@ -1929,6 +1969,7 @@ collecting metrics about Zimbra.
 
 
 
+
 #end pcp-pmda-zimbra
 #
 # pcp-pmda-dm
@@ -1971,6 +2012,7 @@ collecting metrics about the gluster filesystem.
 
 
 
+
 # end pcp-pmda-gluster
 #
 # pcp-pmda-nfsclient
@@ -2032,6 +2074,7 @@ collecting metrics about compressed swap.
 
 
 
+
 # end pcp-pmda-zswap
 #
 # pcp-pmda-unbound
@@ -2056,6 +2099,7 @@ collecting metrics about the Unbound DNS Resolver.
 
 
 
+
 # end pcp-pmda-unbound
 #
 # pcp-pmda-mic
@@ -2080,6 +2124,7 @@ collecting metrics about Intel MIC cards.
 
 
 
+
 # end pcp-pmda-mic
 #
 # pcp-pmda-haproxy
@@ -2149,6 +2194,7 @@ collecting metrics about Elasticsearch.
 
 
 
+
 #end pcp-pmda-elasticsearch
 #
 # pcp-pmda-openvswitch
@@ -2173,6 +2219,7 @@ collecting metrics from Open vSwitch.
 
 
 
+
 #end pcp-pmda-openvswitch
 #
 # pcp-pmda-rabbitmq
@@ -2249,6 +2296,7 @@ extracting metrics from OpenMetrics (https://openmetrics.io/) endpoints.
 
 
 
+
 #end pcp-pmda-openmetrics
 #
 # pcp-pmda-lmsensors
@@ -2276,6 +2324,7 @@ collecting metrics about the Linux hardware monitoring sensors.
 
 
 
+
 # end pcp-pmda-lmsensors
 #
 # pcp-pmda-netcheck
@@ -2388,6 +2437,7 @@ collecting metrics about the Apache webserver.
 
 
 
+
 # end pcp-pmda-apache
 #
 # pcp-pmda-bash
@@ -2412,6 +2462,7 @@ collecting metrics about the Bash shell.
 
 
 
+
 # end pcp-pmda-bash
 #
 # pcp-pmda-cifs
@@ -2435,6 +2486,7 @@ collecting metrics about the Common Internet Filesytem.
 
 
 
+
 # end pcp-pmda-cifs
 #
 # pcp-pmda-cisco
@@ -2459,6 +2511,7 @@ collecting metrics about Cisco routers.
 
 
 
+
 # end pcp-pmda-cisco
 #
 # pcp-pmda-gfs2
@@ -2482,6 +2535,7 @@ collecting metrics about the Global Filesystem v2.
 
 
 
+
 # end pcp-pmda-gfs2
 #
 # pcp-pmda-logger
@@ -2507,6 +2561,7 @@ supports both sampled and event-style metrics.
 
 
 
+
 # end pcp-pmda-logger
 #
 # pcp-pmda-mailq
@@ -2531,6 +2586,7 @@ collecting metrics about email queues managed by sendmail.
 
 
 
+
 # end pcp-pmda-mailq
 #
 # pcp-pmda-mounts
@@ -2555,6 +2611,7 @@ collecting metrics about filesystem mounts.
 
 
 
+
 # end pcp-pmda-mounts
 #
 # pcp-pmda-nvidia-gpu
@@ -2578,6 +2635,7 @@ collecting metrics about Nvidia GPUs.
 
 
 
+
 # end pcp-pmda-nvidia-gpu
 #
 # pcp-pmda-roomtemp
@@ -2642,6 +2700,7 @@ collecting metrics about Sendmail traffic.
 
 
 
+
 # end pcp-pmda-sendmail
 #
 # pcp-pmda-shping
@@ -2667,6 +2726,7 @@ arbitrary shell commands.
 
 
 
+
 # end pcp-pmda-shping
 #
 # pcp-pmda-smart
@@ -2689,6 +2749,7 @@ smartmontools package.
 
 
 
+
 #end pcp-pmda-smart
 #
 # pcp-pmda-sockets
@@ -2711,6 +2772,7 @@ collecting per-socket statistics, making use of utilities such as 'ss'.
 
 
 
+
 #end pcp-pmda-sockets
 #
 # pcp-pmda-hacluster
@@ -2732,6 +2794,7 @@ collecting metrics about linux High Availability (HA) Clusters.
 
 
 
+
 # end pcp-pmda-hacluster
 #
 # pcp-pmda-summary
@@ -2794,6 +2857,7 @@ collecting metrics about trace performance data in applications.
 
 
 
+
 # end pcp-pmda-trace
 #
 # pcp-pmda-weblog
@@ -2819,6 +2883,7 @@ collecting metrics about web server logs.
 
 
 
+
 # end pcp-pmda-weblog
 # end C pmdas
 
@@ -2976,7 +3041,7 @@ export PACKAGE_DISTRIBUTION="suse"
 %endif
 # tmpdir used during build https://github.com/performancecopilot/pcp/issues/1140
 export PACKAGE_BUILD_DATE=`date -u -r CHANGELOG +%Y-%m-%d`
-PCP_CFLAGS="%{optflags}" CFLAGS="%{optflags}" CCFLAGS="%{optflags}" CXXFLAGS="%{optflags}" %configure \
+PCP_CFLAGS="%{optflags}" CFLAGS="%{optflags} -std=c99" CCFLAGS="%{optflags}" CXXFLAGS="%{optflags}" %configure \
    --with-tmpdir=%{_tempsdir} \
    --datarootdir=%{_datadir} \
    --docdir=%{_docdir} \
@@ -2994,7 +3059,7 @@ PCP_CFLAGS="%{optflags}" CFLAGS="%{optflags}" CCFLAGS="%{optflags}" CXXFLAGS="%{
    %{?_with_snmp} \
    %{?_with_nutcracker} \
    %{?_with_python2}
-PCP_CFLAGS="%{optflags}" CFLAGS="%{optflags} -std=c99" CCFLAGS="%{optflags}" CXXFLAGS="%{optflags}" make default_pcp
+%make_jobs default_pcp
 
 ###############################################################################
 
@@ -3189,7 +3254,6 @@ ls -1 %{buildroot}/%{_libexecdir}/pcp/bin |\
   grep -E -v 'atop|dmcache|dstat|free|iostat|ipcs|lvmcache|mpstat' |\
   grep -E -v 'numastat|shping|tapestat|uptime|verify|selinux-setup' |\
 %endif
-  grep -E -v 'pmlogger_daily' |\
   grep -E -v 'pmsnap' |\
   sed -e 's#^#'%{_libexecdir}/pcp/bin'\/#' >base_exec.list
 echo %{_libexecdir}/pcp/lib >>base_exec.list
@@ -3266,12 +3330,6 @@ test -d %{_testsdir} || mkdir -p -m 755 %{_testsdir}
 getent group pcpqa >/dev/null || groupadd -r pcpqa
 getent passwd pcpqa >/dev/null || \
   useradd -c "PCP Quality Assurance" -g pcpqa -d %{_testsdir} -M -r -s /bin/bash pcpqa 2>/dev/null
-exit 0
-
-%if 0%{?suse_version} && !%{disable_systemd}
-%pre zeroconf
-%service_add_pre pmlogger_daily.timer
-%endif
 
 %pre
 %if 0%{?suse_version} && !%{disable_systemd}
@@ -3280,12 +3338,6 @@ exit 0
 getent group pcp >/dev/null || groupadd -r pcp
 getent passwd pcp >/dev/null || \
   useradd -c "Performance Co-Pilot" -g pcp -d %{_localstatedir}/lib/pcp -M -r -s /sbin/nologin pcp
-exit 0
-
-%if 0%{?suse_version} && !%{disable_systemd}
-%preun zeroconf
-%service_del_preun pmlogger_daily.timer
-%endif
 
 %preun
 %if 0%{?suse_version}
@@ -3321,9 +3373,6 @@ fi
 
 %post zeroconf
 %if 0%{?suse_version}
-%if !%{disable_systemd}
-%service_add_post pmlogger_daily.timer
-%endif
 %else
 %if !%{disable_systemd}
     systemctl restart pmcd >/dev/null 2>&1
@@ -3426,11 +3475,6 @@ PCP_LOG_DIR=%{_logsdir}
 %{selinux_handle_policy "$1" "pcpupstream-container"}
 %endif
 
-%if 0%{?suse_version} && !%{disable_systemd}
-%postun zeroconf
-%service_del_postun pmlogger_daily.timer
-%endif
-
 %if 0%{?suse_version}
 %postun
 /sbin/ldconfig
@@ -3656,9 +3700,12 @@ PCP_LOG_DIR=%{_logsdir}
 %endif
 %if %{disable_systemd}
 %config(noreplace) %{_sysconfdir}/cron.d/pcp-pmlogger
+%config(noreplace) %{_sysconfdir}/cron.d/pcp-pmlogger-daily-report
 %config(noreplace) %{_sysconfdir}/cron.d/pcp-pmfind
 %config(noreplace) %{_sysconfdir}/cron.d/pcp-pmie
 %else
+%{_unitdir}/pmlogger_daily.service
+%{_unitdir}/pmlogger_daily.timer
 %{_unitdir}/pmlogger_check.service
 %{_unitdir}/pmlogger_check.timer
 %{_unitdir}/pmie_check.service
@@ -3737,13 +3784,8 @@ PCP_LOG_DIR=%{_logsdir}
 %endif
 
 %files zeroconf
-%{_libexecdir}/pcp/bin/pmlogger_daily
 %if !%{disable_systemd}
-# systemd services for pmlogger_daily to replace the cron script
-%{_unitdir}/pmlogger_daily.service
-%{_unitdir}/pmlogger_daily.timer
 %else
-%config(noreplace) %{_sysconfdir}/cron.d/pcp-pmlogger-daily-report
 %endif
 %config(noreplace) %{_confdir}/pmieconf/zeroconf
 %config(noreplace) %{_confdir}/pmlogconf/zeroconf