Gentoo Archives: gentoo-commits

From: David Seifert <soap@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: xfce-base/xfce4-session/files/
Date: Tue, 14 Feb 2017 21:37:38
Message-Id: 1487108095.9d7a6656b5ebd4511aa9f9f277908999d0c56dfa.soap@gentoo
1 commit: 9d7a6656b5ebd4511aa9f9f277908999d0c56dfa
2 Author: Michael Mair-Keimberger (asterix) <m.mairkeimberger <AT> gmail <DOT> com>
3 AuthorDate: Sun Feb 12 17:27:19 2017 +0000
4 Commit: David Seifert <soap <AT> gentoo <DOT> org>
5 CommitDate: Tue Feb 14 21:34:55 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9d7a6656
7
8 xfce-base/xfce4-session: remove unused patch
9
10 Closes: https://github.com/gentoo/gentoo/pull/3931
11
12 .../files/xfce4-session-4.11.0-upower-0.99.0.patch | 448 ---------------------
13 1 file changed, 448 deletions(-)
14
15 diff --git a/xfce-base/xfce4-session/files/xfce4-session-4.11.0-upower-0.99.0.patch b/xfce-base/xfce4-session/files/xfce4-session-4.11.0-upower-0.99.0.patch
16 deleted file mode 100644
17 index a5e59f47f1..0000000000
18 --- a/xfce-base/xfce4-session/files/xfce4-session-4.11.0-upower-0.99.0.patch
19 +++ /dev/null
20 @@ -1,448 +0,0 @@
21 -Patch from http://bugzilla.xfce.org/show_bug.cgi?id=9952 with modification
22 -to edit configure.ac (release tarball) instead of configure.ac.in (git)
23 -
24 -From 38afe446cdc889266f1e553952397cc4a876ecf8 Mon Sep 17 00:00:00 2001
25 -From: Eric Koegel <eric.koegel@×××××.com>
26 -Date: Mon, 7 Jul 2014 11:30:06 +0300
27 -Subject: [PATCH] Add suspend/hibernate to shutdown-helper
28 -
29 -Upower 0.99 dropped support for suspend/hibernate as an obsolete
30 -feature in this commit:
31 -http://cgit.freedesktop.org/upower/commit/?id=1ee642e705a63f5ad56a6b55e4bf5c4a64c959b8
32 -Add that functionality into the shutdown-helper so these features
33 -will work again. Additionally Upower is an optional build dependency
34 -and the minimum required is 0.9.7 to support FreeBSD 9 and 10.
35 ----
36 - configure.ac.in | 30 ++++++++
37 - xfce4-session/Makefile.am | 4 +-
38 - xfce4-session/xfsm-shutdown.c | 167 +++++++++++++++++++++++++++++++++++++++++-
39 - xfce4-session/xfsm-upower.c | 8 +-
40 - xfce4-session/xfsm-upower.h | 4 +
41 - xfsm-shutdown-helper/main.c | 26 +++++++
42 - 6 files changed, 234 insertions(+), 5 deletions(-)
43 -
44 -diff --git a/configure.ac b/configure.ac
45 -index 910fd35..b9c9a90 100644
46 ---- a/configure.ac
47 -+++ b/configure.ac
48 -@@ -96,6 +96,10 @@ XDT_CHECK_PACKAGE([DBUS], [dbus-1], [1.1.0])
49 - XDT_CHECK_PACKAGE([DBUS_GLIB], [dbus-glib-1], [0.84])
50 - XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [4.9.0])
51 -
52 -+dnl Check for Upower
53 -+XDT_CHECK_OPTIONAL_PACKAGE([UPOWER],[upower-glib], [0.9.7],
54 -+ [upower],[Upower support])
55 -+
56 - dnl Check for polkit / systemd integration
57 - XDT_CHECK_OPTIONAL_PACKAGE([SYSTEMD], [polkit-gobject-1], [0.100],
58 - [systemd], [Systemd support (through polit)])
59 -@@ -157,6 +161,31 @@ if test "x$linux_ioprio_works" = "xyes"; then
60 - [Defined if linux/ioprio.h not only exists, but works properly])
61 - fi
62 -
63 -+dnl Compile time default choice of backend
64 -+AC_ARG_WITH([backend],
65 -+ AS_HELP_STRING([--with-backend=<option>],
66 -+ [Default backend to use linux, freebsd, openbsd]))
67 -+# default to a sane option
68 -+AC_CANONICAL_HOST
69 -+if test x$with_backend = x; then
70 -+ AS_CASE([$host],
71 -+ [*-linux*], [with_backend=linux],
72 -+ [*-*freebsd*], [with_backend=freebsd],
73 -+ [*-openbsd*], [with_backend=openbsd])
74 -+fi
75 -+AC_DEFINE_UNQUOTED(BACKEND, "$with_backend", [backend])
76 -+AC_SUBST(BACKEND, "$with_backend")
77 -+
78 -+if test x$with_backend = xlinux; then
79 -+ AC_DEFINE(BACKEND_TYPE_LINUX, 1, [Linux suspend/hibernate backend])
80 -+fi
81 -+if test x$with_backend = xfreebsd; then
82 -+ AC_DEFINE(BACKEND_TYPE_FREEBSD, 1, [FreeBSD suspend/hibernate backend])
83 -+fi
84 -+if test x$with_backend = xopenbsd; then
85 -+ AC_DEFINE(BACKEND_TYPE_OPENBSD, 1, [OpenBSD suspend/hibernate backend])
86 -+fi
87 -+
88 - dnl check for location Xfce glade files were installed to
89 - XFCE_GLADE_CATALOG_PATH="`pkg-config --variable glade_catalogdir libxfce4ui-1`"
90 - XFCE_GLADE_PIXMAP_PATH="`pkg-config --variable glade_pixmapdir libxfce4ui-1`"
91 -@@ -207,5 +236,6 @@ echo " * Gnome Keyring support: yes"
92 - else
93 - echo " * Gnome Keyring support: no"
94 - fi
95 -+echo " * Backend: ${with_backend}"
96 -
97 - echo
98 -diff --git a/xfce4-session/Makefile.am b/xfce4-session/Makefile.am
99 -index 5472b33..6b5968e 100644
100 ---- a/xfce4-session/Makefile.am
101 -+++ b/xfce4-session/Makefile.am
102 -@@ -83,7 +83,8 @@ xfce4_session_CFLAGS = \
103 - $(SYSTEMD_CFLAGS) \
104 - $(XFCONF_CFLAGS) \
105 - $(GMODULE_CFLAGS) \
106 -- $(PLATFORM_CFLAGS)
107 -+ $(PLATFORM_CFLAGS) \
108 -+ $(UPOWER_CFLAGS)
109 -
110 - xfce4_session_LDFLAGS = \
111 - -no-undefined \
112 -@@ -102,6 +103,7 @@ xfce4_session_LDADD = \
113 - $(LIBWNCK_LIBS) \
114 - $(SYSTEMD_LIBS) \
115 - $(XFCONF_LIBS) \
116 -+ $(UPOWER_LIBS) \
117 - -lm
118 -
119 - xfce4_session_DEPENDENCIES = \
120 -diff --git a/xfce4-session/xfsm-shutdown.c b/xfce4-session/xfsm-shutdown.c
121 -index 4c483a7..24b548e 100644
122 ---- a/xfce4-session/xfsm-shutdown.c
123 -+++ b/xfce4-session/xfsm-shutdown.c
124 -@@ -57,6 +57,9 @@
125 - #include <dbus/dbus-glib-lowlevel.h>
126 - #include <libxfce4util/libxfce4util.h>
127 - #include <gtk/gtk.h>
128 -+#ifdef HAVE_UPOWER
129 -+#include <upower.h>
130 -+#endif
131 -
132 - #include <libxfsm/xfsm-util.h>
133 -
134 -@@ -76,6 +79,8 @@
135 -
136 - static void xfsm_shutdown_finalize (GObject *object);
137 - static void xfsm_shutdown_sudo_free (XfsmShutdown *shutdown);
138 -+static gboolean xfsm_shutdown_fallback_can_hibernate (void);
139 -+static gboolean xfsm_shutdown_fallback_can_suspend (void);
140 -
141 -
142 -
143 -@@ -403,14 +408,16 @@ xfsm_shutdown_sudo_try_action (XfsmShutdown *shutdown,
144 - g_return_val_if_fail (shutdown->helper_state == SUDO_AVAILABLE, FALSE);
145 - g_return_val_if_fail (shutdown->helper_outfile != NULL, FALSE);
146 - g_return_val_if_fail (shutdown->helper_infile != NULL, FALSE);
147 -- g_return_val_if_fail (type == XFSM_SHUTDOWN_SHUTDOWN
148 -- || type == XFSM_SHUTDOWN_RESTART, FALSE);
149 -
150 - /* the command we send to sudo */
151 - if (type == XFSM_SHUTDOWN_SHUTDOWN)
152 - action = "POWEROFF";
153 - else if (type == XFSM_SHUTDOWN_RESTART)
154 - action = "REBOOT";
155 -+ else if (type == XFSM_SHUTDOWN_SUSPEND)
156 -+ action = "SUSPEND";
157 -+ else if (type == XFSM_SHUTDOWN_HIBERNATE)
158 -+ action = "HIBERNATE";
159 - else
160 - return FALSE;
161 -
162 -@@ -692,7 +699,19 @@ xfsm_shutdown_try_suspend (XfsmShutdown *shutdown,
163 - {
164 - g_return_val_if_fail (XFSM_IS_SHUTDOWN (shutdown), FALSE);
165 -
166 -+#ifdef HAVE_UPOWER
167 -+#if !UP_CHECK_VERSION(0, 99, 0)
168 - return xfsm_upower_try_suspend (shutdown->upower, error);
169 -+#endif /* UP_CHECK_VERSION */
170 -+#endif /* HAVE_UPOWER */
171 -+
172 -+ if (shutdown->helper_state == SUDO_AVAILABLE)
173 -+ {
174 -+ xfsm_upower_lock_screen (shutdown->upower, "Suspend", error);
175 -+ return xfsm_shutdown_sudo_try_action (shutdown, XFSM_SHUTDOWN_SUSPEND, error);
176 -+ }
177 -+ else
178 -+ return FALSE;
179 - }
180 -
181 -
182 -@@ -703,7 +722,19 @@ xfsm_shutdown_try_hibernate (XfsmShutdown *shutdown,
183 - {
184 - g_return_val_if_fail (XFSM_IS_SHUTDOWN (shutdown), FALSE);
185 -
186 -+#ifdef HAVE_UPOWER
187 -+#if !UP_CHECK_VERSION(0, 99, 0)
188 - return xfsm_upower_try_hibernate (shutdown->upower, error);
189 -+#endif /* UP_CHECK_VERSION */
190 -+#endif /* HAVE_UPOWER */
191 -+
192 -+ if (shutdown->helper_state == SUDO_AVAILABLE)
193 -+ {
194 -+ xfsm_upower_lock_screen (shutdown->upower, "Hibernate", error);
195 -+ return xfsm_shutdown_sudo_try_action (shutdown, XFSM_SHUTDOWN_HIBERNATE, error);
196 -+ }
197 -+ else
198 -+ return FALSE;
199 - }
200 -
201 -
202 -@@ -784,8 +815,15 @@ xfsm_shutdown_can_suspend (XfsmShutdown *shutdown,
203 - return TRUE;
204 - }
205 -
206 -+#ifdef HAVE_UPOWER
207 -+#if !UP_CHECK_VERSION(0, 99, 0)
208 - return xfsm_upower_can_suspend (shutdown->upower, can_suspend,
209 - auth_suspend, error);
210 -+#endif /* UP_CHECK_VERSION */
211 -+#endif /* HAVE_UPOWER */
212 -+
213 -+ *can_suspend = xfsm_shutdown_fallback_can_suspend ();
214 -+ return TRUE;
215 - }
216 -
217 -
218 -@@ -804,8 +842,15 @@ xfsm_shutdown_can_hibernate (XfsmShutdown *shutdown,
219 - return TRUE;
220 - }
221 -
222 -+#ifdef HAVE_UPOWER
223 -+#if !UP_CHECK_VERSION(0, 99, 0)
224 - return xfsm_upower_can_hibernate (shutdown->upower, can_hibernate,
225 - auth_hibernate, error);
226 -+#endif /* UP_CHECK_VERSION */
227 -+#endif /* HAVE_UPOWER */
228 -+
229 -+ *can_hibernate = xfsm_shutdown_fallback_can_hibernate ();
230 -+ return TRUE;
231 - }
232 -
233 -
234 -@@ -816,3 +861,121 @@ xfsm_shutdown_can_save_session (XfsmShutdown *shutdown)
235 - g_return_val_if_fail (XFSM_IS_SHUTDOWN (shutdown), FALSE);
236 - return shutdown->kiosk_can_save_session;
237 - }
238 -+
239 -+
240 -+
241 -+#ifdef BACKEND_TYPE_FREEBSD
242 -+static gchar *
243 -+get_string_sysctl (GError **err, const gchar *format, ...)
244 -+{
245 -+ va_list args;
246 -+ gchar *name;
247 -+ size_t value_len;
248 -+ gchar *str = NULL;
249 -+
250 -+ g_return_val_if_fail(format != NULL, FALSE);
251 -+
252 -+ va_start (args, format);
253 -+ name = g_strdup_vprintf (format, args);
254 -+ va_end (args);
255 -+
256 -+ if (sysctlbyname (name, NULL, &value_len, NULL, 0) == 0) {
257 -+ str = g_new (char, value_len + 1);
258 -+ if (sysctlbyname (name, str, &value_len, NULL, 0) == 0)
259 -+ str[value_len] = 0;
260 -+ else {
261 -+ g_free (str);
262 -+ str = NULL;
263 -+ }
264 -+ }
265 -+
266 -+ if (!str)
267 -+ g_set_error (err, 0, 0, "%s", g_strerror(errno));
268 -+
269 -+ g_free(name);
270 -+ return str;
271 -+}
272 -+
273 -+
274 -+
275 -+static gboolean
276 -+freebsd_supports_sleep_state (const gchar *state)
277 -+{
278 -+ gboolean ret = FALSE;
279 -+ gchar *sleep_states;
280 -+
281 -+ sleep_states = get_string_sysctl (NULL, "hw.acpi.supported_sleep_state");
282 -+ if (sleep_states != NULL)
283 -+ {
284 -+ if (strstr (sleep_states, state) != NULL)
285 -+ ret = TRUE;
286 -+ }
287 -+
288 -+ g_free (sleep_states);
289 -+
290 -+ return ret;
291 -+}
292 -+#endif /* BACKEND_TYPE_FREEBSD */
293 -+
294 -+
295 -+
296 -+#ifdef BACKEND_TYPE_LINUX
297 -+static gboolean
298 -+linux_supports_sleep_state (const gchar *state)
299 -+{
300 -+ gboolean ret = FALSE;
301 -+ gchar *command;
302 -+ GError *error = NULL;
303 -+ gint exit_status;
304 -+
305 -+ /* run script from pm-utils */
306 -+ command = g_strdup_printf ("/usr/bin/pm-is-supported --%s", state);
307 -+
308 -+ ret = g_spawn_command_line_sync (command, NULL, NULL, &exit_status, &error);
309 -+ if (!ret)
310 -+ {
311 -+ g_warning ("failed to run script: %s", error->message);
312 -+ g_error_free (error);
313 -+ goto out;
314 -+ }
315 -+ ret = (WIFEXITED(exit_status) && (WEXITSTATUS(exit_status) == EXIT_SUCCESS));
316 -+
317 -+out:
318 -+ g_free (command);
319 -+
320 -+ return ret;
321 -+}
322 -+#endif /* BACKEND_TYPE_LINUX */
323 -+
324 -+
325 -+static gboolean
326 -+xfsm_shutdown_fallback_can_suspend (void)
327 -+{
328 -+#ifdef BACKEND_TYPE_FREEBSD
329 -+ return freebsd_supports_sleep_state ("S3");
330 -+#endif
331 -+#ifdef BACKEND_TYPE_LINUX
332 -+ return linux_supports_sleep_state ("suspend");
333 -+#endif
334 -+#ifdef BACKEND_TYPE_OPENBSD
335 -+ return TRUE;
336 -+#endif
337 -+
338 -+ return FALSE;
339 -+}
340 -+
341 -+static gboolean
342 -+xfsm_shutdown_fallback_can_hibernate (void)
343 -+{
344 -+#ifdef BACKEND_TYPE_FREEBSD
345 -+ return freebsd_supports_sleep_state ("S4");
346 -+#endif
347 -+#ifdef BACKEND_TYPE_LINUX
348 -+ return linux_supports_sleep_state ("hibernate");
349 -+#endif
350 -+#ifdef BACKEND_TYPE_OPENBSD
351 -+ return FALSE;
352 -+#endif
353 -+
354 -+ return FALSE;
355 -+}
356 -diff --git a/xfce4-session/xfsm-upower.c b/xfce4-session/xfsm-upower.c
357 -index 57402ec..2960943 100644
358 ---- a/xfce4-session/xfsm-upower.c
359 -+++ b/xfce4-session/xfsm-upower.c
360 -@@ -21,6 +21,7 @@
361 -
362 - #include <dbus/dbus-glib.h>
363 - #include <dbus/dbus-glib-lowlevel.h>
364 -+#include <upower.h>
365 -
366 - #include <libxfsm/xfsm-util.h>
367 - #include <xfce4-session/xfsm-upower.h>
368 -@@ -283,14 +284,13 @@ xfsm_upower_try_method (XfsmUPower *upower,
369 -
370 -
371 -
372 --static gboolean
373 -+gboolean
374 - xfsm_upower_lock_screen (XfsmUPower *upower,
375 - const gchar *sleep_kind,
376 - GError **error)
377 - {
378 - XfconfChannel *channel;
379 - gboolean ret = TRUE;
380 -- GError *err = NULL;
381 -
382 - g_return_val_if_fail (sleep_kind != NULL, FALSE);
383 -
384 -@@ -299,6 +299,9 @@ xfsm_upower_lock_screen (XfsmUPower *upower,
385 - {
386 - if (xfsm_upower_proxy_ensure (upower, error))
387 - {
388 -+#if !UP_CHECK_VERSION(0, 99, 0)
389 -+ GError *err = NULL;
390 -+
391 - /* tell upower we're going to sleep, this saves some
392 - * time while we sleep 1 second if xflock4 is spawned */
393 - ret = dbus_g_proxy_call (upower->upower_proxy,
394 -@@ -312,6 +315,7 @@ xfsm_upower_lock_screen (XfsmUPower *upower,
395 - g_warning ("Couldn't sent that we were about to sleep: %s", err->message);
396 - g_error_free (err);
397 - }
398 -+#endif
399 - }
400 - else
401 - {
402 -diff --git a/xfce4-session/xfsm-upower.h b/xfce4-session/xfsm-upower.h
403 -index a492f7d..4e6a53b 100644
404 ---- a/xfce4-session/xfsm-upower.h
405 -+++ b/xfce4-session/xfsm-upower.h
406 -@@ -51,4 +51,8 @@ gboolean xfsm_upower_can_hibernate (XfsmUPower *upower,
407 - gboolean *auth_hibernate,
408 - GError **error);
409 -
410 -+gboolean xfsm_upower_lock_screen (XfsmUPower *upower,
411 -+ const gchar *sleep_kind,
412 -+ GError **error);
413 -+
414 - #endif /* !__XFSM_UPOWER_HELPER_H__ */
415 -diff --git a/xfsm-shutdown-helper/main.c b/xfsm-shutdown-helper/main.c
416 -index 667f288..60c621b 100644
417 ---- a/xfsm-shutdown-helper/main.c
418 -+++ b/xfsm-shutdown-helper/main.c
419 -@@ -57,6 +57,12 @@
420 - #ifdef REBOOT_CMD
421 - #undef REBOOT_CMD
422 - #endif
423 -+#ifdef UP_BACKEND_SUSPEND_COMMAND
424 -+#undef UP_BACKEND_SUSPEND_COMMAND
425 -+#endif
426 -+#ifdef UP_BACKEND_HIBERNATE_COMMAND
427 -+#undef UP_BACKEND_HIBERNATE_COMMAND
428 -+#endif
429 -
430 - #if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
431 - #define POWEROFF_CMD "/sbin/shutdown -p now"
432 -@@ -68,6 +74,18 @@
433 - #define POWEROFF_CMD "/sbin/shutdown -h now"
434 - #define REBOOT_CMD "/sbin/shutdown -r now"
435 - #endif
436 -+#ifdef BACKEND_TYPE_FREEBSD
437 -+#define UP_BACKEND_SUSPEND_COMMAND "/usr/sbin/zzz"
438 -+#define UP_BACKEND_HIBERNATE_COMMAND "/usr/sbin/acpiconf -s 4"
439 -+#endif
440 -+#if BACKEND_TYPE_LINUX
441 -+#define UP_BACKEND_SUSPEND_COMMAND "/usr/sbin/pm-suspend"
442 -+#define UP_BACKEND_HIBERNATE_COMMAND "/usr/sbin/pm-hibernate"
443 -+#endif
444 -+#ifdef BACKEND_TYPE_OPENBSD
445 -+#define UP_BACKEND_SUSPEND_COMMAND "/usr/sbin/zzz"
446 -+#define UP_BACKEND_HIBERNATE_COMMAND "/dev/null"
447 -+#endif
448 -
449 -
450 - static gboolean
451 -@@ -143,6 +161,14 @@ main (int argc, char **argv)
452 - {
453 - succeed = run (REBOOT_CMD);
454 - }
455 -+ else if (strncasecmp (action, "SUSPEND", 7) == 0)
456 -+ {
457 -+ succeed = run (UP_BACKEND_SUSPEND_COMMAND);
458 -+ }
459 -+ else if (strncasecmp (action, "HIBERNATE", 9) == 0)
460 -+ {
461 -+ succeed = run (UP_BACKEND_HIBERNATE_COMMAND);
462 -+ }
463 -
464 - if (succeed)
465 - {
466 ---
467 -2.0.0
468 -