On Sat, 29 Aug 2020 21:53:45 +0200 Michał Górny wrote:
> Thanks to David Michael for the initial patch and upstream fixes.
> 
> Signed-off-by: Michał Górny <mgo...@gentoo.org>
> ---
>  eclass/acct-group.eclass | 16 +++++++++++++++-
>  eclass/acct-user.eclass  | 16 +++++++++++++++-
>  2 files changed, 30 insertions(+), 2 deletions(-)
> 
> diff --git a/eclass/acct-group.eclass b/eclass/acct-group.eclass
> index 5550e4a2fb10..dc1562974870 100644
> --- a/eclass/acct-group.eclass
> +++ b/eclass/acct-group.eclass
> @@ -80,7 +80,7 @@ S=${WORKDIR}
>  
>  
>  # << Phase functions >>
> -EXPORT_FUNCTIONS pkg_pretend pkg_preinst
> +EXPORT_FUNCTIONS pkg_pretend src_install pkg_preinst
>  
>  # @FUNCTION: acct-group_pkg_pretend
>  # @DESCRIPTION:
> @@ -116,6 +116,20 @@ acct-group_pkg_pretend() {
>       fi
>  }
>  
> +# @FUNCTION: acct-group_src_install
> +# @DESCRIPTION:
> +# Installs sysusers.d file for the group.
> +acct-group_src_install() {
> +     debug-print-function ${FUNCNAME} "${@}"
> +
> +     insinto /usr/lib/sysusers.d
> +     newins - ${CATEGORY}-${ACCT_GROUP_NAME}.conf < <(
> +             printf "g\t%q\t%q\n" \
> +                     "${ACCT_GROUP_NAME}" \
> +                     "${ACCT_GROUP_ID/#-*/-}"
> +     )
> +}
> +
>  # @FUNCTION: acct-group_pkg_preinst
>  # @DESCRIPTION:
>  # Creates the group if it does not exist yet.
> diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass
> index e82f3c56dbbe..f9772c3cb111 100644
> --- a/eclass/acct-user.eclass
> +++ b/eclass/acct-user.eclass
> @@ -312,7 +312,7 @@ acct-user_pkg_pretend() {
>  # @FUNCTION: acct-user_src_install
>  # @DESCRIPTION:
>  # Installs a keep-file into the user's home directory to ensure it is
> -# owned by the package.
> +# owned by the package, and sysusers.d file.
>  acct-user_src_install() {
>       debug-print-function ${FUNCNAME} "${@}"
>  
> @@ -321,6 +321,20 @@ acct-user_src_install() {
>               # created yet
>               keepdir "${ACCT_USER_HOME}"
>       fi
> +
> +     insinto /usr/lib/sysusers.d
> +     newins - ${CATEGORY}-${ACCT_USER_NAME}.conf < <(
> +             printf "u\t%q\t%q\t%q\t%q\t%q\n" \
> +                     "${ACCT_USER_NAME}" \
> +                     "${ACCT_USER_ID/#-*/-}:${ACCT_USER_GROUPS[0]}" \
> +                     "${DESCRIPTION//[:,=]/;}" \
> +                     "${ACCT_USER_HOME}" \
> +                     "${ACCT_USER_SHELL/#-*/-}"
> +             if [[ ${#ACCT_USER_GROUPS[@]} -gt 1 ]]; then
> +                     printf "m\t${ACCT_USER_NAME}\t%q\n" \
> +                             "${ACCT_USER_GROUPS[@]:1}"
> +             fi
> +     )
>  }

Why these files are installed unconditionally?

Of course we have a common "small files" policy that USE flags
should not control small files in packages, such rule was designed
for common packages where:
  1) small files are insignificant disk usage compared to a whole
package;
  2) an average package takes significant time to rebuild and mass
rebuild will cause problems during USE flip.

While both arguments are valid for a common packages which provide
real software, this is not true for very special acct-* packages:
  1) They may (and usually do) have zero size of installed files,
this makes sysusers.d stuff an infinite times larger than a
whole typical acct-* package (it will still be much larger if one
will consider size of new passw/group records).
  2) acct-* packages are very fast to rebuild, so such price will
be small compared to other changes necessary when USE="systemd" is
being flipped.

So it will be reasonable to add USE="systemd" to acct-* eclasses
to control the changes proposed above.

Best regards,
Andrew Savchenko

Attachment: pgps8XkbFsi5J.pgp
Description: PGP signature

Reply via email to