[PATCH 1/3] aiaiai-test-patchset: check for coccinelle scripts first

Artem Bityutskiy dedekind1 at gmail.com
Wed May 28 00:15:19 PDT 2014


On Tue, 2014-05-27 at 10:56 -0700, Jacob Keller wrote:
> Rather than always archiving the coccinelle scripts, check to ensure
> they exist first. This prevents issues when attempting to build a
> non-kernel tree, (ie: ethtool). Will display a warning if coccinelle was
> requested but no scripts were found.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller at intel.com>
> ---
>  aiaiai-test-patchset | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/aiaiai-test-patchset b/aiaiai-test-patchset
> index 45527f90b4ae..90c790098e38 100755
> --- a/aiaiai-test-patchset
> +++ b/aiaiai-test-patchset
> @@ -428,10 +428,15 @@ git show "$commit_id1:scripts/checkpatch.pl" > "$checkpatch_pl"
>  chmod $verbose u+x "$checkpatch_pl" >&2
>  
>  if [ -n "$coccinelle" ]; then
> -	mkdir -p $verbose "$tmpdir/coccinelle" >&2
> -	git archive "$commit_id1" scripts/coccinelle | \
> -		tar $verbose --strip-components=2 -C "$tmpdir/coccinelle" -x >&2
> -	coccinelle="--coccinelle=$tmpdir/coccinelle"
> +	if git cat-file -e "$commit_id1:scripts/coccinelle"; then
> +		mkdir -p $verbose "$tmpdir/coccinelle" >&2
> +		git archive "$commit_id1" scripts/coccinelle | \
> +			tar $verbose --strip-components=2 -C "$tmpdir/coccinelle" -x >&2
> +		coccinelle="--coccinelle=$tmpdir/coccinelle"
> +	else
> +		verbose "Can't find coccinelle scripts.. disabling coccinelle tests."
> +		coccinelle=
> +	fi

I think I always followed this general principle:

If user requests something, and we cannot satisfy this, we fail with an
error message.

I'd be consistent with this approach and avoided mixing 2 completely
different principles. Indeed, in this patch, the principle is:

If users requests something, and we cannot satisfy this, we just
silently do not do this.

I say "silently" because this patch would only print a message when -v
is used, and this message would go to stderr and would be buried in tons
on other messages.

I suggest to fail loudly instead.

What do you think?

-- 
Best Regards,
Artem Bityutskiy




More information about the aiaiai mailing list