[packages/polkit] - updated to 0.114 - updated systemd-fallback patch - removed outdated js187 patch (now polkit uses

qboosh qboosh at pld-linux.org
Fri Apr 13 05:53:09 CEST 2018


commit c57864733e9772e312e18dbc9c9138cef43c9373
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Fri Apr 13 05:53:14 2018 +0200

    - updated to 0.114
    - updated systemd-fallback patch
    - removed outdated js187 patch (now polkit uses mozjs52)
    - removed obsolete itstool patch
    - added format patch (fixes build with -Werror=format-security)

 js187.patch            | 23 --------------
 polkit-format.patch    | 11 +++++++
 polkit-itstool.patch   | 42 -------------------------
 polkit.spec            | 44 +++++++++++++++++---------
 systemd-fallback.patch | 84 ++++++++++++++++++++++++++++++++------------------
 5 files changed, 94 insertions(+), 110 deletions(-)
---
diff --git a/polkit.spec b/polkit.spec
index 571c68e..0f6877a 100644
--- a/polkit.spec
+++ b/polkit.spec
@@ -1,47 +1,58 @@
+# NOTE: elogind also supported (--disable-libsystemd-login --enable-libelogind)
 #
 # Conditional build:
 %bcond_without	apidocs		# build without apidocs
-%bcond_without	systemd		# use systemd for session tracking instead of ConsoleKit (fallback to ConsoleKit on runtime)
+%bcond_without	consolekit	# ConsoleKit fallback
+%bcond_without	systemd		# use systemd-login for session tracking (fallback to ConsoleKit on runtime)
+%bcond_with	elogind		# use elogind instead of systemd-login
 
+%if %{with elogind}
+%undefine	with_systemd
+%endif
 Summary:	A framework for defining policy for system-wide components
 Summary(pl.UTF-8):	Szkielet do definiowania polityki dla komponentów systemowych
 Name:		polkit
-Version:	0.113
-Release:	4
+Version:	0.114
+Release:	1
 License:	LGPL v2+
 Group:		Libraries
-Source0:	http://www.freedesktop.org/software/polkit/releases/%{name}-%{version}.tar.gz
-# Source0-md5:	4b77776c9e4f897dcfe03b2c34198edf
+Source0:	https://www.freedesktop.org/software/polkit/releases/%{name}-%{version}.tar.gz
+# Source0-md5:	93ff41874e7df8c62ed9e41893817f04
 Patch0:		systemd-fallback.patch
-Patch1:		js187.patch
-Patch2:		%{name}-itstool.patch
-URL:		http://www.freedesktop.org/wiki/Software/polkit
+Patch1:		%{name}-format.patch
+URL:		https://www.freedesktop.org/wiki/Software/polkit
 BuildRequires:	autoconf >= 2.60
 BuildRequires:	automake >= 1:1.7
 BuildRequires:	docbook-dtd412-xml
 BuildRequires:	docbook-style-xsl
+%{?with_elogind:BuildRequires:	elogind-devel}
 BuildRequires:	expat-devel >= 1:1.95.8
 BuildRequires:	gettext-tools
 BuildRequires:	glib2-devel >= 1:2.32.0
+%if %(locale -a | grep -q '^C\.utf8$'; echo $?)
+BuildRequires:	glibc-localedb-all
+%endif
 BuildRequires:	gobject-introspection-devel >= 0.6.2
 %{?with_apidocs:BuildRequires:	gtk-doc >= 1.3}
 BuildRequires:	gtk-doc-automake >= 1.3
 BuildRequires:	intltool >= 0.40.0
-BuildRequires:	js187-devel
-BuildRequires:	libtool
+BuildRequires:	libstdc++-devel >= 6:4.7
+BuildRequires:	libtool >= 2:1.5
 BuildRequires:	libxslt-progs
+BuildRequires:	mozjs52-devel
 BuildRequires:	pam-devel >= 0.80
 BuildRequires:	pkgconfig
 BuildRequires:	python-modules
 BuildRequires:	rpmbuild(macros) >= 1.647
 %{?with_systemd:BuildRequires:	systemd-devel}
 Requires:	%{name}-libs = %{version}-%{release}
-%if %{without systemd}
+%if %{without systemd} && %{without elogind}
 Requires:	ConsoleKit >= 0.4.1
-%else
-Requires:	systemd-units >= 38
 %endif
 Requires:	dbus >= 1.1.2-5
+%if %{with systemd}
+Requires:	systemd-units >= 38
+%endif
 Obsoletes:	PolicyKit
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -114,9 +125,10 @@ Statyczne biblioteki PolicyKit.
 
 %prep
 %setup -q
-%{?with_systemd:%patch0 -p1}
+%if %{with consolekit} && (%{with systemd} || %{with elogind})
+%patch0 -p1
+%endif
 %patch1 -p1
-%patch2 -p1
 
 %build
 %{?with_apidocs:%{__gtkdocize}}
@@ -129,12 +141,14 @@ Statyczne biblioteki PolicyKit.
 %configure \
 	%{__enable_disable apidocs gtk-doc} \
 	--disable-silent-rules \
+	%{__enable_disable elogind libelogind} \
 	%{__enable_disable systemd libsystemd-login} \
 	--with-html-dir=%{_gtkdocdir} \
 	--with-pam-include=system-auth \
 	--with-pam-module-dir=/%{_lib}/security \
 	--with-polkitd-user=polkitd
 
+LC_ALL=C.UTF-8 \
 %{__make} -j1
 
 %install
diff --git a/js187.patch b/js187.patch
deleted file mode 100644
index ac72843..0000000
--- a/js187.patch
+++ /dev/null
@@ -1,23 +0,0 @@
---- polkit-0.112/configure.ac~	2014-12-29 22:40:04.000000000 +0000
-+++ polkit-0.112/configure.ac	2014-12-29 22:41:01.765503630 +0000
-@@ -129,16 +129,16 @@
- AC_DEFINE([GLIB_VERSION_MAX_ALLOWED], [G_ENCODE_VERSION(2,34)],
-         [Notify us when we'll need to transition away from g_type_init()])
- 
--AC_ARG_WITH(mozjs, AS_HELP_STRING([--with-mozjs=@<:@mozjs185/mozjs-17.0|auto@:>@],
-+AC_ARG_WITH(mozjs, AS_HELP_STRING([--with-mozjs=@<:@mozjs187/mozjs-17.0|auto@:>@],
- 		                  [Specify version of Spidermonkey to use]),,
-             with_mozjs=auto)
- AS_IF([test x${with_mozjs} != xauto], [
-   PKG_CHECK_MODULES(LIBJS, ${with_mozjs})
- ], [
--  PKG_CHECK_MODULES(LIBJS, [mozjs185], have_mozjs185=yes, have_mozjs185=no)
--  AS_IF([test x${have_mozjs185} = xno], [
-+  PKG_CHECK_MODULES(LIBJS, [mozjs187], have_mozjs187=yes, have_mozjs187=no)
-+  AS_IF([test x${have_mozjs187} = xno], [
-   PKG_CHECK_MODULES(LIBJS, [mozjs-17.0], have_mozjs17=yes,
--   [AC_MSG_ERROR([Could not find mozjs185 or mozjs-17.0; see http://ftp.mozilla.org/pub/mozilla.org/js/])])
-+   [AC_MSG_ERROR([Could not find mozjs187 or mozjs-17.0; see http://ftp.mozilla.org/pub/mozilla.org/js/])])
-   ])
- ])
- AC_SUBST(LIBJS_CFLAGS)
diff --git a/polkit-format.patch b/polkit-format.patch
new file mode 100644
index 0000000..59a315d
--- /dev/null
+++ b/polkit-format.patch
@@ -0,0 +1,11 @@
+--- polkit-0.114/src/polkitbackend/polkitbackendjsauthority.cpp.orig	2018-04-12 21:26:58.848880061 +0200
++++ polkit-0.114/src/polkitbackend/polkitbackendjsauthority.cpp	2018-04-12 22:06:53.862186041 +0200
+@@ -1296,7 +1296,7 @@
+   JS::CallArgs args = JS::CallArgsFromVp (argc, vp);
+ 
+   s = JS_EncodeString (cx, args[0].toString ());
+-  JS_ReportWarningUTF8 (cx, s);
++  JS_ReportWarningUTF8 (cx, "%s", s);
+   JS_free (cx, s);
+ 
+   ret = true;
diff --git a/polkit-itstool.patch b/polkit-itstool.patch
deleted file mode 100644
index 1632a71..0000000
--- a/polkit-itstool.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-diff --git a/data/Makefile.am b/data/Makefile.am
-index fe0f1d5..18693fe 100644
---- a/data/Makefile.am
-+++ b/data/Makefile.am
-@@ -36,6 +36,11 @@ pkgconfig_DATA = polkit-gobject-1.pc polkit-agent-1.pc
- 
- # ----------------------------------------------------------------------------------------------------
- 
-+itsdir = $(datadir)/gettext/its
-+its_DATA = polkit.loc polkit.its
-+
-+# ----------------------------------------------------------------------------------------------------
-+
- systemdservice_in_files = polkit.service.in
- 
- if HAVE_SYSTEMD
-diff --git a/data/polkit.its b/data/polkit.its
-new file mode 100644
-index 0000000..1c37e6b
---- /dev/null
-+++ b/data/polkit.its
-@@ -0,0 +1,8 @@
-+<?xml version="1.0"?>
-+<its:rules xmlns:its="http://www.w3.org/2005/11/its"
-+           version="2.0">
-+  <its:translateRule selector="//*" translate="no"/>
-+  <its:translateRule selector="//action/description |
-+                               //action/message"
-+                     translate="yes"/>
-+</its:rules>
-diff --git a/data/polkit.loc b/data/polkit.loc
-new file mode 100644
-index 0000000..c7427ec
---- /dev/null
-+++ b/data/polkit.loc
-@@ -0,0 +1,6 @@
-+<?xml version="1.0"?>
-+<locatingRules>
-+  <locatingRule name="polkit policy" pattern="*.policy">
-+    <documentRule localName="policyconfig" target="polkit.its"/>
-+  </locatingRule>
-+</locatingRules>
diff --git a/systemd-fallback.patch b/systemd-fallback.patch
index 1a4f1ed..90ef297 100644
--- a/systemd-fallback.patch
+++ b/systemd-fallback.patch
@@ -29,9 +29,8 @@ diff -ruN polkit-0.113.orig/src/polkit/Makefile.am polkit-0.113/src/polkit/Makef
  
  libpolkit_gobject_1_la_CFLAGS =                                        	\
          -D_POLKIT_COMPILATION                                  		\
-diff -ruN polkit-0.113.orig/src/polkit/polkitunixsession.c polkit-0.113/src/polkit/polkitunixsession.c
---- polkit-0.113.orig/src/polkit/polkitunixsession.c	2014-01-14 23:42:25.000000000 +0100
-+++ polkit-0.113/src/polkit/polkitunixsession.c	2015-09-26 23:40:21.671982135 +0200
+--- polkit-0.114/src/polkit/polkitunixsession.c.orig	2018-03-23 16:09:30.000000000 +0100
++++ polkit-0.114/src/polkit/polkitunixsession.c	2018-04-12 19:03:50.775644785 +0200
 @@ -29,6 +29,12 @@
  #include "polkiterror.h"
  #include "polkitprivate.h"
@@ -45,7 +44,7 @@ diff -ruN polkit-0.113.orig/src/polkit/polkitunixsession.c polkit-0.113/src/polk
  /**
   * SECTION:polkitunixsession
   * @title: PolkitUnixSession
-@@ -363,35 +369,49 @@
+@@ -363,35 +369,49 @@ polkit_unix_session_exists_sync (PolkitS
  {
    PolkitUnixSession *session = POLKIT_UNIX_SESSION (subject);
    GDBusConnection *connection;
@@ -114,7 +113,7 @@ diff -ruN polkit-0.113.orig/src/polkit/polkitunixsession.c polkit-0.113/src/polk
    return ret;
  }
  
-@@ -474,6 +494,7 @@
+@@ -474,6 +494,7 @@ polkit_unix_session_initable_init (GInit
    GVariant *result;
    gboolean ret;
  
@@ -122,14 +121,31 @@ diff -ruN polkit-0.113.orig/src/polkit/polkitunixsession.c polkit-0.113/src/polk
    connection = NULL;
    ret = FALSE;
  
-@@ -484,28 +505,51 @@
+@@ -484,28 +505,65 @@ polkit_unix_session_initable_init (GInit
        goto out;
      }
  
 -  connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, cancellable, error);
 -  if (connection == NULL)
 -    goto out;
--
++#ifdef HAVE_LIBSYSTEMD
++  char *s;
++  uid_t uid;
++  
++  if (sd_booted () > 0)
++    {
++      if (sd_pid_get_session (session->pid, &s) == 0)
++        {
++          session->session_id = g_strdup (s);
++          free (s);
++          ret = TRUE;
++          goto out;
++        }
++
++  /* Now do process -> uid -> graphical session (systemd version 213)*/
++  if (sd_pid_get_owner_uid (session->pid, &uid) < 0)
++    goto error;
+ 
 -  result = g_dbus_connection_call_sync (connection,
 -                                        "org.freedesktop.ConsoleKit",           /* name */
 -                                        "/org/freedesktop/ConsoleKit/Manager",  /* object path */
@@ -143,19 +159,17 @@ diff -ruN polkit-0.113.orig/src/polkit/polkitunixsession.c polkit-0.113/src/polk
 -                                        error);
 -  if (result == NULL)
 -    goto out;
-+#ifdef HAVE_LIBSYSTEMD
-+  char *s;
-+  
-+  if (sd_booted () > 0)
++  if (sd_uid_get_display (uid, &s) >= 0)
 +    {
-+      if (sd_pid_get_session (session->pid, &s) == 0)
-+        {
-+          session->session_id = g_strdup (s);
-+          free (s);
-+          ret = TRUE;
-+          goto out;
-+        }
-+
++      session->session_id =  g_strdup (s);
++      free (s);
++      ret = TRUE;
++      goto out;
++    }
+ 
+-  g_variant_get (result, "(o)", &session->session_id);
+-  g_variant_unref (result);
++error:
 +      g_set_error (error,
 +                   POLKIT_ERROR,
 +                   POLKIT_ERROR_FAILED,
@@ -183,21 +197,18 @@ diff -ruN polkit-0.113.orig/src/polkit/polkitunixsession.c polkit-0.113/src/polk
 +      if (result == NULL)
 +	goto out;
  
--  g_variant_get (result, "(o)", &session->session_id);
--  g_variant_unref (result);
+-  ret = TRUE;
 +      g_variant_get (result, "(o)", &session->session_id);
 +      g_variant_unref (result);
- 
--  ret = TRUE;
++
 +      ret = TRUE;
 +    }
  
   out:
    if (connection != NULL)
-diff -ruN polkit-0.113.orig/src/polkit/polkitunixsession-systemd.c polkit-0.113/src/polkit/polkitunixsession-systemd.c
---- polkit-0.113.orig/src/polkit/polkitunixsession-systemd.c	2014-01-14 23:42:25.000000000 +0100
-+++ polkit-0.113/src/polkit/polkitunixsession-systemd.c	1970-01-01 01:00:00.000000000 +0100
-@@ -1,490 +0,0 @@
+--- polkit-0.114/src/polkit/polkitunixsession-systemd.c.orig	2018-04-12 18:55:30.995650493 +0200
++++ polkit-0.114/src/polkit/polkitunixsession-systemd.c	1970-01-01 01:00:00.000000000 +0100
+@@ -1,504 +0,0 @@
 -/*
 - * Copyright (C) 2011 Red Hat, Inc.
 - *
@@ -651,6 +662,7 @@ diff -ruN polkit-0.113.orig/src/polkit/polkitunixsession-systemd.c polkit-0.113/
 -  PolkitUnixSession *session = POLKIT_UNIX_SESSION (initable);
 -  gboolean ret = FALSE;
 -  char *s;
+-  uid_t uid;
 -
 -  if (session->session_id != NULL)
 -    {
@@ -667,6 +679,19 @@ diff -ruN polkit-0.113.orig/src/polkit/polkitunixsession-systemd.c polkit-0.113/
 -      goto out;
 -    }
 -
+-  /* Now do process -> uid -> graphical session (systemd version 213)*/
+-  if (sd_pid_get_owner_uid (session->pid, &uid) < 0)
+-    goto error;
+-
+-  if (sd_uid_get_display (uid, &s) >= 0)
+-    {
+-      session->session_id =  g_strdup (s);
+-      free (s);
+-      ret = TRUE;
+-      goto out;
+-    }
+-
+-error:
 -  g_set_error (error,
 -               POLKIT_ERROR,
 -               POLKIT_ERROR_FAILED,
@@ -707,9 +732,8 @@ diff -ruN polkit-0.113.orig/src/polkitbackend/Makefile.am polkit-0.113/src/polki
  
  libpolkit_backend_1_la_CFLAGS =                                        	\
          -D_POLKIT_COMPILATION                                  		\
-diff -ruN polkit-0.113.orig/src/polkitbackend/polkitbackendjsauthority.c polkit-0.113/src/polkitbackend/polkitbackendjsauthority.c
---- polkit-0.113.orig/src/polkitbackend/polkitbackendjsauthority.c	2015-06-19 22:39:58.000000000 +0200
-+++ polkit-0.113/src/polkitbackend/polkitbackendjsauthority.c	2015-09-26 23:40:21.674982125 +0200
+--- polkit-0.114.orig/src/polkitbackend/polkitbackendjsauthority.cpp	2015-06-19 22:39:58.000000000 +0200
++++ polkit-0.114/src/polkitbackend/polkitbackendjsauthority.cpp	2015-09-26 23:40:21.674982125 +0200
 @@ -36,6 +36,7 @@
  #include <polkit/polkitprivate.h>
  
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/polkit.git/commitdiff/c57864733e9772e312e18dbc9c9138cef43c9373



More information about the pld-cvs-commit mailing list