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:
commit
171d189605
15
logrotate-fail_if_ENOENT_and_nomissingok.patch
Normal file
15
logrotate-fail_if_ENOENT_and_nomissingok.patch
Normal 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);
|
@ -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
|
Thu Nov 7 21:57:31 UTC 2013 - sweet_f_a@gmx.de
|
||||||
|
|
||||||
|
10
logrotate.service
Normal file
10
logrotate.service
Normal 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
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package logrotate
|
# 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
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -26,22 +26,26 @@ License: GPL-2.0+
|
|||||||
Group: System/Base
|
Group: System/Base
|
||||||
Source: https://fedorahosted.org/releases/l/o/%{name}/%{name}-%{version}.tar.gz
|
Source: https://fedorahosted.org/releases/l/o/%{name}/%{name}-%{version}.tar.gz
|
||||||
Source100: %{name}-rpmlintrc
|
Source100: %{name}-rpmlintrc
|
||||||
|
Source101: %{name}.service
|
||||||
|
Source102: %{name}.timer
|
||||||
Patch0: logrotate-3.7.8-suse.patch
|
Patch0: logrotate-3.7.8-suse.patch
|
||||||
Patch1: logrotate-3.7.8-conf.patch
|
Patch1: logrotate-3.7.8-conf.patch
|
||||||
Patch2: logrotate-3.7.8-autoext.patch
|
Patch2: logrotate-3.7.8-autoext.patch
|
||||||
Patch3: logrotate-3.7.8-addextension.patch
|
Patch3: logrotate-3.7.8-addextension.patch
|
||||||
Patch4: logrotate-3.7.8-mess_err.patch
|
Patch4: logrotate-3.7.8-mess_err.patch
|
||||||
Patch5: logrotate-manpage_config_clarification.patch
|
Patch5: logrotate-manpage_config_clarification.patch
|
||||||
|
Patch6: logrotate-fail_if_ENOENT_and_nomissingok.patch
|
||||||
BuildRequires: acl
|
BuildRequires: acl
|
||||||
BuildRequires: libacl-devel
|
BuildRequires: libacl-devel
|
||||||
BuildRequires: libselinux-devel
|
BuildRequires: libselinux-devel
|
||||||
BuildRequires: popt-devel
|
BuildRequires: popt-devel
|
||||||
|
BuildRequires: pkgconfig(systemd) >= 197
|
||||||
PreReq: %fillup_prereq
|
PreReq: %fillup_prereq
|
||||||
PreReq: /bin/mv
|
PreReq: /bin/mv
|
||||||
PreReq: /bin/rm
|
PreReq: /bin/rm
|
||||||
Requires: cron
|
|
||||||
Requires: xz
|
Requires: xz
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
|
%{?systemd_requires}
|
||||||
|
|
||||||
%description
|
%description
|
||||||
The logrotate utility is designed to simplify the administration of log
|
The logrotate utility is designed to simplify the administration of log
|
||||||
@ -59,6 +63,7 @@ daily cron job.
|
|||||||
%patch3
|
%patch3
|
||||||
%patch4
|
%patch4
|
||||||
%patch5 -p1
|
%patch5 -p1
|
||||||
|
%patch6 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
make %{?_smp_mflags} CC="%__cc" RPM_OPT_FLAGS="%{optflags}" \
|
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}%{_sysconfdir}/{logrotate.d,cron.daily}
|
||||||
mkdir -p %{buildroot}%{_prefix}/sbin
|
mkdir -p %{buildroot}%{_prefix}/sbin
|
||||||
install -m 644 examples/logrotate-default %{buildroot}%{_sysconfdir}/logrotate.conf
|
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 -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
|
%post
|
||||||
%{remove_and_set MAX_DAYS_FOR_LOG_FILES}
|
%{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
|
mv -v /etc/logrotate.d/aaa_base /etc/logrotate.d.aaa_base.save
|
||||||
fi
|
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
|
%clean
|
||||||
rm -rf %{buildroot}
|
rm -rf %{buildroot}
|
||||||
|
|
||||||
@ -92,8 +110,9 @@ rm -rf %{buildroot}
|
|||||||
%{_sbindir}/logrotate
|
%{_sbindir}/logrotate
|
||||||
%{_mandir}/man8/logrotate.8*
|
%{_mandir}/man8/logrotate.8*
|
||||||
%{_mandir}/man5/logrotate.conf.5*
|
%{_mandir}/man5/logrotate.conf.5*
|
||||||
%{_sysconfdir}/cron.daily/logrotate
|
|
||||||
%config %{_sysconfdir}/logrotate.conf
|
%config %{_sysconfdir}/logrotate.conf
|
||||||
%config(noreplace)/etc/logrotate.d/wtmp
|
%config(noreplace)/etc/logrotate.d/wtmp
|
||||||
|
%{_unitdir}/%{name}.service
|
||||||
|
%{_unitdir}/%{name}.timer
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
11
logrotate.timer
Normal file
11
logrotate.timer
Normal 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
|
Loading…
x
Reference in New Issue
Block a user