commit:     630364c519d028de3192f87ccc1fd7f75cac696f
Author:     Alfred Persson Forsberg <cat <AT> catcream <DOT> org>
AuthorDate: Sun Aug 14 20:27:44 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Aug 14 21:33:43 2022 +0000
URL:        https://gitweb.gentoo.org/proj/musl.git/commit/?id=630364c5

sys-apps/accountservice: sync with ::gentoo

This is a temporary fix for fgetspent_r. A rewrite should be done and
put into ::gentoo.

Signed-off-by: Alfred Persson Forsberg <cat <AT> catcream.org>
Closes: https://github.com/gentoo/musl/pull/472
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-apps/accountsservice/Manifest                  |  2 +-
 ....6.55.ebuild => accountsservice-22.08.8.ebuild} | 43 ++++++++++--------
 .../accountsservice-0.6.50-loaded-state.patch      | 36 ---------------
 .../accountsservice-0.6.55-meson-0.61-build.patch  | 23 ----------
 ...untsservice-22.04.62-gentoo-system-users.patch} | 35 ++++++++------
 .../accountsservice-22.08.8-check-for-wtmp.patch   | 41 +++++++++++++++++
 .../accountsservice-22.08.8-fgetspent_r-musl.patch | 53 ++++++++++++++++++++++
 .../accountsservice/files/musl-fgetspent_r.patch   | 35 --------------
 sys-apps/accountsservice/files/musl-wtmp.patch     | 14 ------
 9 files changed, 140 insertions(+), 142 deletions(-)

diff --git a/sys-apps/accountsservice/Manifest 
b/sys-apps/accountsservice/Manifest
index d02ee748..0e7fae0f 100644
--- a/sys-apps/accountsservice/Manifest
+++ b/sys-apps/accountsservice/Manifest
@@ -1 +1 @@
-DIST accountsservice-0.6.55.tar.xz 97972 BLAKE2B 
aba3adfeb53e64455ce8e672b9db754bae4af6b4de0823cc021d0311a381ec40af04371e78f7c84eab7fb72356b26e22db78aad0343d57f65ea71a7742b51fc7
 SHA512 
c12e6a8e80f9b087f97238da4734d2d3a14a7c5cbd870a32a04b00116f176c818c39fb886f6dc72c3e93c136b0c2074ddf8f77e20431fa3bd54f138bea9d262d
+DIST accountsservice-22.08.8.tar.xz 102672 BLAKE2B 
7c9436d3845fc1883772b434c4f9e2fba934d17e6d4452a6be65e1d790a23b331eaaa64b0e6eff6fefe79587a40cf1749a0f3de09f323b10740046bd9d145c9d
 SHA512 
2ca3ceb1b44338d9924b86788256d4eef7ec10e0c2197bfb8cc6c31ae224fab3051f03cb406a526f90057684965bef4ba0f2cc01b26198ec1fc6baec36ad3ff8

diff --git a/sys-apps/accountsservice/accountsservice-0.6.55.ebuild 
b/sys-apps/accountsservice/accountsservice-22.08.8.ebuild
similarity index 64%
rename from sys-apps/accountsservice/accountsservice-0.6.55.ebuild
rename to sys-apps/accountsservice/accountsservice-22.08.8.ebuild
index e1ebb8c4..c9f501af 100644
--- a/sys-apps/accountsservice/accountsservice-0.6.55.ebuild
+++ b/sys-apps/accountsservice/accountsservice-22.08.8.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 2011-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
-
-inherit meson systemd
+PYTHON_COMPAT=( python3_{8..10} )
+inherit meson python-any-r1 systemd
 
 DESCRIPTION="D-Bus interfaces for querying and manipulating user account 
information"
 HOMEPAGE="https://www.freedesktop.org/wiki/Software/AccountsService/";
@@ -11,13 +11,14 @@ 
SRC_URI="https://www.freedesktop.org/software/${PN}/${P}.tar.xz";
 
 LICENSE="GPL-3+"
 SLOT="0"
-KEYWORDS="~alpha amd64 arm arm64 ~ia64 ppc ppc64 ~sparc x86"
+KEYWORDS="~alpha amd64 arm arm64 ~ia64 ~loong ppc ppc64 ~riscv ~sparc x86"
 
-IUSE="doc elogind gtk-doc +introspection selinux systemd"
+IUSE="doc elogind gtk-doc +introspection selinux systemd test"
+RESTRICT="!test? ( test )"
 REQUIRED_USE="^^ ( elogind systemd )"
 
 CDEPEND="
-       >=dev-libs/glib-2.44:2
+       >=dev-libs/glib-2.63.5:2
        sys-auth/polkit
        virtual/libcrypt:=
        elogind? ( >=sys-auth/elogind-229.4 )
@@ -32,29 +33,32 @@ BDEPEND="
        virtual/pkgconfig
        doc? (
                app-text/docbook-xml-dtd:4.1.2
-               app-text/xmlto )
+               app-text/xmlto
+       )
        gtk-doc? (
                dev-util/gtk-doc
-               app-text/docbook-xml-dtd:4.3 )
+               app-text/docbook-xml-dtd:4.3
+       )
+       test? (
+               $(python_gen_any_dep '
+                       dev-python/python-dbusmock[${PYTHON_USEDEP}]
+               ')
+       )
 "
 RDEPEND="${CDEPEND}
        selinux? ( sec-policy/selinux-accountsd )
 "
 
 PATCHES=(
-       "${FILESDIR}"/${PN}-0.6.35-gentoo-system-users.patch
-       "${FILESDIR}"/${PN}-0.6.55-meson-0.61-build.patch
+       "${FILESDIR}"/${PN}-22.04.62-gentoo-system-users.patch
+       "${FILESDIR}"/${PN}-22.08.8-check-for-wtmp.patch
+       "${FILESDIR}"/${PN}-22.08.8-fgetspent_r-musl.patch
 )
 
-src_prepare() {
-       default
-
-       if use elibc_musl ; then
-               eapply "${FILESDIR}/musl-fgetspent_r.patch"
-               eapply "${FILESDIR}/musl-wtmp.patch"
+python_check_deps() {
+       if use test; then
+               has_version "dev-python/python-dbusmock[${PYTHON_USEDEP}]"
        fi
-
-       eapply_user
 }
 
 src_configure() {
@@ -62,11 +66,12 @@ src_configure() {
                --localstatedir="${EPREFIX}/var"
                -Dsystemdsystemunitdir="$(systemd_get_systemunitdir)"
                -Dadmin_group="wheel"
-               $(meson_use systemd)
+               -Dcheck_wtmp="$(usex !elibc_musl true false)"
                $(meson_use elogind)
                $(meson_use introspection)
                $(meson_use doc docbook)
                $(meson_use gtk-doc gtk_doc)
+               -Dvapi=false
        )
        meson_src_configure
 }

diff --git 
a/sys-apps/accountsservice/files/accountsservice-0.6.50-loaded-state.patch 
b/sys-apps/accountsservice/files/accountsservice-0.6.50-loaded-state.patch
deleted file mode 100644
index 901704bc..00000000
--- a/sys-apps/accountsservice/files/accountsservice-0.6.50-loaded-state.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From c7fa612023a163e8b2352e1170c6df3fceb19b27 Mon Sep 17 00:00:00 2001
-From: Ray Strode <rstr...@redhat.com>
-Date: Thu, 19 Jul 2018 13:14:09 -0400
-Subject: lib: don't set loaded state until seat is fetched
-
-At the moment we set is-loaded on the user-manager
-object as soon as we start fetching the seat, but
-we should waiting until the seat is fetched, so
-that can_switch() will return the correct value
-if the caller waited until the loaded signal
-to use it.
-
-This commit changes the >= to > which I believe
-was the original intention anyway.
-
-https://bugs.freedesktop.org/show_bug.cgi?id=107298
----
- src/libaccountsservice/act-user-manager.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/libaccountsservice/act-user-manager.c 
b/src/libaccountsservice/act-user-manager.c
-index 325421b..e7e26b1 100644
---- a/src/libaccountsservice/act-user-manager.c
-+++ b/src/libaccountsservice/act-user-manager.c
-@@ -2382,7 +2382,7 @@ maybe_set_is_loaded (ActUserManager *manager)
-         /* Don't set is_loaded yet unless the seat is already loaded enough
-          * or failed to load.
-          */
--        if (manager->priv->seat.state >= ACT_USER_MANAGER_SEAT_STATE_GET_ID) {
-+        if (manager->priv->seat.state > ACT_USER_MANAGER_SEAT_STATE_GET_ID) {
-                 g_debug ("ActUserManager: Seat loaded, so now setting loaded 
property");
-         } else if (manager->priv->seat.state == 
ACT_USER_MANAGER_SEAT_STATE_UNLOADED) {
-                 g_debug ("ActUserManager: Seat wouldn't load, so giving up on 
it and setting loaded property");
--- 
-cgit v1.1
-

diff --git 
a/sys-apps/accountsservice/files/accountsservice-0.6.55-meson-0.61-build.patch 
b/sys-apps/accountsservice/files/accountsservice-0.6.55-meson-0.61-build.patch
deleted file mode 100644
index d56f4b7e..00000000
--- 
a/sys-apps/accountsservice/files/accountsservice-0.6.55-meson-0.61-build.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-https://gitlab.freedesktop.org/accountsservice/accountsservice/-/commit/ac9b14f1c1bbca413987d0bbfeaad05804107e9a.patch
-https://bugs.gentoo.org/831465
-
-From: Luca Boccassi <bl...@debian.org>
-Date: Sun, 31 Oct 2021 12:29:14 +0000
-Subject: [PATCH] Fix build with meson 0.60
-
-Positional parameters to merge_file() were never allowed and always
-ignored, so just drop it.
-See: https://github.com/mesonbuild/meson/issues/9441
-
-Fixes #97
---- a/data/meson.build
-+++ b/data/meson.build
-@@ -33,7 +33,6 @@ configure_file(
- policy = act_namespace.to_lower() + '.policy'
- 
- i18n.merge_file(
--  policy,
-   input: policy + '.in',
-   output: policy,
-   po_dir: po_dir,
-GitLab

diff --git 
a/sys-apps/accountsservice/files/accountsservice-0.6.35-gentoo-system-users.patch
 
b/sys-apps/accountsservice/files/accountsservice-22.04.62-gentoo-system-users.patch
similarity index 56%
rename from 
sys-apps/accountsservice/files/accountsservice-0.6.35-gentoo-system-users.patch
rename to 
sys-apps/accountsservice/files/accountsservice-22.04.62-gentoo-system-users.patch
index 39ebf42e..d65fa2f8 100644
--- 
a/sys-apps/accountsservice/files/accountsservice-0.6.35-gentoo-system-users.patch
+++ 
b/sys-apps/accountsservice/files/accountsservice-22.04.62-gentoo-system-users.patch
@@ -1,9 +1,22 @@
---- a/src/user-classify.c.old  2013-12-04 20:29:48.944454769 +0100
-+++ b/src/user-classify.c      2013-12-04 20:32:59.728283477 +0100
-@@ -55,6 +55,48 @@
+From 0db673b94a6031640ae5faa3b79c4a1fea078350 Mon Sep 17 00:00:00 2001
+From: Matt Turner <matts...@gmail.com>
+Date: Sun, 30 Jan 2022 12:00:09 -0800
+Subject: [PATCH] Add more users
+
+---
+ src/user-classify.c | 35 ++++++++++++++++++++++++++++++++++-
+ 1 file changed, 34 insertions(+), 1 deletion(-)
+
+diff --git a/src/user-classify.c b/src/user-classify.c
+index 9224905..70f1877 100644
+--- a/src/user-classify.c
++++ b/src/user-classify.c
+@@ -52,7 +52,40 @@ static const char *default_excludes[] = {
          "at",
          "gdm",
-         "gnome-initial-setup"
+         "gnome-initial-setup",
+-        "git"
++        "git",
 +        /* Additional Gentoo system users with non-trivial login shell */
 +        "amanda",
 +        "backuppc",
@@ -12,15 +25,6 @@
 +        "flexlm",
 +        "foldingathome",
 +        "geneweb",
-+        "git",
-+        "gnump3d",
-+        "hacluster",
-+        "hg",
-+        "hsqldb",
-+        "infinote",
-+        "foldingathome",
-+        "geneweb",
-+        "git",
 +        "gnump3d",
 +        "hacluster",
 +        "hg",
@@ -48,4 +52,7 @@
 +        "vdradmin",
  };
  
- #define PATH_NOLOGIN "/sbin/nologin"
+ static gboolean
+-- 
+2.34.1
+

diff --git 
a/sys-apps/accountsservice/files/accountsservice-22.08.8-check-for-wtmp.patch 
b/sys-apps/accountsservice/files/accountsservice-22.08.8-check-for-wtmp.patch
new file mode 100644
index 00000000..c0363046
--- /dev/null
+++ 
b/sys-apps/accountsservice/files/accountsservice-22.08.8-check-for-wtmp.patch
@@ -0,0 +1,41 @@
+Adds a meson build option to check if wtmp path is valid.
+wtmp is not used on musl and is implemented with stubs because it is harmful 
software, and because of that, checking whether the path is valid or not does 
not matter.
+
+See: 
https://wiki.musl-libc.org/faq.html#Q:_Why_is_the_utmp/wtmp_functionality_only_implemented_as_stubs?
+https://bugs.gentoo.org/762442
+
+---
+ meson.build       | 4 +++-
+ meson_options.txt | 1 +
+ 2 files changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/meson.build b/meson.build
+index 075776f..0801659 100644
+--- a/meson.build
++++ b/meson.build
+@@ -102,7 +102,9 @@ elif cc.has_header_symbol('paths.h', '_PATH_WTMPX')
+   config_h.set('PATH_WTMP', '_PATH_WTMPX')
+ else
+   path_wtmp = '/var/log/utx.log'
+-  assert(run_command('test', '-e', path_wtmp).returncode() == 0, 'Do not know 
which filename to watch for wtmp changes')
++  if get_option('check_wtmp')
++    assert(run_command('test', '-e', path_wtmp).returncode() == 0, 'Do not 
know which filename to watch for wtmp changes')
++  endif
+   config_h.set_quoted('PATH_WTMP', path_wtmp)
+ endif
+ 
+diff --git a/meson_options.txt b/meson_options.txt
+index 93f384a..4fec12e 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -6,6 +6,7 @@ option('extra_admin_groups', type: 'array', value: [], 
description: 'Comma-separ
+ option('minimum_uid', type: 'integer', value: 1000, description: 'Set minimum 
uid for human users')
+ 
+ option('elogind', type: 'boolean', value: false, description: 'Use elogind')
++option('check_wtmp', type: 'boolean', value: true, description: 'Check if 
wtmp path is valid (musl workaround)')
+ 
+ option('introspection', type: 'boolean', value: true, description: 'Enable 
introspection for this build')
+ option('vapi', type: 'boolean', value: true, description : 'Enable Vala 
bindings for this build')
+-- 
+2.35.1
+

diff --git 
a/sys-apps/accountsservice/files/accountsservice-22.08.8-fgetspent_r-musl.patch 
b/sys-apps/accountsservice/files/accountsservice-22.08.8-fgetspent_r-musl.patch
new file mode 100644
index 00000000..180b14a2
--- /dev/null
+++ 
b/sys-apps/accountsservice/files/accountsservice-22.08.8-fgetspent_r-musl.patch
@@ -0,0 +1,53 @@
+Define fgetspent_r if not already defined. (GNU extension, therefore not in 
musl).
+
+https://git.alpinelinux.org/aports/tree/community/accountsservice/musl-fgetspent_r.patch
 (copied the function from here).
+diff -u b/src/daemon.c b/src/daemon.c
+--- b/src/daemon.c
++++ b/src/daemon.c
+@@ -32,7 +32,7 @@
+ #include <pwd.h>
+ #ifdef HAVE_SHADOW_H
+ #include <shadow.h>
+-#endif
++#endif // HAVE_SHADOW_H
+ #include <unistd.h>
+ #include <errno.h>
+ #include <sys/types.h>
+@@ -51,6 +51,25 @@
+ #include "user.h"
+ #include "accounts-user-generated.h"
+ 
++#ifndef HAVE_FGETSPENT_R
++static int fgetspent_r(FILE *fp, struct spwd *spbuf, char *buf, size_t 
buflen, struct spwd **spbufp) {
++       struct spwd *shadow_entry = fgetspent(fp);
++       if(!shadow_entry)
++               return -1;
++       size_t namplen = strlen(shadow_entry->sp_namp);
++       size_t pwdplen = strlen(shadow_entry->sp_pwdp);
++
++       if(namplen + pwdplen + 2 > buflen)
++               return -1;
++
++       *spbufp = memcpy(spbuf, shadow_entry, sizeof(struct spwd));
++       spbuf->sp_namp = strncpy(buf, shadow_entry->sp_namp, namplen + 1);
++       spbuf->sp_pwdp = strncpy(buf + namplen + 1, shadow_entry->sp_pwdp, 
pwdplen + 1);
++
++       return 0;
++}
++#endif // HAVE_FGETSPENT_R
++
+ #define PATH_PASSWD "/etc/passwd"
+ #define PATH_SHADOW "/etc/shadow"
+ #define PATH_GROUP "/etc/group"
+only in patch2:
+unchanged:
+--- a/meson.build
++++ b/meson.build
+@@ -71,6 +71,7 @@ check_functions = [
+   'getusershell',
+   'setutxdb',
+   'fgetpwent',
++  'fgetspent_r'
+ ]
+ 
+ foreach func: check_functions

diff --git a/sys-apps/accountsservice/files/musl-fgetspent_r.patch 
b/sys-apps/accountsservice/files/musl-fgetspent_r.patch
deleted file mode 100644
index 3b5cc803..00000000
--- a/sys-apps/accountsservice/files/musl-fgetspent_r.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From: https://git.alpinelinux.org/aports/tree/community/accountsservice
-
-diff --git a/src/daemon.c b/src/daemon.c
-index 312394a..e7b3c58 100644
---- a/src/daemon.c
-+++ b/src/daemon.c
-@@ -140,6 +140,28 @@ error_get_type (void)
- #define MAX_LOCAL_USERS 50
- #endif
- 
-+#ifndef __GLIBC__
-+ /* Musl libc does not support fgetspent_r(), write own
-+  * wrapper
-+  */
-+static int fgetspent_r(FILE *fp, struct spwd *spbuf, char *buf, size_t 
buflen, struct spwd **spbufp) {
-+       struct spwd *shadow_entry = fgetspent(fp);
-+       if(!shadow_entry)
-+               return -1;
-+       size_t namplen = strlen(shadow_entry->sp_namp);
-+       size_t pwdplen = strlen(shadow_entry->sp_pwdp);
-+
-+       if(namplen + pwdplen + 2 > buflen)
-+               return -1;
-+
-+       *spbufp = memcpy(spbuf, shadow_entry, sizeof(struct spwd));
-+       spbuf->sp_namp = strncpy(buf, shadow_entry->sp_namp, namplen + 1);
-+       spbuf->sp_pwdp = strncpy(buf + namplen + 1, shadow_entry->sp_pwdp, 
pwdplen + 1);
-+
-+       return 0;
-+}
-+#endif
-+
- static struct passwd *
- entry_generator_fgetpwent (Daemon       *daemon,
-                            GHashTable   *users,

diff --git a/sys-apps/accountsservice/files/musl-wtmp.patch 
b/sys-apps/accountsservice/files/musl-wtmp.patch
deleted file mode 100644
index c4d364bb..00000000
--- a/sys-apps/accountsservice/files/musl-wtmp.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-From: https://git.alpinelinux.org/aports/tree/community/accountsservice
-
---- a/meson.build
-+++ b/meson.build
-@@ -82,8 +82,7 @@ if cc.has_header_symbol('utmpx.h', 'WTMPX_FILENAME', prefix: 
'#define _GNU_SOURC
- elif cc.has_header_symbol('paths.h', '_PATH_WTMPX')
-   config_h.set('PATH_WTMP', '_PATH_WTMPX')
- else
--  assert(run_command('test', '-e', '/var/log/utx.log').returncode() == 0, 'Do 
not know which filename to watch for wtmp changes')
--  config_h.set_quoted('PATH_WTMP', '/var/log/utx.log')
-+  config_h.set_quoted('PATH_WTMP', '/var/log/wtmp')
- endif
- 
- # compiler flags

Reply via email to