Gentoo Archives: gentoo-dev

From: Ulrich Mueller <ulm@g.o>
To: gentoo-dev@l.g.o
Cc: Pacho Ramos <pacho@g.o>
Subject: [gentoo-dev] [PATCH] readme.gentoo-r1.eclass: Do not inherit eutils.
Date: Sat, 19 Dec 2015 17:19:04
Message-Id: 22133.37235.269273.46499@a1i15.kph.uni-mainz.de
1 Here is a change to readme.gentoo-r1.eclass, as discussed with pacho.
2 The eclass currently inherits eutils for shell flag saving, which
3 seems like overkill (especially in EAPI 6). Replace this by a more
4 lightweight approach.
5
6 Ulrich
7
8
9 From b1f6de1e005d1cbcc9f2cfff281ad7d1d176fd31 Mon Sep 17 00:00:00 2001
10 From: =?UTF-8?q?Ulrich=20M=C3=BCller?= <ulm@g.o>
11 Date: Sat, 19 Dec 2015 15:15:05 +0100
12 Subject: [PATCH] readme.gentoo-r1.eclass: Do not inherit eutils.
13
14 This was only needed in readme.gentoo_create_doc() for a single call
15 of eshopts_{push,pop}. Replace it by saving the set of options in a
16 variable. Die if writing the temp file in readme.gentoo_create_doc()
17 fails.
18 ---
19 eclass/readme.gentoo-r1.eclass | 11 +++++------
20 1 file changed, 5 insertions(+), 6 deletions(-)
21
22 diff --git a/eclass/readme.gentoo-r1.eclass b/eclass/readme.gentoo-r1.eclass
23 index c076650..07320c0 100644
24 --- a/eclass/readme.gentoo-r1.eclass
25 +++ b/eclass/readme.gentoo-r1.eclass
26 @@ -21,8 +21,6 @@
27 if [[ -z ${_README_GENTOO_ECLASS} ]]; then
28 _README_GENTOO_ECLASS=1
29
30 -inherit eutils
31 -
32 case "${EAPI:-0}" in
33 0|1|2|3)
34 die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
35 @@ -61,15 +59,16 @@ readme.gentoo_create_doc() {
36 debug-print-function ${FUNCNAME} "${@}"
37
38 if [[ -n "${DOC_CONTENTS}" ]]; then
39 - eshopts_push
40 - set -f
41 if [[ -n "${DISABLE_AUTOFORMATTING}" ]]; then
42 - echo "${DOC_CONTENTS}" > "${T}"/README.gentoo
43 + echo "${DOC_CONTENTS}" > "${T}"/README.gentoo || die
44 else
45 + local saved_flags=$-
46 + set -f # disable filename expansion in echo arguments
47 echo -e ${DOC_CONTENTS} | fold -s -w 70 \
48 | sed 's/[[:space:]]*$//' > "${T}"/README.gentoo
49 + assert
50 + set +f -${saved_flags}
51 fi
52 - eshopts_pop
53 elif [[ -f "${FILESDIR}/README.gentoo-${SLOT%/*}" ]]; then
54 cp "${FILESDIR}/README.gentoo-${SLOT%/*}" "${T}"/README.gentoo || die
55 elif [[ -f "${FILESDIR}/README.gentoo${README_GENTOO_SUFFIX}" ]]; then
56 --
57 2.6.4

Replies