Gentoo Archives: gentoo-dev

From: Pacho Ramos <pacho@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] readme.gentoo.eclass: expand variables when a file is used instead of setting DOC_CONTENTS in ebuild
Date: Mon, 01 Sep 2014 10:38:31
Message-Id: 1409567897.880.8.camel@gentoo.org
In Reply to: Re: [gentoo-dev] readme.gentoo.eclass: expand variables when a file is used instead of setting DOC_CONTENTS in ebuild by Ulrich Mueller
1 El dom, 31-08-2014 a las 14:29 +0200, Ulrich Mueller escribió:
2 > >>>>> On Sun, 31 Aug 2014, Pacho Ramos wrote:
3 >
4 > > This tries to solve:
5 > > https://bugs.gentoo.org/show_bug.cgi?id=519682
6 >
7 > - cp "${FILESDIR}/README.gentoo-${SLOT%/*}" "${T}"/README.gentoo || die
8 > + eval echo $(cat "${FILESDIR}/README.gentoo-${SLOT%/*}") > "${T}"/README.gentoo || die
9 >
10 > Am I missing something, or will this destroy any formatting (like line
11 > breaks) within the file?
12
13 What about
14 while read; do eval echo "$REPLY"; done <
15 "${FILESDIR}/README.gentoo-${SLOT%/*}" > "${T}"/README.gentoo || die
16
17 ?
18
19 >
20 > > Looks to do the job but maybe there are shorter or saner ways of
21 > > doing it
22 >
23 > If the goal is to expand variables like PF, then I think a solution
24 > like the one indicated in comment #2 of above-mentioned bug would be
25 > safer, i.e. expand @PF@ etc. to the respective variables. This can be
26 > done with sed.
27 >
28 > Ulrich
29
30 But, if I don't misunderstand, wouldn't it need an explicit substitution
31 for each variable people tries to use? (I mean, for now it's $PF, but
32 maybe other people want to expand $HOMEPAGE, $PN...)
33
34 Thanks

Replies