* [gentoo-dev] Re: [PATCH] eapply_user: allow empty directories
[not found] <1457305317-32338-1-git-send-email-Jason@zx2c4.com>
@ 2016-03-06 23:12 ` Zac Medico
2016-03-06 23:33 ` Ulrich Mueller
1 sibling, 0 replies; 2+ messages in thread
From: Zac Medico @ 2016-03-06 23:12 UTC (permalink / raw
To: Jason A. Donenfeld, dev-portage, gentoo-dev
On 03/06/2016 03:01 PM, Jason A. Donenfeld wrote:
> Without this, an empty directory in
> /etc/portage/patches/$cat/$pkg will result in an fatal error.
>
> Fixes: 573920
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> ---
> bin/phase-helpers.sh | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
> index 80f5946..60e51ea 100644
> --- a/bin/phase-helpers.sh
> +++ b/bin/phase-helpers.sh
> @@ -1089,6 +1089,10 @@ if ___eapi_has_eapply_user; then
> local basedir=${PORTAGE_CONFIGROOT%/}/etc/portage/patches
>
> local d applied
> + local LC_ALL=POSIX
> + local prev_shopt=$(shopt -p nullglob)
> + shopt -s nullglob
> +
> # possibilities:
> # 1. ${CATEGORY}/${P}-${PR} (note: -r0 desired to avoid applying
> # ${P} twice)
> @@ -1096,12 +1100,14 @@ if ___eapi_has_eapply_user; then
> # 3. ${CATEGORY}/${PN}
> # all of the above may be optionally followed by a slot
> for d in "${basedir}"/${CATEGORY}/{${P}-${PR},${P},${PN}}{,:${SLOT%/*}}; do
> - if [[ -d ${d} ]]; then
> + if [[ -n $(echo ${d}/*.diff) || -n $(echo ${d}/*.patch) ]]; then
Technically, ${d} should be quoted above. Otherwise, the patch looks good.
Test case:
$ d="foo bar"
$ echo ${d}
foo bar
$ echo "${d}"
foo bar
> eapply "${d}"
> applied=1
> fi
> done
>
> + ${prev_shopt}
> +
> [[ -n ${applied} ]] && ewarn "User patches applied."
> }
> fi
>
--
Thanks,
Zac
^ permalink raw reply [flat|nested] 2+ messages in thread