%{!?dotests: %define dotests 1} Summary: Rotates, compresses, removes and mails system log files Name: logrotate Version: 3.18.0 Release: 2 License: GPL+ Group: System Environment/Base Source0: https://github.com/%{name}/%{name}/releases/download/%{version}/%{name}-%{version}.tar.gz Patch0: %{name}-3.18.0-aix.patch Patch1: %{name}-aix-missing-asprintf.patch Patch2: %{name}-aix-missing-vasprintf.patch Patch3: %{name}-aix-queue.patch BuildRequires: popt >= 1.18 BuildRequires: sed Requires: popt >= 1.18 %description The logrotate utility is designed to simplify the administration of log files on a system which generates a lot of log files. Logrotate allows for the automatic rotation compression, removal and mailing of log files. Logrotate can be set to handle a log file daily, weekly, monthly or when the log file gets to a certain size. Normally, logrotate runs as a daily cron job. Install the logrotate package if you need a utility to deal with the log files on your system. %prep %setup -q PATH=/opt/freeware/bin:$PATH %patch0 %patch1 %patch2 %patch3 # Duplicate source for 32 & 64 bits rm -rf /tmp/%{name}-%{version}-32bit mkdir /tmp/%{name}-%{version}-32bit mv * /tmp/%{name}-%{version}-32bit mkdir 32bit mv /tmp/%{name}-%{version}-32bit/* 32bit rm -rf /tmp/%{name}-%{version}-32bit mkdir 64bit cp -rp 32bit/* 64bit/ %build export LIBPATH="/opt/freeware/lib:/usr/lib" cd 64bit export OBJECT_MODE=64 export CC="/opt/freeware/bin/gcc -maix64 -O2 -D_ALL_SOURCE -D_LINUX_SOURCE_COMPAT" export LDFLAGS="-L/opt/freeware/lib64 -L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib -lbsd" ./configure \ --prefix=%{_prefix} \ --with-state-file-path=%{_localstatedir}/lib/logrotate/logrotate.status \ --mandir=%{_mandir} gmake %{?_smp_mflags} if [ "%{dotests}" == 1 ] then (gmake -k check || true) fi cd ../32bit export OBJECT_MODE=32 export CC="/opt/freeware/bin/gcc -maix32 -O2 -D_LARGE_FILES -D_ALL_SOURCE -D_LINUX_SOURCE_COMPAT" export LDFLAGS="-L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib:/usr/lib:/lib -Wl,-bmaxdata:0x80000000 -lbsd" ./configure \ --prefix=%{_prefix} \ --with-state-file-path=%{_localstatedir}/lib/logrotate/logrotate.status \ --mandir=%{_mandir} gmake %{?_smp_mflags} if [ "%{dotests}" == 1 ] then (gmake -k check || true) fi %install export PATH=/opt/freeware/bin:$PATH rm -f .depend cd 64bit export OBJECT_MODE=64 export AR="/usr/bin/ar -X64" gmake DESTDIR=${RPM_BUILD_ROOT} install /usr/bin/strip ${RPM_BUILD_ROOT}%{_sbindir}/* || : ( cd ${RPM_BUILD_ROOT}%{_sbindir} for f in $(ls -1| grep -v -e _32 -e _64) do mv ${f} ${f}_64 done ) cd ../32bit export OBJECT_MODE=32 export AR="/usr/bin/ar -X32" gmake DESTDIR=${RPM_BUILD_ROOT} install /usr/bin/strip ${RPM_BUILD_ROOT}%{_sbindir}/* || : ( cd ${RPM_BUILD_ROOT}%{_sbindir} for f in $(ls -1| grep -v -e _32 -e _64) do mv ${f} ${f}_32 ln -sf ${f}_64 ${f} done ) mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/cron.daily mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/lib/logrotate /usr/bin/strip -X32_64 ${RPM_BUILD_ROOT}%{_sbindir}/* || : install -p -m 644 examples/logrotate.conf ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.conf sed -i '/include/a include /opt/freeware/etc/logrotate.d' ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.conf install -p -m 755 examples/logrotate.cron ${RPM_BUILD_ROOT}%{_sysconfdir}/cron.daily/logrotate /opt/freeware/bin/sed -i "s|/usr/sbin/logrotate|/opt/freeware/sbin/logrotate|g" ${RPM_BUILD_ROOT}%{_sysconfdir}/cron.daily/logrotate /opt/freeware/bin/sed -i "s|/etc/logrotate.conf|/opt/freeware/etc/logrotate.conf|g" ${RPM_BUILD_ROOT}%{_sysconfdir}/cron.daily/logrotate %post echo "Below changes went in version 3.18.0-2. Users updating logrotate from older versions, please read and take action accordingly." echo "\t1) The logrotate cron script \"/opt/freeware/etc/cron.daily/logrotate\" is modified to reflect correct logrotate binary & conf file." echo "\t Please check the script." echo "\t2) The default state file is now \"/opt/freeware/var/lib/logrotate/logrotate.status\"." echo "\t Users may want to copy the older state file \"/var/lib/logrotate.status\" into the above file." if [ ! -f /opt/freeware/var/lib/logrotate/logrotate.status ] then touch /opt/freeware/var/lib/logrotate/logrotate.status fi %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %files %defattr(-,root,system) %doc 32bit/COPYING %{_sbindir}/logrotate* %{_mandir}/man8/logrotate.8* %{_mandir}/man5/logrotate.conf.5* %{_sysconfdir}/cron.daily/logrotate %config(noreplace) %{_sysconfdir}/logrotate.conf %dir %{_sysconfdir}/logrotate.d %dir %{_localstatedir}/lib/logrotate %ghost %verify(not size md5 mtime) %attr(0644,root,system) %{_localstatedir}/lib/logrotate/logrotate.status %changelog * Mon Feb 07 2022 Ayappan P - 3.18.0-2 - Fix paths in logrotate cron script - Default state file is now /opt/freeware/var/lib/logrotate/logrotate.status * Fri May 14 2021 Rishita Saha - 3.18.0-1 - Update to version 3.18.0 - No longer shipping files in /usr directory * Wed Jan 29 2020 Reshma V kumar - 3.14.0-4 - Rebuild to set proper library search path * Wed Nov 06 2019 Harshita Jain -3.14.0-3 - Fixing an issue related to versioning * Thu Dec 20 2018 Harshita Jain -3.14.0-2 - Removing the dependency of coreutils * Mon Nov 26 2018 Harshita Jain - 3.14.0-1 - Update to latest version 3.14.0-1 * Thu Apr 14 2016 Ayappan P - 3.8.5-1 - Update to version 3.8.4 * Wed Nov 20 2013 Gerard Visiedo 3.8.3-1 - Update to version 3.8.3 * Tue Nov 19 2013 Gerard Visiedo 3.8.2-2 - Built on Aix6.1 * Mon Aug 13 2012 Michael Perzl - 3.8.2-1 - updated to version 3.8.2 * Tue Apr 12 2012 Michael Perzl - 3.8.1-2 - add missing mbrtowc patch again * Fri Dec 23 2011 Michael Perzl - 3.8.1-1 - updated to version 3.8.1 * Mon Aug 29 2011 Michael Perzl - 3.7.9-2 - add missing mbrtowc patch again * Thu Dec 02 2010 Michael Perzl - 3.7.9-1 - updated to version 3.7.9 * Tue Oct 20 2009 Jeremy W. Chalfant - 3.7.8-3 - added -D_LARGE_FILES to CFLAGS in support of rotating files larger than 2GB and changed c compiler from xlc to cc as it gave "Initializer must be a valid constant expression" errors * Fri Jun 26 2009 Michael Perzl - 3.7.8-2 - included olddir option fix * Wed Jun 17 2009 Michael Perzl - 3.7.8-1 - updated to version 3.7.8 * Tue Jun 24 2008 Michael Perzl - 3.7.7-1 - first version for AIX V5.1 and higher