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

    From Michael Orlitzky@21:1/5 to All on Thu May 9 22:50: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 use PN instead of ACCT_{USER,GROUP}_NAME to construct the make.conf overrides.

    Changes in v2:

    - Two spaces after a period.
    - Use PN directly for override names

    Michael Orlitzky (4):
    acct-user.eclass: make ACCT_USER_NAME writable
    acct-group.eclass: make ACCT_GROUP_NAME writable
    eclass/acct-user.eclass: use $PN to construct make.conf override vars
    eclass/acct-group.eclass: use $PN to construct make.conf override vars

    eclass/acct-group.eclass | 18 ++++++++++--------
    eclass/acct-user.eclass | 22 ++++++++++++----------
    2 files changed, 22 insertions(+), 18 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 22:50:01 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 constructs the variable names using PN instead of ACCT_USER_NAME. In ::gentoo, the two
    are equivalent, but in an overlay this allows weirder usernames at the
    expense of slightly mismatched variable names.

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

    diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass
    index 765487391fbd..9eab1f4c4ae6 100644
    --- a/eclass/acct-user.eclass
    +++ b/eclass/acct-user.eclass
    @@ -231,8 +231,9 @@ acct-user_pkg_pretend() {
    [[ ${ACCT_USER_ID} -ge -1 ]] || die "Ebuild error: ACCT_USER_ID=${ACCT_USER_ID} invalid!"
    local user_id=${ACCT_USER_ID}

    - # check for the override
    - local override_name=${ACCT_USER_NAME^^}
    + # check for the override, use PN in case this is an overlay and
    + # ACCT_USER_NAME is not PN and not valid in a bash variable name
    + local override_name=${PN^^}
    local override_var=ACCT_USER_${override_name//-/_}_ID
    if [[ -n ${!override_var} ]]; then
    user_id=${!override_var}
    @@ -274,8 +275,9 @@ acct-user_src_install() {
    # serialize for override support
    local ACCT_USER_GROUPS=${ACCT_USER_GROUPS[*]}

    - # support make.conf overrides
    - local override_name=${ACCT_USER_NAME^^}
    + # suppor
  • From Michael Orlitzky@21:1/5 to All on Thu May 9 22:50:01 2024
    If (after upcasing and replacing hyphens by underscores) ACCT_GROUP_NAME
    is set to something that isn't valid in a bash variable name, the eclass
    will crash: it uses ACCT_GROUP_NAME to construct the make.conf override variables in pkg_pretend() and src_install(). This commit constructs the variable names using PN instead of ACCT_GROUP_NAME. In ::gentoo, the two
    are equivalent, but in an overlay this allows weirder group names at the expense of slightly mismatched variable names.

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

    diff --git a/eclass/acct-group.eclass b/eclass/acct-group.eclass
    index 6dd6dc06a07e..2c2c88cfc7e1 100644
    --- a/eclass/acct-group.eclass
    +++ b/eclass/acct-group.eclass
    @@ -96,8 +96,9 @@ acct-group_pkg_pretend() {
    [[ ${ACCT_GROUP_ID} -ge -1 ]] || die "Ebuild error: ACCT_GROUP_ID=${ACCT_GROUP_ID} invalid!"
    local group_id=${ACCT_GROUP_ID}

    - # check for the override
    - local override_name=${ACCT_GROUP_NAME^^}
    + # check for the override, use PN in case this is an overlay and
    + # ACCT_GROUP_NAME is not PN and not valid in a bash variable name
    + local override_name=${PN^^}
    local override_var=ACCT_GROUP_${override_name//-/_}_ID
    if [[ -n ${!override_var} ]]; then
    group_id=${!override_var}
    @@ -132,8 +133,9 @@ acct-group_pkg_pretend() {
    acct-group_src_install() {
    debug-print-function ${FUNCNAME} "${@}"

    - # check for the override
    - local override_name=${ACCT_GROUP_NAME^^}
    + # check for t