Accepting request 412578 from GNOME:Factory

1

OBS-URL: https://build.opensuse.org/request/show/412578
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/gnome-session?expand=0&rev=160
This commit is contained in:
Dominique Leuenberger 2016-07-28 21:43:17 +00:00 committed by Git OBS Bridge
commit 1a9ef92c67
3 changed files with 162 additions and 6 deletions

View File

@ -0,0 +1,139 @@
From e7675cc3c3c078aedf57e6d386f10c47eb22f0d1 Mon Sep 17 00:00:00 2001
From: Felix Zhang <fezhang@suse.com>
Date: Sun, 17 Jul 2016 17:27:06 +0800
Subject: [PATCH] logging to systemd journal configurable
---
configure.ac | 19 +++++++++++++++++++
gnome-session/gsm-autostart-app.c | 6 ++++--
gnome-session/gsm-manager.c | 8 ++++----
gnome-session/main.c | 4 ++--
4 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/configure.ac b/configure.ac
index 223ee89..f248e9d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -147,6 +147,25 @@ AC_SUBST(SYSTEMD_LIBS)
AM_CONDITIONAL(HAVE_SYSTEMD, [test "$enable_systemd" = "yes"], [Using systemd])
dnl ====================================================================
+dnl systemd journal support
+dnl ====================================================================
+AC_ARG_ENABLE([systemd-journal],
+ AS_HELP_STRING([--enable-systemd-journal], [Send output to systemd journal]),
+ [enable_systemd_journal=$enableval],
+ [enable_systemd_journal=$enable_systemd])
+
+AC_MSG_CHECKING([whether to send the outputs of gnome-session and its child processes to systemd journal])
+
+AC_MSG_RESULT($enable_systemd_journal)
+
+if test x$enable_systemd_journal = xyes ; then
+ if test x$enable_systemd = xno ; then
+ AC_MSG_ERROR([Systemd not found, or it is not enabled])
+ fi
+ AC_DEFINE(ENABLE_SYSTEMD_JOURNAL, 1, [Define if output should be send to systemd journal])
+fi
+
+dnl ====================================================================
dnl Check for ConsoleKit
dnl ====================================================================
diff --git a/gnome-session/gsm-autostart-app.c b/gnome-session/gsm-autostart-app.c
index 1dc3ba3..0837258 100644
--- a/gnome-session/gsm-autostart-app.c
+++ b/gnome-session/gsm-autostart-app.c
@@ -33,7 +33,9 @@
#endif
#ifdef HAVE_SYSTEMD
+#ifdef ENABLE_SYSTEMD_JOURNAL
#include <systemd/sd-journal.h>
+#endif
#include <systemd/sd-daemon.h>
#endif
@@ -1021,7 +1023,7 @@ app_launched (GAppLaunchContext *ctx,
app->priv->startup_id = sn_id;
}
-#ifdef HAVE_SYSTEMD
+#ifdef ENABLE_SYSTEMD_JOURNAL
static void
on_child_setup (GsmAutostartApp *app)
{
@@ -1092,7 +1094,7 @@ autostart_app_start_spawn (GsmAutostartApp *app,
g_app_launch_context_setenv (ctx, "DESKTOP_AUTOSTART_ID", startup_id);
}
-#ifdef HAVE_SYSTEMD
+#ifdef ENABLE_SYSTEMD_JOURNAL
if (sd_booted () > 0) {
child_setup_func = (GSpawnChildSetupFunc) on_child_setup;
child_setup_data = app;
diff --git a/gnome-session/gsm-manager.c b/gnome-session/gsm-manager.c
index a378cd9..175f4f5 100644
--- a/gnome-session/gsm-manager.c
+++ b/gnome-session/gsm-manager.c
@@ -40,7 +40,7 @@
#include "gsm-manager.h"
#include "org.gnome.SessionManager.h"
-#ifdef HAVE_SYSTEMD
+#ifdef ENABLE_SYSTEMD_JOURNAL
#include <systemd/sd-journal.h>
#endif
@@ -271,7 +271,7 @@ on_required_app_failure (GsmManager *manager,
allow_logout = !_log_out_is_locked_down (manager);
}
-#ifdef HAVE_SYSTEMD
+#ifdef ENABLE_SYSTEMD_JOURNAL
sd_journal_send ("MESSAGE_ID=%s", GSM_MANAGER_UNRECOVERABLE_FAILURE_MSGID,
"PRIORITY=%d", 3,
"MESSAGE=Unrecoverable failure in required component %s", app_id,
@@ -301,7 +301,7 @@ on_display_server_failure (GsmManager *manager,
extensions = NULL;
}
-#ifdef HAVE_SYSTEMD
+#ifdef ENABLE_SYSTEMD_JOURNAL
sd_journal_send ("MESSAGE_ID=%s", GSM_MANAGER_UNRECOVERABLE_FAILURE_MSGID,
"PRIORITY=%d", 3,
"MESSAGE=Unrecoverable failure in required component %s", app_id,
@@ -1317,7 +1317,7 @@ start_phase (GsmManager *manager)
do_phase_startup (manager);
break;
case GSM_MANAGER_PHASE_RUNNING:
-#ifdef HAVE_SYSTEMD
+#ifdef ENABLE_SYSTEMD_JOURNAL
sd_journal_send ("MESSAGE_ID=%s", GSM_MANAGER_STARTUP_SUCCEEDED_MSGID,
"PRIORITY=%d", 5,
"MESSAGE=Entering running state",
diff --git a/gnome-session/main.c b/gnome-session/main.c
index bd23824..39757b9 100644
--- a/gnome-session/main.c
+++ b/gnome-session/main.c
@@ -41,7 +41,7 @@
#include "gsm-system.h"
#include "gsm-fail-whale.h"
-#ifdef HAVE_SYSTEMD
+#ifdef ENABLE_SYSTEMD_JOURNAL
#include <systemd/sd-journal.h>
#endif
@@ -329,7 +329,7 @@ main (int argc, char **argv)
* journald picks ups the nicer "gnome-session" as the program
* name instead of whatever shell script GDM happened to use.
*/
-#ifdef HAVE_SYSTEMD
+#ifdef ENABLE_SYSTEMD_JOURNAL
if (!debug) {
int journalfd;
--
2.6.6

View File

@ -1,3 +1,18 @@
-------------------------------------------------------------------
Sun Jul 17 12:04:34 UTC 2016 - fezhang@suse.com
- Add gnome-session-logging-to-systemd-journal-configurable.patch:
Add an autoconf switch to control if the logs of gnome-session
and its child processes should be sent to systemd journal or to
the legacy ~/.xsession-errors-$DISPLAY when disabled (bsc#979498,
bgo#768982).
- For SLE, disable logging to systemd journal: pass
--disable-systemd-journal to configure.
- Replace gnome-common BuildRequires with autoconf: this is
sufficient to bootstrap gnome-session.
- Unconditionally call autoconf, as the newly added patch touches
the build system.
-------------------------------------------------------------------
Mon Jul 11 17:30:19 UTC 2016 - zaitor@opensuse.org

View File

@ -28,10 +28,10 @@ Source1: gnome
Source2: gnome.desktop
# PATCH-FIX-SLE gnome-session-ice-auth-for-suid.patch hpj@novell.com -- Carries ICE auth over to other UIDs in this session using an env var.
Patch0: gnome-session-ice-auth-for-suid.patch
# PATCH-FEATURE-UPSTREAM gnome-session-logging-to-systemd-journal-configurable.patch bsc#876685 bgo#768982 fezhang@suse.com -- Add a new configure switch for systemd journal support.
Patch1: gnome-session-logging-to-systemd-journal-configurable.patch
BuildRequires: autoconf
BuildRequires: fdupes
%if !0%{?is_opensuse}
BuildRequires: gnome-common
%endif
BuildRequires: intltool
BuildRequires: tcpd-devel
%if !0%{?is_opensuse}
@ -106,13 +106,15 @@ functional GNOME desktop.
translation-update-upstream
%patch0 -p1
%endif
%patch1 -p1
%build
%if !0%{?is_opensuse}
NOCONFIGURE=1 gnome-autogen.sh
%endif
autoconf
%configure \
--enable-systemd \
%if !0%{?is_opensuse}
--disable-systemd-journal \
%endif
--disable-gconf
make %{?_smp_mflags} V=1