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