public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] eclass/postgres.eclass: migrate to GLEP 81
@ 2021-07-22 22:20 Conrad Kostecki
  2021-07-22 22:35 ` Michael Orlitzky
  0 siblings, 1 reply; 2+ messages in thread
From: Conrad Kostecki @ 2021-07-22 22:20 UTC (permalink / raw
  To: gentoo-dev

This update drops the function 'postgres_new_user', which was used to
create the 'postgres' user and group.

Additionally, this function accepted an argument to create a specified
user, which will be added to the 'postgres' group. This function is used
by exactly one package: dev-db/pgpool2.

With GLEP 81, such function is not needed anymore, as this can be easily
handled by the acct-* packages for dev-db/pgpool2.

Since many other packages depend on the 'postgres' and 'postgres-multi'
eclass, adding the core acct-*/postgres packages here to [R]DEPEND.

Before merging this eclass patch, acct-* packages will be added to
the tree. Afterwards, dev-db/pgpool2 will be migrated away from
'postgres_new_user'. After the eclass patch has been applied,
dev-db/postgres can be revbumped, so all users will get the acct-*
packages.

Signed-off-by: Conrad Kostecki <conikost@gentoo.org>
---
 eclass/postgres.eclass | 31 +++++--------------------------
 1 file changed, 5 insertions(+), 26 deletions(-)

diff --git a/eclass/postgres.eclass b/eclass/postgres.eclass
index 7652a862518..9b4097e0052 100644
--- a/eclass/postgres.eclass
+++ b/eclass/postgres.eclass
@@ -1,7 +1,6 @@
 # Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-inherit user
 EXPORT_FUNCTIONS pkg_setup
 
 # @ECLASS: postgres.eclass
@@ -119,31 +118,11 @@ postgres_check_slot() {
 	fi
 }
 
-# @FUNCTION: postgres_new_user
-# @USAGE: [user [(uid|-1) [(shell|-1) [(homedir|-1) [groups]]]]]
-# @DESCRIPTION:
-# Creates the "postgres" system group and user -- which is separate from
-# the database user -- and, optionally, the developer defined user. There
-# are no required parameters.
-#
-# When given a user to create, it'll be created with the next available
-# uid, default shell set to /bin/false, default homedir is /dev/null,
-# and added to the "postgres" system group. You can use "-1" to skip any
-# parameter except user or groups.
-postgres_new_user() {
-	enewgroup postgres 70
-	enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
-
-	if [[ $# -gt 0 ]] ; then
-		if [[ "$1" = "postgres" ]] ; then
-			ewarn "Username 'postgres' implied, skipping"
-		else
-			local groups=$5
-			[[ -n "${groups}" ]] && groups+=",postgres" || groups="postgres"
-			enewuser "$1" "${2:--1}" "${3:--1}" "${4:--1}" "${groups}"
-		fi
-	fi
-}
+RDEPEND="
+	acct-group/postgres
+	acct-user/postgres
+"
+DEPEND="${RDEPEND}"
 
 # @FUNCTION: postgres_pkg_setup
 # @DESCRIPTION:
-- 
2.32.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [gentoo-dev] [PATCH] eclass/postgres.eclass: migrate to GLEP 81
  2021-07-22 22:20 [gentoo-dev] [PATCH] eclass/postgres.eclass: migrate to GLEP 81 Conrad Kostecki
@ 2021-07-22 22:35 ` Michael Orlitzky
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Orlitzky @ 2021-07-22 22:35 UTC (permalink / raw
  To: gentoo-dev

On Fri, 2021-07-23 at 00:20 +0200, Conrad Kostecki wrote:
> This update drops the function 'postgres_new_user', which was used to
> create the 'postgres' user and group.
> 
> ...
> 
> Since many other packages depend on the 'postgres' and 'postgres-multi'
> eclass, adding the core acct-*/postgres packages here to [R]DEPEND.

Not all packages using the eclass necessarily need the "postgres"
user/group to build/run. You should only add (R)DEPEND in the packages
that actually call postgres_new_user, I think?


> 
> Before merging this eclass patch, acct-* packages will be added to
> the tree.

Before doing this, please double-check that SHELL=/bin/bash and
HOME=/var/lib/postgres are needed. It's likely that the default HOME
can be used, and that dev-db/postgresql (which actually *uses*
/var/lib/postgres) should control its permissions.

You should also get an ACK from titanofold, since he's been maintaining
postgresql essentially by himself forever (and may have some insight
into the SHELL/HOME items).




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-22 22:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-22 22:20 [gentoo-dev] [PATCH] eclass/postgres.eclass: migrate to GLEP 81 Conrad Kostecki
2021-07-22 22:35 ` Michael Orlitzky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox