sys-auth/polkit: Sync with Gentoo

It's from Gentoo commit c664c4647ef5150e16bd28a83c68b6d5979414ee.
This commit is contained in:
Flatcar Buildbot 2025-06-30 07:14:20 +00:00
parent 9547baa2ce
commit 0d92f03a7d
13 changed files with 4 additions and 770 deletions

View File

@ -1,4 +1,2 @@
DIST polkit-123.tar.bz2 707480 BLAKE2B 27d8764606d8156118269fb4cd5eda1cfd0d56df219e4157cd78fd4c2a2d001c474271b7bb31e7e82ca376eacd26411418695058cc888700690606348b4d014a SHA512 4306363d3ed7311243de462832199bd10ddda35e36449104daff0895725d8189b07a4c88340f28607846fdf761c23470da2d43288199c46aa816426384124bb6
DIST polkit-124.tar.bz2 715490 BLAKE2B ecfc1ec73a7e1bbdf7374642ad4e1dbe534149a27e75bb1235eaa446ff912466ee0cdd978c34b7f110bc62a49b25ffddc9011e280686e3f304a234454be85a40 SHA512 db520882b0bedf1c96052570bf4c55d7e966d8172f6d26acf0791d98c4b911fce5ee39e6d830f06122ac8df33c6b43c252cdb7ba3a54523804824ebf355405dc
DIST polkit-125.tar.gz 453652 BLAKE2B 068bd4a7c028a0b4e026a0fdc3a60bd323087282a5c5bd7cbc404dbedb997de63893ce2282e8cd5f01f8d98ff0cc1a46200543a832fa397a4f50ef8d6ba2b28b SHA512 64d85c1557355d6de6483beeb855b74a99dbb30cf9968206dc0aaf147156072ca2604bf667533099ee3972b3eed0421ec0a1ff8bea35a1e4c54da7b9688e0953
DIST polkit-126.tar.gz 456138 BLAKE2B 2e86c8853edf29879d8367b77d210d3a891178297cb5f9eb204a953bfaa66f6ff2307da265f4c3f89265ba8ce32e94641272d654a78d116dfb32a65d402f877a SHA512 dbdbc31b7a231c963788b37cf1a138e30336466fb662225a812faaf58e45439925d9d39346cc8f07e54f22040c2f142435acb9fded315d33e24930e0abc736c7

View File

@ -1,58 +0,0 @@
From 8cf58abef12e61f369af3f583af349b0e086ba27 Mon Sep 17 00:00:00 2001
From: Eli Schwartz <eschwartz@gentoo.org>
Date: Sun, 20 Oct 2024 15:18:55 -0400
Subject: [PATCH] meson: correctly test for setnetgrent return type
meson doesn't automatically add all project arguments to configure
checks -- nor incrementally the inline value of all configuration_data
entries.
But that meant it was missing -D_GNU_SOURCE, as well as a define added
to config.h itself. As a result, this check failed to detect the
necessary function definition and failed to link.
```
Command line: `gcc-14 /var/tmp/portage/sys-auth/polkit-125/work/polkit-125-build/meson-private/tmpj0ih4pm4/testfile.c -o /var/tmp/portage/sys-auth/polkit-125/work/polkit-125-build/meson-private/tmpj0ih4pm4/output.obj -c -pipe -march=native -fstack-protector-all -O2 -fdiagnostics-color=always -frecord-gcc-switches -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wformat -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Werror=int-conversion -Werror=incompatible-pointer-types -D_FILE_OFFSET_BITS=64 -O0 -std=c99` -> 1
stderr:
/var/tmp/portage/sys-auth/polkit-125/work/polkit-125-build/meson-private/tmpj0ih4pm4/testfile.c: In function 'main':
/var/tmp/portage/sys-auth/polkit-125/work/polkit-125-build/meson-private/tmpj0ih4pm4/testfile.c:9:17: error: implicit declaration of function 'setnetgrent'; did you mean 'setnetent'? [-Wimplicit-function-declaration]
9 | int r = setnetgrent (NULL);
| ^~~~~~~~~~~
| setnetent
-----------
Checking if "setnetgrent return support" compiles: NO
```
Bug: https://bugs.gentoo.org/938870
Signed-off-by: Eli Schwartz <eschwartz@gentoo.org>
---
meson.build | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/meson.build b/meson.build
index 0800c88..a0b440d 100644
--- a/meson.build
+++ b/meson.build
@@ -159,7 +159,8 @@ host_system = host_machine.system()
config_data.set('HAVE_' + host_system.to_upper(), true)
# Check whether setnetgrent has a return value
-config_data.set('HAVE_NETGROUP_H', cc.has_header('netgroup.h'))
+have_netgroup_h = cc.has_header('netgroup.h')
+config_data.set('HAVE_NETGROUP_H', have_netgroup_h)
if config_data.get('HAVE_SETNETGRENT', false)
setnetgrent_return_src = '''
@@ -174,7 +175,11 @@ if config_data.get('HAVE_SETNETGRENT', false)
};
'''
- config_data.set('HAVE_SETNETGRENT_RETURN', cc.compiles(setnetgrent_return_src, name: 'setnetgrent return support'))
+ args = ['-D_GNU_SOURCE']
+ if have_netgroup_h
+ args += '-DHAVE_NETGROUP_H'
+ endif
+ config_data.set('HAVE_SETNETGRENT_RETURN', cc.compiles(setnetgrent_return_src, args: args, name: 'setnetgrent return support'))
endif
# Select wether to use logind, elogind or ConsoleKit for session tracking

View File

@ -1,111 +0,0 @@
https://bugs.gentoo.org/925440
https://github.com/polkit-org/polkit/commit/0d78d1e4bf5ab3ce11678005b220aac0cfc5bee5
From: Vincent Mihalkovic <vmihalko@redhat.com>
Date: Fri, 8 Mar 2024 14:04:33 +0100
Subject: [PATCH 3/3] mocklibc: move the print_indent function to the file
where it is used
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This fixes build error with GCC >= 14 and clang >= 17,
failing on:
```
../subprojects/mocklibc-1.0/src/netgroup-debug.c:25:3: error: implicit declaration of function print_indent [-Wimplicit-function-declaration]
25 | print_indent(stream, indent);
| ^~~~~~~~~~~~
```
Closes: #6
---
subprojects/mocklibc.wrap | 2 +
.../packagefiles/mocklibc-print-indent.diff | 68 +++++++++++++++++++
2 files changed, 70 insertions(+)
create mode 100644 subprojects/packagefiles/mocklibc-print-indent.diff
diff --git a/subprojects/mocklibc.wrap b/subprojects/mocklibc.wrap
index af82298..539ee83 100644
--- a/subprojects/mocklibc.wrap
+++ b/subprojects/mocklibc.wrap
@@ -8,3 +8,5 @@ source_hash = b2236a6af1028414783e9734a46ea051916ec226479d6a55a3bb823bff68f120
patch_url = https://wrapdb.mesonbuild.com/v1/projects/mocklibc/1.0/2/get_zip
patch_filename = mocklibc-1.0-2-wrap.zip
patch_hash = 0280f96a2eeb3c023e5acf4e00cef03d362868218d4a85347ea45137c0ef6c56
+
+diff_files = mocklibc-print-indent.diff
diff --git a/subprojects/packagefiles/mocklibc-print-indent.diff b/subprojects/packagefiles/mocklibc-print-indent.diff
new file mode 100644
index 0000000..d8b2029
--- /dev/null
+++ b/subprojects/packagefiles/mocklibc-print-indent.diff
@@ -0,0 +1,68 @@
+From: Vincent Mihalkovic <vmihalko@redhat.com>
+Date: Fri, 8 Mar 2024 14:04:33 +0100
+Subject: [PATCH 3/3] mocklibc: move the print_indent function to the file
+ where it is used
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This fixes build error with GCC >= 14 and clang >= 17,
+failing on:
+```
+../subprojects/mocklibc-1.0/src/netgroup-debug.c:25:3: error: implicit declaration of function print_indent [-Wimplicit-function-declaration]
+ 25 | print_indent(stream, indent);
+ | ^~~~~~~~~~~~
+```
+
+Closes: #6
+---
+ src/netgroup-debug.c | 11 +++++++++++
+ src/netgroup.c | 11 -----------
+ 2 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/src/netgroup-debug.c b/src/netgroup-debug.c
+index 81d6e72..46e5b25 100644
+--- a/src/netgroup-debug.c
++++ b/src/netgroup-debug.c
+@@ -21,6 +21,17 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+
++/**
++ * Print a varaible indentation to the stream.
++ * @param stream Stream to print to
++ * @param indent Number of indents to use
++ */
++static void print_indent(FILE *stream, unsigned int indent) {
++ int i;
++ for (i = 0; i < indent; i++)
++ fprintf(stream, " ");
++}
++
+ void netgroup_debug_print_entry(struct entry *entry, FILE *stream, unsigned int indent) {
+ print_indent(stream, indent);
+
+diff --git a/src/netgroup.c b/src/netgroup.c
+index 06a8a89..e16e451 100644
+--- a/src/netgroup.c
++++ b/src/netgroup.c
+@@ -71,17 +71,6 @@ static char *parser_copy_word(char **cur) {
+ return result;
+ }
+
+-/**
+- * Print a varaible indentation to the stream.
+- * @param stream Stream to print to
+- * @param indent Number of indents to use
+- */
+-void print_indent(FILE *stream, unsigned int indent) {
+- int i;
+- for (i = 0; i < indent; i++)
+- fprintf(stream, " ");
+-}
+-
+ /**
+ * Connect entries with 'child' type to their child entries.
+ * @param headentry Head of list of entries that need to be connected
+--
+2.43.0
--

View File

@ -1,28 +0,0 @@
https://bugs.gentoo.org/922458
https://github.com/polkit-org/polkit/pull/417/files#r1458416421
--- a/meson.build
+++ b/meson.build
@@ -212,14 +212,17 @@ if enable_logind
config_h.set10('HAVE_' + func.to_upper(), cc.has_function(func, dependencies: logind_dep))
# systemd unit / service files
- systemd_dep = dependency('systemd', not_found_message: 'systemd required but not found, please provide a valid systemd user unit dir or disable it')
systemd_systemdsystemunitdir = get_option('systemdsystemunitdir')
- if systemd_systemdsystemunitdir == '' and session_tracking == 'libsystemd-login'
- # FIXME: systemd.pc file does not use variables with relative paths, so `define_variable` cannot be used
- systemd_systemdsystemunitdir = systemd_dep.get_pkgconfig_variable('systemdsystemunitdir')
- endif
+ if session_tracking == 'libsystemd-login'
+ systemd_dep = dependency('systemd', not_found_message: 'systemd required but not found, please provide a valid systemd user unit dir or disable it')
- systemd_sysusers_dir = systemd_dep.get_pkgconfig_variable('sysusers_dir', default: '/usr/lib/sysusers.d')
+ if systemd_systemdsystemunitdir == ''
+ # FIXME: systemd.pc file does not use variables with relative paths, so `define_variable` cannot be used
+ systemd_systemdsystemunitdir = systemd_dep.get_pkgconfig_variable('systemdsystemunitdir')
+ endif
+
+ systemd_sysusers_dir = systemd_dep.get_pkgconfig_variable('sysusers_dir', default: '/usr/lib/sysusers.d')
+ endif
endif
config_h.set('HAVE_LIBSYSTEMD', enable_logind)

View File

@ -1,50 +0,0 @@
https://github.com/polkit-org/polkit/pull/417
From 69d6b94d590b4dd1fbbac22b4f4d449f46ef61aa Mon Sep 17 00:00:00 2001
From: Luca Boccassi <bluca@debian.org>
Date: Thu, 18 Jan 2024 15:07:32 +0000
Subject: [PATCH] meson: fix build failure when -Dsystemdsystemunitdir is
specified
When 'systemdsystemunitdir' is specified as an option the systemd_dep
variable is not defined, but the sysusers.d directory lookup uses it,
causing a build failure:
dh_auto_configure -- \
-Dexamples=false \
-Dintrospection=true \
-Dman=true \
-Dsystemdsystemunitdir=/usr/lib/systemd/system \
-Dtests=true \
-Dgtk_doc=true -Dsession_tracking=libsystemd-login
cd obj-x86_64-linux-gnu && DEB_PYTHON_INSTALL_LAYOUT=deb LC_ALL=C.UTF-8 meson setup .. --wrap-mode=nodownload --buildtype=plain --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=lib/x86_64-linux-gnu -Dpython.bytecompile=-1 -Dexamples=false -Dintrospection=true -Dman=true -Dsystemdsystemunitdir=/usr/lib/systemd/system -Dtests=true -Dgtk_doc=true -Dsession_tracking=libsystemd-login
The Meson build system
Version: 1.3.1
Source dir: /builds/bluca/polkit/debian/output/source_dir
Build dir: /builds/bluca/polkit/debian/output/source_dir/obj-x86_64-linux-gnu
Build type: native build
Project name: polkit
Project version: 124
<...>
Run-time dependency libsystemd found: YES 255
Checking for function "sd_uid_get_display" with dependency libsystemd: YES
Checking for function "sd_pidfd_get_session" with dependency libsystemd: YES
../meson.build:222:37: ERROR: Unknown variable "systemd_dep".
Follow-up for 24f1e0af3f7bd17e220cb96201f3c654e737ad34
--- a/meson.build
+++ b/meson.build
@@ -212,9 +212,9 @@ if enable_logind
config_h.set10('HAVE_' + func.to_upper(), cc.has_function(func, dependencies: logind_dep))
# systemd unit / service files
+ systemd_dep = dependency('systemd', not_found_message: 'systemd required but not found, please provide a valid systemd user unit dir or disable it')
systemd_systemdsystemunitdir = get_option('systemdsystemunitdir')
if systemd_systemdsystemunitdir == '' and session_tracking == 'libsystemd-login'
- systemd_dep = dependency('systemd', not_found_message: 'systemd required but not found, please provide a valid systemd user unit dir or disable it')
# FIXME: systemd.pc file does not use variables with relative paths, so `define_variable` cannot be used
systemd_systemdsystemunitdir = systemd_dep.get_pkgconfig_variable('systemdsystemunitdir')
endif

View File

@ -1,34 +0,0 @@
https://github.com/polkit-org/polkit/commit/13bea3e08f924002a6a5c2f275d4bf1588fc3d02
From 13bea3e08f924002a6a5c2f275d4bf1588fc3d02 Mon Sep 17 00:00:00 2001
From: Sertonix <sertonix@posteo.net>
Date: Sun, 11 Aug 2024 00:26:51 +0200
Subject: [PATCH] Fix missing arguments with HAVE_PTHREAD_CONDATTR_SETCLOCK
Fixes <64f5e4dda52> Add syslog-style log levels support
--- a/src/polkitbackend/polkitbackendduktapeauthority.c
+++ b/src/polkitbackend/polkitbackendduktapeauthority.c
@@ -767,12 +767,14 @@ runaway_killer_common(PolkitBackendJsAuthority *authority, RunawayKillerCtx *ctx
#ifdef HAVE_PTHREAD_CONDATTR_SETCLOCK
if ((pthread_err = pthread_condattr_init(&attr))) {
polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
+ LOG_LEVEL_ERROR,
"Error initializing condition variable attributes: %s",
strerror(pthread_err));
return FALSE;
}
if ((pthread_err = pthread_condattr_setclock(&attr, PK_CLOCK))) {
polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
+ LOG_LEVEL_ERROR,
"Error setting condition variable attributes: %s",
strerror(pthread_err));
goto err_clean_condattr;
@@ -780,6 +782,7 @@ runaway_killer_common(PolkitBackendJsAuthority *authority, RunawayKillerCtx *ctx
/* Init again, with needed attr */
if ((pthread_err = pthread_cond_init(&ctx->cond, &attr))) {
polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
+ LOG_LEVEL_ERROR,
"Error initializing condition variable: %s",
strerror(pthread_err));
goto err_clean_condattr;

View File

@ -5,8 +5,6 @@
<email>freedesktop-bugs@gentoo.org</email>
</maintainer>
<use>
<flag name="daemon">Build polkitd in addition to libpolkit.</flag>
<flag name="duktape">Use <pkg>dev-lang/duktape</pkg> instead of <pkg>dev-lang/spidermonkey</pkg> as JavaScript engine</flag>
<flag name="systemd">Use <pkg>sys-apps/systemd</pkg> for session tracking</flag>
</use>
<upstream>

View File

@ -3,7 +3,7 @@
EAPI=8
PYTHON_COMPAT=( python3_{10..11} )
PYTHON_COMPAT=( python3_11 )
inherit meson pam pax-utils python-any-r1 systemd xdg-utils
DESCRIPTION="Policy framework for controlling privileges for system-wide services"

View File

@ -1,156 +0,0 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..12} )
inherit meson pam pax-utils python-any-r1 systemd xdg-utils
DESCRIPTION="Policy framework for controlling privileges for system-wide services"
HOMEPAGE="https://www.freedesktop.org/wiki/Software/polkit https://github.com/polkit-org/polkit"
if [[ ${PV} == *_p* ]] ; then
# Upstream don't make releases very often. Test snapshots throughly
# and review commits, but don't shy away if there's useful stuff there
# we want.
MY_COMMIT=""
SRC_URI="https://gitlab.freedesktop.org/polkit/polkit/-/archive/${MY_COMMIT}/polkit-${MY_COMMIT}.tar.bz2 -> ${P}.tar.bz2"
S="${WORKDIR}"/${PN}-${MY_COMMIT}
else
SRC_URI="https://gitlab.freedesktop.org/polkit/polkit/-/archive/${PV}/${P}.tar.bz2"
fi
LICENSE="LGPL-2"
SLOT="0"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~s390 sparc x86"
IUSE="+daemon +duktape examples gtk +introspection kde pam selinux systemd test"
RESTRICT="!test? ( test )"
BDEPEND="
acct-user/polkitd
app-text/docbook-xml-dtd:4.1.2
app-text/docbook-xsl-stylesheets
dev-libs/glib
dev-libs/gobject-introspection-common
dev-libs/libxslt
dev-util/glib-utils
sys-devel/gettext
virtual/pkgconfig
introspection? ( >=dev-libs/gobject-introspection-0.6.2 )
test? (
$(python_gen_any_dep '
dev-python/dbus-python[${PYTHON_USEDEP}]
dev-python/python-dbusmock[${PYTHON_USEDEP}]
')
)
"
DEPEND="
>=dev-libs/glib-2.32:2
dev-libs/expat
daemon? (
duktape? ( dev-lang/duktape:= )
!duktape? ( dev-lang/spidermonkey:115[-debug] )
)
pam? (
sys-auth/pambase
sys-libs/pam
)
!pam? ( virtual/libcrypt:= )
systemd? ( sys-apps/systemd:0=[policykit] )
!systemd? ( sys-auth/elogind )
"
RDEPEND="
${DEPEND}
acct-user/polkitd
selinux? ( sec-policy/selinux-policykit )
"
PDEPEND="
gtk? ( || (
>=gnome-extra/polkit-gnome-0.105
>=lxde-base/lxsession-0.5.2
) )
kde? ( kde-plasma/polkit-kde-agent )
"
DOCS=( docs/TODO HACKING.md NEWS.md README.md )
QA_MULTILIB_PATHS="
usr/lib/polkit-1/polkit-agent-helper-1
usr/lib/polkit-1/polkitd
"
PATCHES=(
"${FILESDIR}"/${PN}-124-systemd.patch
"${FILESDIR}"/${PN}-124-systemd-fixup.patch
"${FILESDIR}"/${PN}-124-c99-fixes.patch
)
python_check_deps() {
python_has_version "dev-python/dbus-python[${PYTHON_USEDEP}]" &&
python_has_version "dev-python/python-dbusmock[${PYTHON_USEDEP}]"
}
pkg_setup() {
use test && python-any-r1_pkg_setup
}
src_prepare() {
default
# bug #401513
sed -i -e 's|unix-group:wheel|unix-user:0|' src/polkitbackend/*-default.rules || die
}
src_configure() {
xdg_environment_reset
local emesonargs=(
--localstatedir="${EPREFIX}"/var
-Dauthfw="$(usex pam pam shadow)"
-Dexamples=false
-Dgtk_doc=false
-Dman=true
-Dos_type=gentoo
-Dsession_tracking="$(usex systemd libsystemd-login libelogind)"
-Dsystemdsystemunitdir="$(systemd_get_systemunitdir)"
-Djs_engine=$(usex duktape duktape mozjs)
$(meson_use !daemon libs-only)
$(meson_use introspection)
$(meson_use test tests)
$(usex pam "-Dpam_module_dir=$(getpam_mod_dir)" '')
)
meson_src_configure
}
src_compile() {
meson_src_compile
# Required for polkitd on hardened/PaX due to spidermonkey's JIT
pax-mark mr src/polkitbackend/.libs/polkitd test/polkitbackend/.libs/polkitbackendjsauthoritytest
}
src_install() {
meson_src_install
# acct-user/polkitd installs its own (albeit with a different filename)
rm -rf "${ED}"/usr/lib/sysusers.d || die
if use examples ; then
docinto examples
dodoc src/examples/{*.c,*.policy*}
fi
if use daemon; then
if [[ ${EUID} == 0 ]]; then
diropts -m 0700 -o polkitd
fi
keepdir /etc/polkit-1/rules.d
fi
}
pkg_postinst() {
if use daemon && [[ ${EUID} == 0 ]]; then
chmod 0700 "${EROOT}"/{etc,usr/share}/polkit-1/rules.d
chown polkitd "${EROOT}"/{etc,usr/share}/polkit-1/rules.d
fi
}

View File

@ -1,159 +0,0 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..12} )
inherit meson pam pax-utils python-any-r1 systemd tmpfiles xdg-utils
DESCRIPTION="Policy framework for controlling privileges for system-wide services"
HOMEPAGE="https://www.freedesktop.org/wiki/Software/polkit https://github.com/polkit-org/polkit"
if [[ ${PV} == *_p* ]] ; then
# Upstream don't make releases very often. Test snapshots throughly
# and review commits, but don't shy away if there's useful stuff there
# we want.
MY_COMMIT=""
SRC_URI="https://github.com/polkit-org/polkit/archive/${MY_COMMIT}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}"/${PN}-${MY_COMMIT}
else
SRC_URI="https://github.com/polkit-org/polkit/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz"
fi
LICENSE="LGPL-2"
SLOT="0"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~s390 sparc x86"
IUSE="+daemon +duktape examples gtk +introspection kde pam selinux systemd test"
# Tests restricted b/c of permissions
RESTRICT="!test? ( test ) test"
BDEPEND="
acct-user/polkitd
app-text/docbook-xml-dtd:4.1.2
app-text/docbook-xsl-stylesheets
dev-libs/glib
dev-libs/gobject-introspection-common
dev-libs/libxslt
dev-util/glib-utils
sys-devel/gettext
virtual/pkgconfig
introspection? ( >=dev-libs/gobject-introspection-0.6.2 )
test? (
$(python_gen_any_dep '
dev-python/dbus-python[${PYTHON_USEDEP}]
dev-python/python-dbusmock[${PYTHON_USEDEP}]
')
)
"
DEPEND="
>=dev-libs/glib-2.32:2
dev-libs/expat
daemon? (
duktape? ( dev-lang/duktape:= )
!duktape? ( dev-lang/spidermonkey:115[-debug] )
)
pam? (
sys-auth/pambase
sys-libs/pam
)
!pam? ( virtual/libcrypt:= )
systemd? ( sys-apps/systemd:0=[policykit] )
!systemd? ( sys-auth/elogind )
"
RDEPEND="
${DEPEND}
acct-user/polkitd
selinux? ( sec-policy/selinux-policykit )
"
PDEPEND="
gtk? ( || (
>=gnome-extra/polkit-gnome-0.105
>=lxde-base/lxsession-0.5.2
) )
kde? ( kde-plasma/polkit-kde-agent )
"
DOCS=( docs/TODO HACKING.md NEWS.md README.md )
QA_MULTILIB_PATHS="
usr/lib/polkit-1/polkit-agent-helper-1
usr/lib/polkit-1/polkitd
"
PATCHES=(
"${FILESDIR}"/${P}-musl.patch
# fix incorrect feature detection
"${FILESDIR}"/8cf58abef12e61f369af3f583af349b0e086ba27.patch
)
python_check_deps() {
python_has_version "dev-python/dbus-python[${PYTHON_USEDEP}]" &&
python_has_version "dev-python/python-dbusmock[${PYTHON_USEDEP}]"
}
pkg_setup() {
use test && python-any-r1_pkg_setup
}
src_prepare() {
default
# bug #401513
sed -i -e 's|unix-group:wheel|unix-user:0|' src/polkitbackend/*-default.rules || die
}
src_configure() {
xdg_environment_reset
local emesonargs=(
--localstatedir="${EPREFIX}"/var
-Dauthfw="$(usex pam pam shadow)"
-Dexamples=false
-Dgtk_doc=false
-Dman=true
-Dos_type=gentoo
-Djs_engine=$(usex duktape duktape mozjs)
-Dpam_module_dir=$(getpam_mod_dir)
-Dsession_tracking="$(usex systemd logind elogind)"
-Dsystemdsystemunitdir="$(systemd_get_systemunitdir)"
$(meson_use !daemon libs-only)
$(meson_use introspection)
$(meson_use test tests)
)
meson_src_configure
}
src_compile() {
meson_src_compile
# Required for polkitd on hardened/PaX due to spidermonkey's JIT
pax-mark mr src/polkitbackend/.libs/polkitd test/polkitbackend/.libs/polkitbackendjsauthoritytest
}
src_install() {
meson_src_install
# acct-user/polkitd installs its own (albeit with a different filename)
rm -rf "${ED}"/usr/lib/sysusers.d || die
if use examples ; then
docinto examples
dodoc src/examples/{*.c,*.policy*}
fi
if use daemon; then
if [[ ${EUID} == 0 ]]; then
diropts -m 0700 -o polkitd
fi
keepdir /etc/polkit-1/rules.d
fi
}
pkg_postinst() {
tmpfiles_process polkit-tmpfiles.conf
if use daemon && [[ ${EUID} == 0 ]]; then
chmod 0700 "${EROOT}"/{etc,usr/share}/polkit-1/rules.d
chown polkitd "${EROOT}"/{etc,usr/share}/polkit-1/rules.d
fi
}

View File

@ -3,7 +3,7 @@
EAPI=8
PYTHON_COMPAT=( python3_{10..13} )
PYTHON_COMPAT=( python3_{11..13} )
inherit meson pam pax-utils python-any-r1 systemd tmpfiles xdg-utils
DESCRIPTION="Policy framework for controlling privileges for system-wide services"
@ -26,7 +26,7 @@ fi
LICENSE="LGPL-2"
SLOT="0"
if [[ ${PV} != 9999 ]] ; then
KEYWORDS="~alpha ~amd64 arm arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~s390 sparc x86"
fi
IUSE="examples gtk +introspection kde pam nls selinux systemd test"
RESTRICT="!test? ( test )"

View File

@ -1,160 +0,0 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..12} )
inherit meson pam pax-utils python-any-r1 systemd xdg-utils
DESCRIPTION="Policy framework for controlling privileges for system-wide services"
HOMEPAGE="https://www.freedesktop.org/wiki/Software/polkit https://github.com/polkit-org/polkit"
if [[ ${PV} == 9999 ]] ; then
EGIT_REPO_URI="https://github.com/polkit-org/polkit"
inherit git-r3
elif [[ ${PV} == *_p* ]] ; then
# Upstream don't make releases very often. Test snapshots throughly
# and review commits, but don't shy away if there's useful stuff there
# we want.
MY_COMMIT=""
SRC_URI="https://github.com/polkit-org/polkit/archive/${MY_COMMIT}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}"/${PN}-${MY_COMMIT}
else
SRC_URI="https://github.com/polkit-org/polkit/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz"
fi
LICENSE="LGPL-2"
SLOT="0"
if [[ ${PV} != 9999 ]] ; then
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
fi
IUSE="+daemon +duktape examples gtk +introspection kde pam selinux systemd test"
RESTRICT="!test? ( test )"
BDEPEND="
acct-user/polkitd
app-text/docbook-xml-dtd:4.1.2
app-text/docbook-xsl-stylesheets
dev-libs/glib
dev-libs/gobject-introspection-common
dev-libs/libxslt
dev-util/glib-utils
sys-devel/gettext
virtual/pkgconfig
introspection? ( >=dev-libs/gobject-introspection-0.6.2 )
test? (
$(python_gen_any_dep '
dev-python/dbus-python[${PYTHON_USEDEP}]
dev-python/python-dbusmock[${PYTHON_USEDEP}]
')
)
"
DEPEND="
>=dev-libs/glib-2.32:2
dev-libs/expat
daemon? (
duktape? ( dev-lang/duktape:= )
!duktape? ( dev-lang/spidermonkey:115[-debug] )
)
pam? (
sys-auth/pambase
sys-libs/pam
)
!pam? ( virtual/libcrypt:= )
systemd? ( sys-apps/systemd:0=[policykit] )
!systemd? ( sys-auth/elogind )
"
RDEPEND="
${DEPEND}
acct-user/polkitd
selinux? ( sec-policy/selinux-policykit )
"
PDEPEND="
gtk? ( || (
>=gnome-extra/polkit-gnome-0.105
>=lxde-base/lxsession-0.5.2
) )
kde? ( kde-plasma/polkit-kde-agent )
"
DOCS=( docs/TODO HACKING.md NEWS.md README.md )
QA_MULTILIB_PATHS="
usr/lib/polkit-1/polkit-agent-helper-1
usr/lib/polkit-1/polkitd
"
python_check_deps() {
python_has_version "dev-python/dbus-python[${PYTHON_USEDEP}]" &&
python_has_version "dev-python/python-dbusmock[${PYTHON_USEDEP}]"
}
pkg_setup() {
use test && python-any-r1_pkg_setup
}
src_prepare() {
default
# FIXME: Horrible hack to facilitate testing in bug #934314
patch -p1 -f < "${FILESDIR}"/${PN}-124-systemd.patch
patch -p1 -f < "${FILESDIR}"/${PN}-124-systemd-fixup.patch
patch -p1 -f < "${FILESDIR}"/${PN}-124-c99-fixes.patch
sed -i -e "s:dependency('systemd':dependency('libelogind':" meson.build || die
sed -i -e 's|unix-group:wheel|unix-user:0|' src/polkitbackend/*-default.rules || die
}
src_configure() {
xdg_environment_reset
local emesonargs=(
--localstatedir="${EPREFIX}"/var
-Dauthfw="$(usex pam pam shadow)"
-Dexamples=false
-Dgtk_doc=false
-Dman=true
-Dos_type=gentoo
-Dsession_tracking="$(usex systemd libsystemd-login libelogind)"
-Dsystemdsystemunitdir="$(systemd_get_systemunitdir)"
-Djs_engine=$(usex duktape duktape mozjs)
$(meson_use !daemon libs-only)
$(meson_use introspection)
$(meson_use test tests)
$(usex pam "-Dpam_module_dir=$(getpam_mod_dir)" '')
)
meson_src_configure
}
src_compile() {
meson_src_compile
# Required for polkitd on hardened/PaX due to spidermonkey's JIT
pax-mark mr src/polkitbackend/.libs/polkitd test/polkitbackend/.libs/polkitbackendjsauthoritytest
}
src_install() {
meson_src_install
# acct-user/polkitd installs its own (albeit with a different filename)
rm -rf "${ED}"/usr/lib/sysusers.d || die
if use examples ; then
docinto examples
dodoc src/examples/{*.c,*.policy*}
fi
if use daemon; then
if [[ ${EUID} == 0 ]]; then
diropts -m 0700 -o polkitd
fi
keepdir /etc/polkit-1/rules.d
fi
}
pkg_postinst() {
if use daemon && [[ ${EUID} == 0 ]]; then
chmod 0700 "${EROOT}"/{etc,usr/share}/polkit-1/rules.d
chown polkitd "${EROOT}"/{etc,usr/share}/polkit-1/rules.d
fi
}

View File

@ -3,7 +3,7 @@
EAPI=8
PYTHON_COMPAT=( python3_{10..13} )
PYTHON_COMPAT=( python3_{11..13} )
inherit meson pam pax-utils python-any-r1 systemd tmpfiles xdg-utils
DESCRIPTION="Policy framework for controlling privileges for system-wide services"
@ -81,12 +81,6 @@ QA_MULTILIB_PATHS="
usr/lib/polkit-1/polkitd
"
PATCHES=(
"${FILESDIR}"/${P}-elogind.patch
"${FILESDIR}"/${P}-realpath.patch
"${FILESDIR}"/${P}-musl.patch
)
python_check_deps() {
python_has_version "dev-python/dbus-python[${PYTHON_USEDEP}]" &&
python_has_version "dev-python/python-dbusmock[${PYTHON_USEDEP}]"