• [gentoo-dev] [PATCH 0/4] acct-{user,group}.eclass: make user/group name

    From Michael Orlitzky@21:1/5 to All on Thu May 9 14:00:01 2024
    Support changing the user/group name of GLEP81 packages. This is
    sometimes required in overlays because package naming restrictions
    prohibit valid user/group names from being package names.

    We drop "readonly" from the eclasses, and move the computation of the
    make.conf override variable names to global scope so that the eclasses
    won't try to use weird user/group names as bash variables names.

    Michael Orlitzky (4):
    acct-user.eclass: make ACCT_USER_NAME writable
    acct-group.eclass: make ACCT_GROUP_NAME writable
    acct-user.eclass: use an eclass variable for the override variable
    name
    acct-group.eclass: use an eclass variable for the override variable
    name

    eclass/acct-group.eclass | 31 +++++++++++++++++++++++--------
    eclass/acct-user.eclass | 39 +++++++++++++++++++++++++--------------
    2 files changed, 48 insertions(+), 22 deletions(-)

    --
    2.43.2

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael Orlitzky@21:1/5 to All on Thu May 9 14:00:03 2024
    If (after upcasing and replacing hyphens by underscores) ACCT_USER_NAME
    is set to something that isn't valid in a bash variable name, the eclass
    will crash: it uses ACCT_USER_NAME to construct the make.conf override variables in pkg_pretend() and src_install().

    This commit relocates the computation of the "override name" subsequent
    to the definition of ACCT_USER_NAME="${PN}". In Gentoo, policy prohibits redefinition of that variable; so nothing is changed. But in an overlay,
    this allows the ebuild to define ACCT_USER_NAME to something that would
    not be valid in a bash variable at the expense of violating expectations
    about the override variable names.

    Signed-off-by: Michael Orlitzky <mjo@gentoo.org>
    ---
    eclass/acct-user.eclass | 32 ++++++++++++++++++++++----------
    1 file changed, 22 insertions(+), 10 deletions(-)

    diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass
    index a4fe5e9f5e34..fb3ccd2044da 100644
    --- a/eclass/acct-user.eclass
    +++ b/eclass/acct-user.eclass
    @@ -64,6 +64,23 @@ inherit user-info
    # package naming restrictions would prohibit some otherwise-valid usernames.
    ACCT_USER_NAME=${PN}

    +# @ECLASS_VARIABLE: _OVERRIDE_NAME
    +# @INTERNAL
    +# @DESCRIPTION:
    +# A version of the user name suitable for use in a bash variable. This
    +# is used to construct the names of the make.conf override variables and
    +# it will always be uppercase $PN with the hyphens replaced by
    +# underscores. It is defined once, here, so that in an overlay the
    +# ebuild may set ACCT_USER_NAME to something other than $PN without
    +# affecting the name of the override variable. This is necessary if the
    +# username in question would lead to an invalid bash variable
    +# name. Doing so does violate ex