public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Ulrich Mueller <ulm@gentoo.org>
To: Florian Schmaus <flow@gentoo.org>
Cc: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] [PATCH v4] greadme.eclass: new eclass
Date: Sun, 16 Jun 2024 22:09:24 +0200	[thread overview]
Message-ID: <uh6dsr6ob@gentoo.org> (raw)
In-Reply-To: <20240616155123.1016092-1-flow@gentoo.org> (Florian Schmaus's message of "Sun, 16 Jun 2024 17:51:23 +0200")

[-- Attachment #1: Type: text/plain, Size: 1361 bytes --]

>>>>> On Sun, 16 Jun 2024, Florian Schmaus wrote:

> First, the content of README.gento will only be shown on new

Typo.

> +greadme_pkg_postinst() {
> +	debug-print-function ${FUNCNAME} "${@}"
> +
> +	if [[ ! -v _GREADME_SHOW ]]; then
> +		die "_GREADME_SHOW not set. Did you call greadme_pkg_preinst?"
> +	fi
> +
> +	if [[ -z ${_GREADME_SHOW} ]]; then
> +		# If _GREADME_SHOW is empty, then there is no reason to show the contents.
> +		return
> +	fi
> +
> +	local greadme="${EROOT}${_GREADME_REL_PATH}"
> +
> +	if [[ ! -f ${greadme} ]]; then
> +		ewarn "Unable to show ${_GREADME_FILENAME}, file not installed (FEATURES=nodoc enabled?)."

I still think that the file's contents should be saved in a variable,
which would avoid the problem. (Presumably, pkg_preinst wouldn't be
necessary then either, because the variable is still available in the
postinst phase, whereas ${D} isn't.)

In any case, showing this warning every time might be annoying.
How about showing it only the first time, i.e. if REPLACING_VERSIONS
is empty?

> +		return
> +	fi
> +
> +	local line
> +	while read -r line; do elog "${line}"; done < "${greadme}"
> +	elog ""
> +	elog "(Note: Above message is only printed the first time package is"
> +	elog "installed or if the message changes on update. Please look at"
> +	elog "${EPREFIX}${_GREADME_REL_PATH} for future reference)"
> +}

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 507 bytes --]

      parent reply	other threads:[~2024-06-16 20:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-16 15:51 [gentoo-dev] [PATCH v4] greadme.eclass: new eclass Florian Schmaus
2024-06-16 18:15 ` Arthur Zamarin
2024-06-17  0:51   ` [gentoo-dev] " Duncan
2024-06-18 11:33   ` [gentoo-dev] " Florian Schmaus
2024-06-18 14:02     ` Ulrich Mueller
2024-06-18 14:53       ` Florian Schmaus
2024-06-18 18:21         ` Arthur Zamarin
2024-06-18 18:55           ` Ionen Wolkens
2024-06-18 20:48           ` Florian Schmaus
2024-06-19  8:32         ` Ulrich Mueller
2024-06-19 12:18           ` Florian Schmaus
2024-06-16 20:09 ` Ulrich Mueller [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=uh6dsr6ob@gentoo.org \
    --to=ulm@gentoo.org \
    --cc=flow@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox