On Mon, Dec 15, 2025 at 07:55:31PM -0500, Ionen Wolkens wrote:
> 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"}
> 
> Hm, maybe another thing, I wonder how likely users are to have OS_
> variables set in their environment by accident? The variables names
> are kind of short/generic and was wondering if it could be an issue.
> 
> I vaguely recall Windows uses the OS_NAME variable in places for one.
> 
> Makes the variables nastier but maybe add the eclass name in them,
> like BRANDING_OS_NAME or OS_BRANDING_NAME I dunno.

I did consider BRANDING_OS_*, so I'm happy to go with that. Thanks for the heads
up on the quoting. I always get these ones wrong! Bad me for forgetting to
shellcheck.

While I'm here, I noticed that this eclass always triggers pkgcheck's
UnusedInherits warning. I don't know what to do about that.

> > +
> > +# @ECLASS_VARIABLE: OS_ID
> > +# @USER_VARIABLE
> > +# @OUTPUT_VARIABLE
> > +# @DESCRIPTION:
> > +# Corresponds to os-release's ID. See man os-release.
> > +: ${OS_ID:="gentoo"}
> > +
> > +# @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
> > 
> > 
> 
> -- 
> ionen



Reply via email to