Gentoo Archives: gentoo-dev

From: Conrad Kostecki <conikost@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] [PATCH] eclass/postgres.eclass: migrate to GLEP 81
Date: Thu, 22 Jul 2021 22:20:53
Message-Id: 20210722222041.702-1-conikost@gentoo.org
1 This update drops the function 'postgres_new_user', which was used to
2 create the 'postgres' user and group.
3
4 Additionally, this function accepted an argument to create a specified
5 user, which will be added to the 'postgres' group. This function is used
6 by exactly one package: dev-db/pgpool2.
7
8 With GLEP 81, such function is not needed anymore, as this can be easily
9 handled by the acct-* packages for dev-db/pgpool2.
10
11 Since many other packages depend on the 'postgres' and 'postgres-multi'
12 eclass, adding the core acct-*/postgres packages here to [R]DEPEND.
13
14 Before merging this eclass patch, acct-* packages will be added to
15 the tree. Afterwards, dev-db/pgpool2 will be migrated away from
16 'postgres_new_user'. After the eclass patch has been applied,
17 dev-db/postgres can be revbumped, so all users will get the acct-*
18 packages.
19
20 Signed-off-by: Conrad Kostecki <conikost@g.o>
21 ---
22 eclass/postgres.eclass | 31 +++++--------------------------
23 1 file changed, 5 insertions(+), 26 deletions(-)
24
25 diff --git a/eclass/postgres.eclass b/eclass/postgres.eclass
26 index 7652a862518..9b4097e0052 100644
27 --- a/eclass/postgres.eclass
28 +++ b/eclass/postgres.eclass
29 @@ -1,7 +1,6 @@
30 # Copyright 1999-2021 Gentoo Authors
31 # Distributed under the terms of the GNU General Public License v2
32
33 -inherit user
34 EXPORT_FUNCTIONS pkg_setup
35
36 # @ECLASS: postgres.eclass
37 @@ -119,31 +118,11 @@ postgres_check_slot() {
38 fi
39 }
40
41 -# @FUNCTION: postgres_new_user
42 -# @USAGE: [user [(uid|-1) [(shell|-1) [(homedir|-1) [groups]]]]]
43 -# @DESCRIPTION:
44 -# Creates the "postgres" system group and user -- which is separate from
45 -# the database user -- and, optionally, the developer defined user. There
46 -# are no required parameters.
47 -#
48 -# When given a user to create, it'll be created with the next available
49 -# uid, default shell set to /bin/false, default homedir is /dev/null,
50 -# and added to the "postgres" system group. You can use "-1" to skip any
51 -# parameter except user or groups.
52 -postgres_new_user() {
53 - enewgroup postgres 70
54 - enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
55 -
56 - if [[ $# -gt 0 ]] ; then
57 - if [[ "$1" = "postgres" ]] ; then
58 - ewarn "Username 'postgres' implied, skipping"
59 - else
60 - local groups=$5
61 - [[ -n "${groups}" ]] && groups+=",postgres" || groups="postgres"
62 - enewuser "$1" "${2:--1}" "${3:--1}" "${4:--1}" "${groups}"
63 - fi
64 - fi
65 -}
66 +RDEPEND="
67 + acct-group/postgres
68 + acct-user/postgres
69 +"
70 +DEPEND="${RDEPEND}"
71
72 # @FUNCTION: postgres_pkg_setup
73 # @DESCRIPTION:
74 --
75 2.32.0

Replies