From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id A412E158451 for ; Tue, 9 Jan 2024 11:23:49 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1D00AE2A4C; Tue, 9 Jan 2024 11:23:46 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 97773E2A44 for ; Tue, 9 Jan 2024 11:23:45 +0000 (UTC) Message-ID: <2c8a4a000d790d446d86971b58096f3ff4820b20.camel@gentoo.org> Subject: Re: [gentoo-dev] [PATCH v2 1/3] greadme.eclass: new eclass From: David Seifert To: gentoo-dev@lists.gentoo.org Cc: Florian Schmaus Date: Tue, 09 Jan 2024 12:23:41 +0100 In-Reply-To: <20240109083914.242561-1-flow@gentoo.org> References: <20240109083914.242561-1-flow@gentoo.org> Autocrypt: addr=soap@gentoo.org; prefer-encrypt=mutual; keydata=mQINBFppABgBEAC42ZiNvV7BTIgR6TQy0YnF54fx3mVRP1u8Mq00UZa7reAsNKh71H60j0W4s6+4pVVIKGfpVGxLwUdJe+KVCYw1Cd3YW6uMf5zZrC/ZWqnJiH/n6S6o1l4INII2o6YbGBnzIWBPRo7PlOL+mvgKTLpBSJPnhD8XDGN5wRiV8rL2+6Dptg0FnJt7oxECGF3OD3gk6HMel0o82CVkIqMtNaX1L/bhcdF7K0Rp2MXPZMmpn1izW5sIasN1G9+w+Zwj7kMJzq1Aw3ac+rsX4SEYdvXj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er-Encoding: quoted-printable User-Agent: Evolution 3.50.3 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 X-Archives-Salt: cd156ffa-0444-4f5c-aa4a-21db2a755b05 X-Archives-Hash: e0dd2b82e565f897adf0696457ea8366 On Tue, 2024-01-09 at 09:39 +0100, Florian Schmaus wrote: > This new eclass is similar to readme.gentoo-r1.eclass. The main > differences are as follows. Firstly, it also displays the doc file > contents if they have changed. Secondly, it provides a convenient API > to > install the doc file via stdin. >=20 > Furthermore, this eclass dos not store the doc file's contents in an > environment variable, which helps to keep the environment size of > ebuilds using the eclass small. >=20 > Signed-off-by: Florian Schmaus > --- > =C2=A0eclass/greadme.eclass | 307 > ++++++++++++++++++++++++++++++++++++++++++ > =C2=A01 file changed, 307 insertions(+) > =C2=A0create mode 100644 eclass/greadme.eclass >=20 > diff --git a/eclass/greadme.eclass b/eclass/greadme.eclass > new file mode 100644 > index 000000000000..25e0210406c1 > --- /dev/null > +++ b/eclass/greadme.eclass > @@ -0,0 +1,307 @@ > +# Copyright 1999-2024 Gentoo Authors > +# Distributed under the terms of the GNU General Public License v2 > + > +# @ECLASS: greadme.eclass > +# @MAINTAINER: > +# Florian Schmaus > +# @AUTHOR: > +# Author: Florian Schmaus > +# @SUPPORTED_EAPIS: 6 7 8 > +# @BLURB: install a doc file, that will be conditionally shown via > elog messages > +# @DESCRIPTION: > +# An eclass for installing a README.gentoo doc file recording tips > +# shown via elog messages.=C2=A0 With this eclass, those elog messages > will only be > +# shown at first package installation or if the contents of the file > have changed. > +# Furthermore, a file for later reviewing will be installed under > +# /usr/share/doc/${PF} > +# > +# This eclass is similar to readme.gentoo-r1.eclass.=C2=A0 The main > +# differences are as follows.=C2=A0 Firstly, it also displays the doc fi= le > +# contents if they have changed.=C2=A0 Secondly, it provides a convenien= t > API to > +# install the doc file via stdin. > +# > +# @CODE > +# inherit greadme > +# > +# src_install() { > +#=C2=A0=C2=A0 =E2=80=A6 > +#=C2=A0=C2=A0 greadme_stdin <<- EOF > +#=C2=A0=C2=A0 This is the content of the created readme doc file. > +#=C2=A0=C2=A0 EOF > +#=C2=A0=C2=A0 =E2=80=A6 > +#=C2=A0=C2=A0 if use foo; then > +#=C2=A0=C2=A0=C2=A0=C2=A0 greadme_stdin --apend <<-EOF > +#=C2=A0=C2=A0=C2=A0=C2=A0 This is conditional readme content, based on U= SE=3Dfoo. > +#=C2=A0=C2=A0=C2=A0=C2=A0 EOF > +#=C2=A0=C2=A0 fi > +# } > +# @CODE > +# > +# You must call greadme_pkg_preinst and greadme_pkg_postinst > explicitly, if > +# you override the default pkg_preinst or respectively pkg_postinst. > +# > +# TODO: > +# - Should this be named README.Distribution instead of > README.Gentoo? > +#=C2=A0=C2=A0 Would that make things easier for Gentoo derivates? > +#=C2=A0=C2=A0 Similary, (g =E2=86=92 d)readme, (G =E2=86=92 D)README? > +# - Incooperate changes into readme.gentoo-r1.elcass? > +# - Compressing the readme doc file is probably fragile, as it is not > +#=C2=A0=C2=A0 guaranteed that the required binaries for decompression ar= e > installed > +#=C2=A0=C2=A0 in pkg_preinst/pkg_postinst. Note that it is even possible= that > two > +#=C2=A0=C2=A0 different compression algorithms are used, in case of binp= kgs. > + > +if [[ -z ${_README_GENTOO_ECLASS} ]]; then > +_README_GENTOO_ECLASS=3D1 > + > +case ${EAPI} in > + 6|7|8) ;; > + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; > +esac > + > +if [[ ${_GREADME_COMPRESS} ]]; then > + inherit unpacker > +fi > + > +_GREADME_FILENAME=3D"README.gentoo" > +_GREADME_TMP_FILE=3D"${T}/${_GREADME_FILENAME}" > +_GREADME_REL_PATH=3D"usr/share/doc/${PF}/${_GREADME_FILENAME}" > + > +# @FUNCTION: greadme_stdin > +# @USAGE: [--append] > +# @DESCRIPTION: > +# Create the readme doc via stdin.=C2=A0 You can use --append to append = to > an > +# existing readme doc. > +greadme_stdin() { > + debug-print-function ${FUNCNAME} "${@}" > + > + local append=3Dfalse > + while [[ -n ${1} ]] && [[ ${1} =3D~ --* ]]; do > + case ${1} in > + --append) > + append=3Dtrue > + shift > + ;; > + esac > + done > + > + if $append; then > + if [[ ! -f "${_GREADME_TMP_FILE}" ]]; then > + die "Gentoo README does not exist when trying > to append to it" > + fi > + > + cat >> "${_GREADME_TMP_FILE}" || die > + else > + if [[ -f "${_GREADME_TMP_FILE}" ]]; then > + die "Gentoo README already exists while > trying to create it" > + fi > + > + cat > "${_GREADME_TMP_FILE}" || die > + fi > + > + _greadme_install_doc > +} > + > +# @FUNCTION: greadme_file > +# @USAGE: > +# @DESCRIPTION: > +# Installs the provided file as readme doc. > +greadme_file() { > + debug-print-function ${FUNCNAME} "${@}" > + > + local input_doc_file=3D"${1}" > + if [[ -z "${input_doc_file}" ]]; then > + die "No file specified" > + fi > + > + if [[ -f "${_GREADME_TMP_FILE}" ]]; then > + die "Gentoo README already exists" > + fi > + > + cp "${input_doc_file}" "${_GREADME_TMP_FILE}" || die > + > + _greadme_install_doc > +} > + > +# @FUNCTION: _greadme_install_doc > +# @INTERNAL > +# @DESCRIPTION: > +# Installs the readme file from the temp directory into the image. > +_greadme_install_doc() { > + debug-print-function ${FUNCNAME} "${@}" > + > + if [[ ! -f "${_GREADME_TMP_FILE}" ]]; then > + die "Gentoo README does not exist" > + fi > + > + if ! [[ ${_GREADME_COMPRESS} ]]; then > + docompress -x "${_GREADME_REL_PATH}" > + fi > + > + ( # subshell to avoid pollution of calling environment > + docinto . > + dodoc "${_GREADME_TMP_FILE}" > + ) || die > + > +} > + > +# @FUNCTION: greadme_pkg_preinst > +# @DESCRIPTION: > +# Performs checks like comparing the readme doc from the image with a > +# potentially existing one in the live system. > +greadme_pkg_preinst() { > + local image_doc_file=3D"${ED}/${_GREADME_REL_PATH}" > + > + if [[ ${_GREADME_COMPRESS} ]]; then > + local greadme_tmpdir=3D"${T}/greadme" > + > + mkdir -p "${greadme_tmpdir}/image" || die > + > + local image_doc_files=3D( $(ls -1 ${image_doc_file}*) ) > + case ${#image_doc_files[@]} in > + 0) > + die "No Gentoo README found in image" > + ;; > + 1) > + image_doc_file=3D"${image_doc_files[0]} > " > + ;; > + *) > + die "unpexpected number of Gentoo > README files found" > + ;; > + esac > + > + pushd "${T}/greadme/image" > /dev/null > + local image_doc_file_basename=3D"$(basename > "${image_doc_file}")" > + if [[ "${image_doc_file_basename}" =3D=3D > "${_GREADME_FILENAME}" ]]; then > + cp "${image_doc_file}" . || die > + else > + nonfatal unpacker "${image_doc_file}" > + if [[ $? -gt 0 ]]; then > + # We failed to unpack the readme doc > from the > + # image, therefore, we can't show it > (unless we > + # would save it's content in a env > variable like > + # gentoo.readme-r1 does). > + _GREADME_SHOW=3D"" > + return > + fi > + fi > + popd > /dev/null > + fi > + > + if [[ -z ${REPLACING_VERSIONS} ]]; then > + _GREADME_SHOW=3D"fresh-install" > + return > + fi > + > + check_live_doc_file() { > + local cur_pvr=3D$1 > + local live_doc_file=3D"${EROOT}/usr/share/doc/${PN}- > ${cur_pvr}/${_GREADME_FILENAME}" > + > + if [[ ${_GREADME_COMPRESS} ]]; then > + local live_doc_files=3D( $(ls -1 > ${live_doc_file}*) ) > + case ${#live_doc_files[@]} in > + 0) > + _GREADME_SHOW=3D"no-current- > greadme" > + return > + ;; > + 1) > + live_doc_file=3D"${live_doc_fil > es[0]}" > + ;; > + *) > + die "unpexpected number of > Gentoo README files found" > + ;; > + esac > + > + if [[ -d "${greadme_tmpdir}/live" ]]; then > + rm -rf "${greadme_tmpdir}"/live/* || > die > + else > + mkdir "${T}/greadme/live" > + fi > + > + pushd "${T}/greadme/live" > /dev/null > + local live_doc_file_basename=3D"$(basename > "${live_doc_file}")" > + if [[ "${live_doc_file_basename}" =3D=3D > "${_GREADME_FILENAME}" ]]; then > + cp "${live_doc_file}" . > + else > + nonfatal unpacker "${live_doc_file}" > + if [[ $? -gt 0 ]]; then > + # We failed to unpack the > live readme doc, fallback > + # to show the new readme > contents. > + _GREADME_SHOW=3D"failed-to- > unpack-live-readme-doc" > + return > + fi > + fi > + popd > /dev/null > + > + live_doc_file=3D"${T}/greadme/live/${_GREADME_F > ILENAME}" > + image_doc_file=3D"${T}/greadme/image/${_GREADME > _FILENAME}" > + # Store the unpacked greadme in a global > variable so that it can > + # be used in greadme_pkg_postinst. > + _GREADME_UNPACKED=3D"${image_doc_file}" > + else > + if [[ ! -f ${live_doc_file} ]]; then > + _GREADME_SHOW=3D"no-current-greadme" > + return > + fi > + fi > + > + cmp -s "${live_doc_file}" "${image_doc_file}" > + local ret=3D$? > + case ${ret} in > + 0) > + _GREADME_SHOW=3D"" > + ;; > + 1) > + _GREADME_SHOW=3D"content-differs" > + ;; > + *) > + die "cmp failed with ${ret}" > + ;; > + esac > + } > + > + local replaced_version > + for replaced_version in ${REPLACING_VERSIONS}; do > + check_live_doc_file ${replaced_version} > + if [[ -n ${_GREADME_SHOW} ]]; then > + break > + fi > + done > +} > + > +# @FUNCTION: greadme_pkg_postinst > +# @DESCRIPTION: > +# Conditionally shows the contents of the readme doc via elog. > +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_path > + if [[ ${_GREADME_COMPRESS} ]]; then > + if [[ -z ${_GREADME_UNPACKED} ]]; then > + # We failed to decompress the readme doc from > the image. > + return > + fi > + greadme_path=3D"${_GREADME_UNPACKED}" > + else > + greadme_path=3D"${EROOT}/${_GREADME_REL_PATH}" > + fi > + > + local line > + while read -r line; do elog "${line}"; done < > "${greadme_path}" > + elog "" > + elog "(Note: Above message is only printed the first time > package is" > + elog "installed or if the the message changed. Please look > at" > + elog "${EPREFIX}/${_GREADME_REL_PATH} for future reference)" > +} > + > +EXPORT_FUNCTIONS pkg_preinst pkg_postinst > + > +fi Sorry, but this is definitely too much complexity for installing a README file. As is, I will block merging this to the tree.