Gentoo Archives: gentoo-commits

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