On Sat, 19 Dec 2015 18:18:43 +0100 Ulrich Mueller <[email protected]> wrote:
> Here is a change to readme.gentoo-r1.eclass, as discussed with pacho. > The eclass currently inherits eutils for shell flag saving, which > seems like overkill (especially in EAPI 6). Replace this by a more > lightweight approach. > > Ulrich > > > From b1f6de1e005d1cbcc9f2cfff281ad7d1d176fd31 Mon Sep 17 00:00:00 2001 > From: =?UTF-8?q?Ulrich=20M=C3=BCller?= <[email protected]> > Date: Sat, 19 Dec 2015 15:15:05 +0100 > Subject: [PATCH] readme.gentoo-r1.eclass: Do not inherit eutils. > > This was only needed in readme.gentoo_create_doc() for a single call > of eshopts_{push,pop}. Replace it by saving the set of options in a > variable. Die if writing the temp file in readme.gentoo_create_doc() > fails. > --- > eclass/readme.gentoo-r1.eclass | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) > > diff --git a/eclass/readme.gentoo-r1.eclass b/eclass/readme.gentoo-r1.eclass > index c076650..07320c0 100644 > --- a/eclass/readme.gentoo-r1.eclass > +++ b/eclass/readme.gentoo-r1.eclass > @@ -21,8 +21,6 @@ > if [[ -z ${_README_GENTOO_ECLASS} ]]; then > _README_GENTOO_ECLASS=1 > > -inherit eutils > - > case "${EAPI:-0}" in > 0|1|2|3) > die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" > @@ -61,15 +59,16 @@ readme.gentoo_create_doc() { > debug-print-function ${FUNCNAME} "${@}" > > if [[ -n "${DOC_CONTENTS}" ]]; then > - eshopts_push > - set -f > if [[ -n "${DISABLE_AUTOFORMATTING}" ]]; then > - echo "${DOC_CONTENTS}" > "${T}"/README.gentoo > + 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 Maybe I'm missing something but is there any reason not to quote "${DOC_CONTENTS}" instead of working around the results of not quoting it? > + assert > + set +f -${saved_flags} > fi > - eshopts_pop > 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 -- Best regards, Michał Górny <http://dev.gentoo.org/~mgorny/>
pgpva2TPSPpav.pgp
Description: OpenPGP digital signature
