Gentoo Archives: gentoo-dev

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-dev@l.g.o
Cc: "Ulrich Müller" <ulm@g.o>
Subject: [gentoo-dev] [PATCH v2] user.eclass: Avoid reserved function name
Date: Sun, 15 May 2022 13:20:51
Message-Id: 20220515131954.9872-1-ulm@gentoo.org
In Reply to: [gentoo-dev] [PATCH] user.eclass: Avoid reserved function name by "Ulrich Müller"
1 Names that contain "ebuild" are reserved for package manager use.
2
3 Closes: https://bugs.gentoo.org/843707
4 Signed-off-by: Ulrich Müller <ulm@g.o>
5 ---
6 v2: Prefix the new name with "user".
7
8 eclass/user.eclass | 16 ++++++++--------
9 1 file changed, 8 insertions(+), 8 deletions(-)
10
11 diff --git a/eclass/user.eclass b/eclass/user.eclass
12 index aab549d0c473..906e84e83c69 100644
13 --- a/eclass/user.eclass
14 +++ b/eclass/user.eclass
15 @@ -31,12 +31,12 @@ _USER_ECLASS=1
16
17 inherit user-info
18
19 -# @FUNCTION: _assert_pkg_ebuild_phase
20 +# @FUNCTION: _user_assert_pkg_phase
21 # @INTERNAL
22 # @USAGE: <calling func name>
23 # @DESCRIPTION:
24 # Raises an alert if the phase is not suitable for user.eclass usage.
25 -_assert_pkg_ebuild_phase() {
26 +_user_assert_pkg_phase() {
27 case ${EBUILD_PHASE} in
28 setup|preinst|postinst|prerm|postrm) ;;
29 *)
30 @@ -89,7 +89,7 @@ enewuser() {
31 ewarn "Insufficient privileges to execute ${FUNCNAME[0]}"
32 return 0
33 fi
34 - _assert_pkg_ebuild_phase ${FUNCNAME}
35 + _user_assert_pkg_phase ${FUNCNAME}
36
37 local create_home=1 force_uid=
38 while [[ ${1} == -* ]]; do
39 @@ -262,7 +262,7 @@ enewgroup() {
40 ewarn "Insufficient privileges to execute ${FUNCNAME[0]}"
41 return 0
42 fi
43 - _assert_pkg_ebuild_phase ${FUNCNAME}
44 + _user_assert_pkg_phase ${FUNCNAME}
45
46 local force_gid=
47 while [[ ${1} == -* ]]; do
48 @@ -365,7 +365,7 @@ enewgroup() {
49 # If the new home directory does not exist, it is created.
50 # Any previously existing home directory is NOT moved.
51 esethome() {
52 - _assert_pkg_ebuild_phase ${FUNCNAME}
53 + _user_assert_pkg_phase ${FUNCNAME}
54
55 # get the username
56 local euser=${1}; shift
57 @@ -451,7 +451,7 @@ esethome() {
58 # Required parameters is the username and the new shell.
59 # Specify -1 if you want to set shell to platform-specific nologin.
60 esetshell() {
61 - _assert_pkg_ebuild_phase ${FUNCNAME}
62 + _user_assert_pkg_phase ${FUNCNAME}
63
64 # get the username
65 local euser=${1}; shift
66 @@ -528,7 +528,7 @@ esetshell() {
67 # Update the comment field in a platform-agnostic way.
68 # Required parameters is the username and the new comment.
69 esetcomment() {
70 - _assert_pkg_ebuild_phase ${FUNCNAME}
71 + _user_assert_pkg_phase ${FUNCNAME}
72
73 # get the username
74 local euser=${1}; shift
75 @@ -602,7 +602,7 @@ esetcomment() {
76 # Required parameters is the username and the new list of groups,
77 # primary group first.
78 esetgroups() {
79 - _assert_pkg_ebuild_phase ${FUNCNAME}
80 + _user_assert_pkg_phase ${FUNCNAME}
81
82 [[ ${#} -eq 2 ]] || die "Usage: ${FUNCNAME} <user> <groups>"
83
84 --
85 2.35.1