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 <[email protected]>
> ---
> 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