Accepting request 228906 from Base:System

- BuildRequire systemd 197 or later.

- Migrate from cron to systemd timer units, this is overall 
  the most important package to migrate since it is one 
  of the very few base components that hard-require cron. (forwarded request 228893 from elvigia)

OBS-URL: https://build.opensuse.org/request/show/228906
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/logrotate?expand=0&rev=43
This commit is contained in:
Stephan Kulow 2014-04-04 14:32:05 +00:00 committed by Git OBS Bridge
commit 171d189605
5 changed files with 78 additions and 4 deletions

View File

@ -0,0 +1,15 @@
Index: logrotate-3.8.7/logrotate.c
===================================================================
--- logrotate-3.8.7.orig/logrotate.c 2014-04-01 18:39:14.294635014 +0200
+++ logrotate-3.8.7/logrotate.c 2014-04-01 18:40:29.613496763 +0200
@@ -795,8 +795,9 @@ int findNeedRotating(struct logInfo *log
char *ld = ourDirName(log->files[logNum]);
if (stat(ld, &sb)) {
/* If parent directory doesn't exist, it's not real error
+ (unless nomissingok is specified)
and rotation is not needed */
- if (errno != ENOENT) {
+ if (errno != ENOENT || (errno == ENOENT && (log->flags & LOG_FLAG_MISSINGOK) == 0)) {
message(MESS_ERROR, "stat of %s failed: %s\n", ld,
strerror(errno));
free(ld);

View File

@ -1,3 +1,22 @@
-------------------------------------------------------------------
Thu Apr 3 14:10:21 UTC 2014 - crrodriguez@opensuse.org
- BuildRequire systemd 197 or later.
-------------------------------------------------------------------
Wed Apr 2 22:45:56 UTC 2014 - crrodriguez@opensuse.org
- Migrate from cron to systemd timer units, this is overall
the most important package to migrate since it is one
of the very few base components that hard-require cron.
-------------------------------------------------------------------
Tue Apr 1 15:11:22 UTC 2014 - vcizek@suse.com
- return error when nomissingok is specified and the log path
doesn't exist (bnc#871217)
* added logrotate-fail_if_ENOENT_and_nomissingok.patch
-------------------------------------------------------------------
Thu Nov 7 21:57:31 UTC 2013 - sweet_f_a@gmx.de

10
logrotate.service Normal file
View File

@ -0,0 +1,10 @@
[Unit]
Description=Rotate log files
Documentation=man:logrotate(8) man:logrotate.conf(5)
[Service]
Type=oneshot
ExecStart=/usr/sbin/logrotate /etc/logrotate.conf
Nice=19
IOSchedulingClass=best-effort
IOSchedulingPriority=7

View File

@ -1,7 +1,7 @@
#
# spec file for package logrotate
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -26,22 +26,26 @@ License: GPL-2.0+
Group: System/Base
Source: https://fedorahosted.org/releases/l/o/%{name}/%{name}-%{version}.tar.gz
Source100: %{name}-rpmlintrc
Source101: %{name}.service
Source102: %{name}.timer
Patch0: logrotate-3.7.8-suse.patch
Patch1: logrotate-3.7.8-conf.patch
Patch2: logrotate-3.7.8-autoext.patch
Patch3: logrotate-3.7.8-addextension.patch
Patch4: logrotate-3.7.8-mess_err.patch
Patch5: logrotate-manpage_config_clarification.patch
Patch6: logrotate-fail_if_ENOENT_and_nomissingok.patch
BuildRequires: acl
BuildRequires: libacl-devel
BuildRequires: libselinux-devel
BuildRequires: popt-devel
BuildRequires: pkgconfig(systemd) >= 197
PreReq: %fillup_prereq
PreReq: /bin/mv
PreReq: /bin/rm
Requires: cron
Requires: xz
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%{?systemd_requires}
%description
The logrotate utility is designed to simplify the administration of log
@ -59,6 +63,7 @@ daily cron job.
%patch3
%patch4
%patch5 -p1
%patch6 -p1
%build
make %{?_smp_mflags} CC="%__cc" RPM_OPT_FLAGS="%{optflags}" \
@ -73,8 +78,13 @@ make PREFIX=%{buildroot} install
mkdir -p %{buildroot}%{_sysconfdir}/{logrotate.d,cron.daily}
mkdir -p %{buildroot}%{_prefix}/sbin
install -m 644 examples/logrotate-default %{buildroot}%{_sysconfdir}/logrotate.conf
install -m 755 examples/logrotate.cron %{buildroot}%{_sysconfdir}/cron.daily/logrotate
install -m 644 examples/logrotate.wtmp %{buildroot}%{_sysconfdir}/logrotate.d/wtmp
install -D -m 0644 %{S:101} %{buildroot}%{_unitdir}/%{name}.service
install -D -m 0644 %{S:102} %{buildroot}%{_unitdir}/%{name}.timer
%pre
#only the timer can be enabled/disabled/masked !
%service_add_pre %{name}.service %{name}.timer
%post
%{remove_and_set MAX_DAYS_FOR_LOG_FILES}
@ -83,6 +93,14 @@ if [ -f /etc/logrotate.d/aaa_base ] ; then
mv -v /etc/logrotate.d/aaa_base /etc/logrotate.d.aaa_base.save
fi
%service_add_post %{name}.service %{name}.timer
%preun
%service_del_preun %{name}.service %{name}.timer
%postun
%service_del_postun %{name}.service %{name}.timer
%clean
rm -rf %{buildroot}
@ -92,8 +110,9 @@ rm -rf %{buildroot}
%{_sbindir}/logrotate
%{_mandir}/man8/logrotate.8*
%{_mandir}/man5/logrotate.conf.5*
%{_sysconfdir}/cron.daily/logrotate
%config %{_sysconfdir}/logrotate.conf
%config(noreplace)/etc/logrotate.d/wtmp
%{_unitdir}/%{name}.service
%{_unitdir}/%{name}.timer
%changelog

11
logrotate.timer Normal file
View File

@ -0,0 +1,11 @@
[Unit]
Description=Daily rotation of log files
Documentation=man:logrotate(8) man:logrotate.conf(5)
[Timer]
OnCalendar=daily
AccuracySec=12h
Persistent=true
[Install]
WantedBy=timers.target