On Mon, Dec 15, 2025 at 04:01:05PM +0000, James Le Cuirot wrote: > Signed-off-by: James Le Cuirot <[email protected]> > --- > eclass/branding.eclass | 85 ++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 85 insertions(+) > create mode 100644 eclass/branding.eclass > > diff --git a/eclass/branding.eclass b/eclass/branding.eclass > new file mode 100644 > index 000000000000..06b09f09ea4c > --- /dev/null > +++ b/eclass/branding.eclass > @@ -0,0 +1,85 @@ > +# Copyright 2025 Gentoo Authors > +# Distributed under the terms of the GNU General Public License v2 > + > +# @ECLASS: branding.eclass > +# @MAINTAINER: > +# James Le Cuirot <[email protected]> > +# @AUTHOR: > +# James Le Cuirot <[email protected]> > +# @SUPPORTED_EAPIS: 8 9 > +# @BLURB: Branding variables with Gentoo defaults > +# @DESCRIPTION: > +# This defines a set of variables for appling branding to various packages. > The > +# variables default to Gentoo values. These can be overridden by users or > +# downstream distributions. > + > +case ${EAPI} in > + 8|9) ;; > + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; > +esac > + > +# @ECLASS_VARIABLE: OS_NAME > +# @USER_VARIABLE > +# @OUTPUT_VARIABLE > +# @DESCRIPTION: > +# Corresponds to os-release's NAME. See man os-release. > +: ${OS_NAME:="Gentoo"}
All these should have quotes on the outside. In case anyone don't know,
this is to prevent potential DDoS with excessive globbing set in the
variable given e.g. : */*/*/* ... is processed
: "${OS_NAME:=Gentoo}"
Could do : "${OS_NAME:="Gentoo"}" as well but that just makes it looks
weird even if valid.
> +
> +# @ECLASS_VARIABLE: OS_ID
> +# @USER_VARIABLE
> +# @OUTPUT_VARIABLE
> +# @DESCRIPTION:
> +# Corresponds to os-release's ID. See man os-release.
> +: ${OS_ID:="gentoo"}
Maybe it would be good to explicitly point out the requirements here,
I may end up using it with the idea that e.g. this *must* never have
spaces.
Likewise for VERSION_ID
> +
> +# @ECLASS_VARIABLE: OS_ID_LIKE
> +# @USER_VARIABLE
> +# @OUTPUT_VARIABLE
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# Corresponds to os-release's ID_LIKE. See man os-release.
> +
> +# @ECLASS_VARIABLE: OS_HOME_URL
> +# @USER_VARIABLE
> +# @OUTPUT_VARIABLE
> +# @DESCRIPTION:
> +# Corresponds to os-release's HOME_URL. See man os-release.
> +: ${OS_HOME_URL:="https://www.gentoo.org/"}
> +
> +# @ECLASS_VARIABLE: OS_SUPPORT_URL
> +# @USER_VARIABLE
> +# @OUTPUT_VARIABLE
> +# @DESCRIPTION:
> +# Corresponds to os-release's SUPPORT_URL. See man os-release.
> +: ${OS_SUPPORT_URL:="https://www.gentoo.org/support/"}
> +
> +# @ECLASS_VARIABLE: OS_BUG_REPORT_URL
> +# @USER_VARIABLE
> +# @OUTPUT_VARIABLE
> +# @DESCRIPTION:
> +# Corresponds to os-release's BUG_REPORT_URL. See man os-release.
> +: ${OS_BUG_REPORT_URL:="https://bugs.gentoo.org/"}
> +
> +# @ECLASS_VARIABLE: OS_VERSION
> +# @USER_VARIABLE
> +# @OUTPUT_VARIABLE
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# Corresponds to os-release's VERSION. See man os-release.
> +
> +# @ECLASS_VARIABLE: OS_VERSION_ID
> +# @USER_VARIABLE
> +# @OUTPUT_VARIABLE
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# Corresponds to os-release's VERSION_ID. See man os-release.
> +
> +# @ECLASS_VARIABLE: OS_PRETTY_NAME
> +# @USER_VARIABLE
> +# @OUTPUT_VARIABLE
> +# @DESCRIPTION:
> +# Corresponds to os-release's PRETTY_NAME. See man os-release. If completely
> +# unset, defaults to "Gentoo Linux". If set but blank, defaults to the
> +# concatenation of OS_NAME and OS_VERSION.
> +: ${OS_PRETTY_NAME="Gentoo Linux"}
> +: ${OS_PRETTY_NAME:="${OS_NAME}${OS_VERSION:+ }${OS_VERSION}"}
> --
> 2.51.2
I think it makes sense to have this anyhow, may help other projects as
well and indeed not have them bring bugs our way.
Normal users may end up customizing this for no reason, but well.
--
ionen
signature.asc
Description: PGP signature
