You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/eclass
..
tests
Manifest.gz
acct-group.eclass
acct-user.eclass
ada.eclass
alternatives.eclass
ant-tasks.eclass
apache-2.eclass
apache-module.eclass
app-alternatives.eclass
aspell-dict-r1.eclass
autotools.eclass
bash-completion-r1.eclass
bazel.eclass
bzr.eclass
cargo.eclass
cdrom.eclass
check-reqs.eclass
chromium-2.eclass
cmake-multilib.eclass
cmake.eclass
common-lisp-3.eclass
cron.eclass
crossdev.eclass
cuda.eclass
cvs.eclass
db-use.eclass
db.eclass
depend.apache.eclass
desktop.eclass
dist-kernel-utils.eclass
distutils-r1.eclass
docs.eclass
dotnet-pkg-base.eclass
dotnet-pkg.eclass
dotnet.eclass
dune.eclass
eapi7-ver.eclass
eapi8-dosym.eclass
ecm.eclass
edo.eclass
edos2unix.eclass
elisp-common.eclass
elisp.eclass
emboss-r3.eclass
epatch.eclass
eqawarn.eclass
estack.eclass
eutils.eclass
fcaps.eclass
findlib.eclass
fixheadtails.eclass
flag-o-matic.eclass
font-ebdftopcf.eclass
font.eclass
fortran-2.eclass
frameworks.kde.org.eclass
freedict.eclass
gear.kde.org.eclass
ghc-package.eclass
git-r3.eclass
gkrellm-plugin.eclass
gnome.org.eclass
gnome2-utils.eclass
gnome2.eclass
gnuconfig.eclass
gnustep-2.eclass
gnustep-base.eclass
go-env.eclass
go-module.eclass
golang-base.eclass
golang-build.eclass
golang-vcs-snapshot.eclass
golang-vcs.eclass
gstreamer-meson.eclass
haskell-cabal.eclass
java-ant-2.eclass
java-osgi.eclass
java-pkg-2.eclass
java-pkg-opt-2.eclass
java-pkg-simple.eclass
java-utils-2.eclass
java-vm-2.eclass
kde.org.eclass
kernel-2.eclass
kernel-build.eclass
kernel-install.eclass
kodi-addon.eclass
latex-package.eclass
libretro-core.eclass
libtool.eclass
linux-info.eclass
linux-mod-r1.eclass
linux-mod.eclass
llvm.eclass
llvm.org.eclass
ltprune.eclass
lua-single.eclass
lua-utils.eclass
lua.eclass
mate-desktop.org.eclass
mate.eclass
mercurial.eclass
meson-multilib.eclass
meson.eclass
mono-env.eclass
mono.eclass
mount-boot.eclass
mozcoreconf-v6.eclass
mozextension.eclass
mozlinguas-v2.eclass
multibuild.eclass
multilib-build.eclass
multilib-minimal.eclass
multilib.eclass
multiprocessing.eclass
myspell-r2.eclass
netsurf.eclass
ninja-utils.eclass
nuget.eclass
office-ext-r1.eclass
opam.eclass
optfeature.eclass
out-of-source-utils.eclass
out-of-source.eclass
pam.eclass
pax-utils.eclass
perl-functions.eclass
perl-module.eclass
php-ext-pecl-r3.eclass
php-ext-source-r3.eclass
php-pear-r2.eclass
plasma-mobile.kde.org.eclass
plasma.kde.org.eclass
plocale.eclass
portability.eclass
postgres-multi.eclass
postgres.eclass
prefix.eclass
preserve-libs.eclass
pypi.eclass
python-any-r1.eclass
python-r1.eclass
python-single-r1.eclass
python-utils-r1.eclass
qmail.eclass
qmake-utils.eclass
qt5-build.eclass
qt6-build.eclass
readme.gentoo-r1.eclass
rebar.eclass
rocm.eclass
rpm.eclass
ruby-fakegem.eclass
ruby-ng-gnome2.eclass
ruby-ng.eclass
ruby-single.eclass
ruby-utils.eclass
rust-toolchain.eclass
s6.eclass
savedconfig.eclass
scons-utils.eclass
secureboot.eclass
selinux-policy-2.eclass
sgml-catalog-r1.eclass
shell-completion.eclass
ssl-cert.eclass
stardict.eclass
strip-linguas.eclass
subversion.eclass
systemd.eclass
texlive-common.eclass
texlive-module.eclass
tmpfiles.eclass
toolchain-autoconf.eclass
toolchain-funcs.eclass
toolchain.eclass
tree-sitter-grammar.eclass
udev.eclass
unpacker.eclass
user-info.eclass
usr-ldscript.eclass
vala.eclass
vcs-clean.eclass
vcs-snapshot.eclass
vdr-plugin-2.eclass
verify-sig.eclass
versionator.eclass
vim-doc.eclass
vim-plugin.eclass
vim-spell.eclass
virtualx.eclass
waf-utils.eclass
webapp.eclass
wrapper.eclass
wxwidgets.eclass
xdg-utils.eclass
xdg.eclass
xemacs-packages.eclass
xorg-3.eclass

readme.gentoo-r1.eclass

# Copyright 1999-2023 Gentoo Authors

# Distributed under the terms of the GNU General Public License v2

# @ECLASS: readme.gentoo-r1.eclass
# @MAINTAINER:
# Pacho Ramos <pacho@gentoo.org>
# @AUTHOR:
# Author: Pacho Ramos <pacho@gentoo.org>
# @SUPPORTED_EAPIS: 6 7 8
# @BLURB: install a doc file shown via elog messages
# @DESCRIPTION:
# An eclass for installing a README.gentoo doc file recording tips
# shown via elog messages. With this eclass, those elog messages will only be
# shown at first package installation and a file for later reviewing will be
# installed under /usr/share/doc/${PF}
#
# You need to call readme.gentoo_create_doc in src_install phase and
# readme.gentoo_print_elog in pkg_postinst

if [[ -z ${_README_GENTOO_ECLASS} ]]; then
_README_GENTOO_ECLASS=1

case ${EAPI} in
6|7|8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac

# @ECLASS_VARIABLE: DOC_CONTENTS
# @DEFAULT_UNSET
# @DESCRIPTION:
# The information that is used to create the README.gentoo file.

# @ECLASS_VARIABLE: DISABLE_AUTOFORMATTING
# @DEFAULT_UNSET
# @DESCRIPTION:
# If non-empty, DOC_CONTENTS information will be strictly respected,
# not getting it automatically formatted by fmt. If empty, it will
# rely on fmt for formatting and 'echo -e' options to tweak lines a bit.

# @ECLASS_VARIABLE: FORCE_PRINT_ELOG
# @DEFAULT_UNSET
# @DESCRIPTION:
# If non-empty this variable forces elog messages to be printed.

# @ECLASS_VARIABLE: README_GENTOO_SUFFIX
# @DESCRIPTION:
# If you want to specify a suffix for README.gentoo file please export it.
: "${README_GENTOO_SUFFIX:=""}"

# @FUNCTION: readme.gentoo_create_doc
# @DESCRIPTION:
# Create doc file with ${DOC_CONTENTS} variable (preferred) and, if not set,
# look for "${FILESDIR}/README.gentoo" contents. You can use
# ${FILESDIR}/README.gentoo-${SLOT} also.
# Usually called at src_install phase.
readme.gentoo_create_doc() {
debug-print-function ${FUNCNAME} "${@}"

if [[ -n "${DOC_CONTENTS}" ]]; then
if [[ -n "${DISABLE_AUTOFORMATTING}" ]]; then
echo "${DOC_CONTENTS}" > "${T}"/README.gentoo || die
else
local saved_flags=$-
set -f # disable filename expansion in echo arguments
echo -e ${DOC_CONTENTS} | fold -s -w 70 \
| sed 's/[[:space:]]*$//' > "${T}"/README.gentoo
assert
set +f -${saved_flags}
fi
elif [[ -f "${FILESDIR}/README.gentoo-${SLOT%/*}" ]]; then
cp "${FILESDIR}/README.gentoo-${SLOT%/*}" "${T}"/README.gentoo || die
elif [[ -f "${FILESDIR}/README.gentoo${README_GENTOO_SUFFIX}" ]]; then
cp "${FILESDIR}/README.gentoo${README_GENTOO_SUFFIX}" "${T}"/README.gentoo || die
else
die "You are not specifying README.gentoo contents!"
fi

( # subshell to avoid pollution of calling environment
docinto .
dodoc "${T}"/README.gentoo
) || die
README_GENTOO_DOC_VALUE=$(< "${T}/README.gentoo")
}

# @FUNCTION: readme.gentoo_print_elog
# @DESCRIPTION:
# Print elog messages with "${T}"/README.gentoo contents. They will be
# shown only when package is installed at first time.
# Usually called at pkg_postinst phase.
#
# If you want to show them always, please set FORCE_PRINT_ELOG to a non empty
# value in your ebuild before this function is called.
# This can be useful when, for example, DOC_CONTENTS is modified, then, you can
# rely on specific REPLACING_VERSIONS handling in your ebuild to print messages
# when people update from versions still providing old message.
readme.gentoo_print_elog() {
debug-print-function ${FUNCNAME} "${@}"

if [[ -z "${README_GENTOO_DOC_VALUE}" ]]; then
die "readme.gentoo_print_elog invoked without matching readme.gentoo_create_doc call!"
elif ! [[ -n "${REPLACING_VERSIONS}" ]] || [[ -n "${FORCE_PRINT_ELOG}" ]]; then
echo -e "${README_GENTOO_DOC_VALUE}" | while read -r ELINE; do elog "${ELINE}"; done
elog ""
elog "(Note: Above message is only printed the first time package is"
elog "installed. Please look at ${EPREFIX}/usr/share/doc/${PF}/README.gentoo*"
elog "for future reference)"
fi
}

fi