import timedatex-0.5-3.el8

This commit is contained in:
CentOS Sources 2019-08-02 04:17:45 -04:00 committed by Stepan Oksanichenko
commit 8a4c8cc7f8
4 changed files with 164 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
SOURCES/timedatex-0.5.tar.gz

1
.timedatex.metadata Normal file
View File

@ -0,0 +1 @@
dee8173075f3972e5cdf1b2f3b35a9b9aa2e793a SOURCES/timedatex-0.5.tar.gz

View File

@ -0,0 +1,66 @@
commit 3f0b85db1d4eedd3fdc9db0832e114215812d15c
Author: Miroslav Lichvar <mlichvar@redhat.com>
Date: Wed Jan 10 15:55:05 2018 +0100
don't remove timeout after each main context iteration
With glib2-2.54.3 adding a new timeout causes g_main_context_iteration()
to immediately return FALSE, which triggered an infinite loop removing
and adding the timeout.
Instead of removing the timeout after all iterations, use a flag to
remove the timeout only when a valid call was handled.
This fixes issue #4.
diff --git a/timedatex.c b/timedatex.c
index 28e562c..e671bb5 100644
--- a/timedatex.c
+++ b/timedatex.c
@@ -120,7 +120,7 @@ struct hwclock_call {
/* Global variables */
static GDBusProxy *systemd_proxy, *polkit_proxy;
-static gboolean main_quit, running_auth_checks;
+static gboolean main_quit, running_auth_checks, had_activity;
static GArray *ntp_units;
@@ -948,6 +948,8 @@ static void handle_method_call(GDBusConnection *connection, const gchar *caller,
} else {
g_assert_not_reached();
}
+
+ had_activity = TRUE;
}
static const GDBusInterfaceVTable interface_vtable = {
@@ -1022,19 +1024,24 @@ int main(int argc, char **argv) {
read_ntp_units();
main_quit = FALSE;
+ had_activity = FALSE;
/* This is the main loop. Quit when idle for QUIT_TIMEOUT seconds. */
while (!main_quit) {
/* Add timeout when not waiting for an authorization check */
- if (!running_auth_checks)
+ if (!timeout_id && !running_auth_checks)
timeout_id = g_timeout_add(QUIT_TIMEOUT * 1000, stop_main_loop, NULL);
g_main_context_iteration(g_main_context_default(), TRUE);
- if (timeout_id)
- g_source_remove(timeout_id);
- timeout_id = 0;
+ if (had_activity || running_auth_checks) {
+ had_activity = FALSE;
+
+ if (timeout_id)
+ g_source_remove(timeout_id);
+ timeout_id = 0;
+ }
}
ret = 0;

96
SPECS/timedatex.spec Normal file
View File

@ -0,0 +1,96 @@
%global _hardened_build 1
Name: timedatex
Version: 0.5
Release: 3%{?dist}
Summary: D-Bus service for system clock and RTC settings
Group: System Environment/Daemons
License: GPLv2+
URL: https://github.com/mlichvar/timedatex
Source0: https://github.com/mlichvar/timedatex/archive/v%{version}/%{name}-%{version}.tar.gz
BuildRequires: glib2-devel libselinux-devel systemd
Requires: polkit systemd util-linux
Patch1: timedatex-timeout.patch
%description
timedatex is a D-Bus service that implements the org.freedesktop.timedate1
interface. It can be used to read and set the system clock, the real-time clock
(RTC), the system timezone, and enable or disable an NTP client installed on
the system. It is a replacement for the systemd-timedated service.
%prep
%setup -q
%patch1 -p1 -b .timeout
%build
make %{?_smp_mflags} \
CFLAGS="$RPM_OPT_FLAGS" \
EXTRA_LDFLAGS="%{__global_ldflags}"
%install
%makeinstall unitdir=%{?buildroot:%{buildroot}}%{_unitdir}
# mask systemd-timedated service (#1244023)
mkdir -p %{buildroot}%{_sysconfdir}/systemd/system
ln -s /dev/null %{buildroot}%{_sysconfdir}/systemd/system/systemd-timedated.service
%post
%systemd_post %{name}.service
%preun
%systemd_preun %{name}.service
%postun
%systemd_postun_with_restart %{name}.service
%files
%doc COPYING NEWS README
%{_sysconfdir}/systemd/system/systemd-timedated.service
%{_sbindir}/%{name}
%{_mandir}/man8/%{name}.8*
%{_unitdir}/%{name}.service
%dir %{_prefix}/lib/systemd/ntp-units.d
%changelog
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Wed Jan 10 2018 Miroslav Lichvar <mlichvar@redhat.com> 0.5-2
- avoid getting stuck in infinite loop with new glib2 (#1450628)
* Tue Nov 07 2017 Miroslav Lichvar <mlichvar@redhat.com> 0.5-1
- update to 0.5
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.4-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.4-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Fri Feb 05 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Tue Nov 10 2015 Miroslav Lichvar <mlichvar@redhat.com> 0.4-1
- update to 0.4 (#1279760)
* Fri Jul 24 2015 Miroslav Lichvar <mlichvar@redhat.com> 0.3-3
- mask systemd-timedated service (#1244023)
- rely on systemd preset in post scriptlet
* Fri Jun 19 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Mon May 11 2015 Miroslav Lichvar <mlichvar@redhat.com> 0.3-1
- update to 0.3 (#1190377)
* Wed Jan 21 2015 Miroslav Lichvar <mlichvar@redhat.com> 0.2-1
- update to 0.2
* Wed Nov 19 2014 Miroslav Lichvar <mlichvar@redhat.com> 0.1-1
- initial release