commit 7061a07c44bfed40d47f3ee19d1762f90790f589 Author: overweight <5324761+overweight@user.noreply.gitee.com> Date: Mon Sep 30 11:18:29 2019 -0400 Package init diff --git a/timedatex-0.5.tar.gz b/timedatex-0.5.tar.gz new file mode 100644 index 0000000..aaf5c60 Binary files /dev/null and b/timedatex-0.5.tar.gz differ diff --git a/timedatex-timeout.patch b/timedatex-timeout.patch new file mode 100644 index 0000000..a380b8d --- /dev/null +++ b/timedatex-timeout.patch @@ -0,0 +1,66 @@ +commit 3f0b85db1d4eedd3fdc9db0832e114215812d15c +Author: Miroslav Lichvar +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; diff --git a/timedatex.spec b/timedatex.spec new file mode 100644 index 0000000..3b474ab --- /dev/null +++ b/timedatex.spec @@ -0,0 +1,72 @@ +%global _hardened_build 1 + +Name: timedatex +Version: 0.5 +Release: 7 +Summary: D-Bus service for system clock and RTC settings +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 +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, get a list of valid timezones, and enable or +disable an NTP client installed on the system. It is a replacement for the +systemd-timedated service. + +%package help +Summary: help document for timedatex +BuildArch: noarch + +%description help +help document for timedatex. + +%prep +%autosetup -n %{name}-%{version} -p1 -Sgit + +%build +%make_build CFLAGS="$RPM_OPT_FLAGS" EXTRA_LDFLAGS="%{__global_ldflags}" + +%install +%makeinstall unitdir=$RPM_BUILD_ROOT%{_unitdir} + +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/systemd/system +ln -s /dev/null $RPM_BUILD_ROOT%{_sysconfdir}/systemd/system/timedatex.service + +%check +make test + +%pre + +%preun +%systemd_preun %{name}.service + +%post +%systemd_post %{name}.service + +%postun +%systemd_postun_with_restart %{name}.service + +%files +%defattr(-,root,root) +%doc COPYING NEWS README +%{_sysconfdir}/systemd/system/timedatex.service +%{_sbindir}/%{name} +%{_unitdir}/%{name}.service + +%files help +%defattr(-,root,root) +%{_mandir}/man8/%{name}.8* + +%changelog +* Mon Sep 29 2019 Xiuning Fang - 0.5.7 +- delete mask systemd-timedated.service, mask timedatex.service + +* Wed Aug 28 2019 Huiming Xie - 0.5.6 +- Package init