From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 8294DA04FD;
	Thu, 10 Nov 2022 10:27:56 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 28A19400EF;
	Thu, 10 Nov 2022 10:27:56 +0100 (CET)
Received: from mailgw01.pantheon.sk (mailgw01.pantheon.sk [46.229.239.26])
 by mails.dpdk.org (Postfix) with ESMTP id 1C39B400D4
 for <dev@dpdk.org>; Thu, 10 Nov 2022 10:27:54 +0100 (CET)
Received: from mailgw01.pantheon.sk (localhost.localdomain [127.0.0.1])
 by mailgw01.pantheon.sk (Proxmox) with ESMTP id CC0FD20217A;
 Thu, 10 Nov 2022 10:27:53 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pantheon.tech;
 h=cc:cc:content-transfer-encoding:content-type:content-type
 :date:from:from:in-reply-to:message-id:mime-version:references
 :reply-to:subject:subject:to:to; s=dkim; bh=lREsbCZHNRmBjGjbpnhS
 sv6s0Hd+3w84gx/a3S38a+I=; b=aUnGTiGAW9a7+sxasjGP5zt+PxEpGnFKFm+Z
 2zq2cluqYTKVLciIevLQXLxVy0h3/bqQqFVTxPbVJotYaRMyL8IPMviQWkCJolA9
 EemFBwflyNGx9a8J5kA2ZM3NDuxLFbHYBajoGFmDaKDR3OhO+qIvCpY7nxhc0ibb
 ztM76gNZKqbRBI7z6EFBUB18HuTSrhKsbIuFnnGyLXgmhCvMV6RzRYu14sL/e23z
 opqBItyZLUIRVeO9rxPQ+EtO1n9+tdj0ODv8xuKkGOtKgjDB5rUSe8/MANY0CYJ9
 ymycr6xbz8GkMZHwnpZIwehdR8aCN2scte00wx04FYKlJmSWGg==
From: =?iso-8859-2?Q?Juraj_Linke=B9?= <juraj.linkes@pantheon.tech>
To: Thomas Monjalon <thomas@monjalon.net>, "dev@dpdk.org" <dev@dpdk.org>
CC: Lijuan Tu <lijuan.tu@intel.com>, Owen Hilyard <ohilyard@iol.unh.edu>
Subject: RE: [PATCH] devtools: set DTS directory to format check
Thread-Topic: [PATCH] devtools: set DTS directory to format check
Thread-Index: AQHY9F4UEAHmL9FL7ESZFaFmXpMRGa434qPA
Date: Thu, 10 Nov 2022 09:27:52 +0000
Message-ID: <464c6b5616664baa90655f6236fde2b2@pantheon.tech>
References: <20221109170921.625192-1-thomas@monjalon.net>
In-Reply-To: <20221109170921.625192-1-thomas@monjalon.net>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-originating-ip: [10.101.4.10]
Content-Type: text/plain; charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org



> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Wednesday, November 9, 2022 6:09 PM
> To: dev@dpdk.org
> Cc: Juraj Linke=B9 <juraj.linkes@pantheon.tech>; Lijuan Tu
> <lijuan.tu@intel.com>; Owen Hilyard <ohilyard@iol.unh.edu>
> Subject: [PATCH] devtools: set DTS directory to format check
>=20
> The script was running on the current directory.
> If not in the DTS directory, it would re-format every Python files.
>=20
> A new positional argument is added to specify the directory to check.
> In most cases, the (new) default value should be enough.
>=20
> While updating argument handling,
> the usage is printed in case of wrong argument.
>=20
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
>  devtools/dts-check-format.sh | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
>=20
> diff --git a/devtools/dts-check-format.sh b/devtools/dts-check-format.sh
> index dc07150775..eb1bdd2a01 100755
> --- a/devtools/dts-check-format.sh
> +++ b/devtools/dts-check-format.sh
> @@ -3,11 +3,10 @@
>  # Copyright(c) 2022 University of New Hampshire
>=20
>  usage() {
> -	echo "Run formatting and linting programs for DTS. Usage:"
> -
> +	echo 'Usage: $(basename $0) [options] [directory]'

Double quotes here, otherwise $0 won't be expanded.

> +	echo 'Options:'
>  	# Get source code comments after getopts arguments and print
> them both
>  	grep -E '[a-zA-Z]+\) +#' "$0" | tr -d '#'
> -	exit 0
>  }
>=20
>  format=3Dtrue
> @@ -17,7 +16,9 @@ lint=3Dtrue
>  while getopts "hfl" arg; do
>  	case $arg in
>  	h) # Display this message
> +		echo 'Run formatting and linting programs for DTS.'
>  		usage
> +		exit 0
>  		;;
>  	f) # Don't run formatters
>  		format=3Dfalse
> @@ -25,10 +26,15 @@ while getopts "hfl" arg; do
>  	l) # Don't run linter
>  		lint=3Dfalse
>  		;;
> -	*)
> +	?)
> +		usage
> +		exit 1
>  	esac
>  done
> +shift $(($OPTIND - 1))
>=20
> +directory=3D${1:-$(dirname $0)/../dts}
> +cd $directory || exit 1
>=20

I'd like to include the information of where we're doing the fomatting in t=
he console output, e.g.:
echo "Formatting in $(pwd):"

We're silently chaning the directory, so this would be useful when running =
with no argument and the script doesn't change anything - as a confirmation=
 that it ran over the files we wanted to.

>  errors=3D0
>=20
> --
> 2.36.1
>=20

Other than that,
Reviewed-by: Juraj Linke=B9 <juraj.linkes@pantheon.tech>
Tested-by: Juraj Linke=B9 <juraj.linkes@pantheon.tech>