Gentoo Archives: gentoo-dev

From: Zac Medico <zmedico@g.o>
To: "Jason A. Donenfeld" <Jason@×××××.com>, dev-portage@g.o, gentoo-dev@l.g.o
Subject: [gentoo-dev] Re: [PATCH] eapply_user: allow empty directories
Date: Sun, 06 Mar 2016 23:12:32
Message-Id: 56DCB952.1020007@gentoo.org
1 On 03/06/2016 03:01 PM, Jason A. Donenfeld wrote:
2 > Without this, an empty directory in
3 > /etc/portage/patches/$cat/$pkg will result in an fatal error.
4 >
5 > Fixes: 573920
6 > Signed-off-by: Jason A. Donenfeld <Jason@×××××.com>
7 > ---
8 > bin/phase-helpers.sh | 8 +++++++-
9 > 1 file changed, 7 insertions(+), 1 deletion(-)
10 >
11 > diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
12 > index 80f5946..60e51ea 100644
13 > --- a/bin/phase-helpers.sh
14 > +++ b/bin/phase-helpers.sh
15 > @@ -1089,6 +1089,10 @@ if ___eapi_has_eapply_user; then
16 > local basedir=${PORTAGE_CONFIGROOT%/}/etc/portage/patches
17 >
18 > local d applied
19 > + local LC_ALL=POSIX
20 > + local prev_shopt=$(shopt -p nullglob)
21 > + shopt -s nullglob
22 > +
23 > # possibilities:
24 > # 1. ${CATEGORY}/${P}-${PR} (note: -r0 desired to avoid applying
25 > # ${P} twice)
26 > @@ -1096,12 +1100,14 @@ if ___eapi_has_eapply_user; then
27 > # 3. ${CATEGORY}/${PN}
28 > # all of the above may be optionally followed by a slot
29 > for d in "${basedir}"/${CATEGORY}/{${P}-${PR},${P},${PN}}{,:${SLOT%/*}}; do
30 > - if [[ -d ${d} ]]; then
31 > + if [[ -n $(echo ${d}/*.diff) || -n $(echo ${d}/*.patch) ]]; then
32
33 Technically, ${d} should be quoted above. Otherwise, the patch looks good.
34
35 Test case:
36
37 $ d="foo bar"
38 $ echo ${d}
39 foo bar
40 $ echo "${d}"
41 foo bar
42
43 > eapply "${d}"
44 > applied=1
45 > fi
46 > done
47 >
48 > + ${prev_shopt}
49 > +
50 > [[ -n ${applied} ]] && ewarn "User patches applied."
51 > }
52 > fi
53 >
54
55
56 --
57 Thanks,
58 Zac