public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Zac Medico <zmedico@gentoo.org>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>,
	dev-portage@gentoo.org, gentoo-dev@lists.gentoo.org
Subject: [gentoo-dev] Re: [PATCH] eapply_user: allow empty directories
Date: Sun, 6 Mar 2016 15:12:18 -0800	[thread overview]
Message-ID: <56DCB952.1020007@gentoo.org> (raw)
In-Reply-To: <1457305317-32338-1-git-send-email-Jason@zx2c4.com>

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


       reply	other threads:[~2016-03-06 23:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1457305317-32338-1-git-send-email-Jason@zx2c4.com>
2016-03-06 23:12 ` Zac Medico [this message]
2016-03-06 23:33 ` [gentoo-dev] Re: [PATCH] eapply_user: allow empty directories Ulrich Mueller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56DCB952.1020007@gentoo.org \
    --to=zmedico@gentoo.org \
    --cc=Jason@zx2c4.com \
    --cc=dev-portage@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox